We are building a backend RESTful service for a workflow builder. The service's responsibilities will be to accept workflow definitions from a frontend and store them in a database.
We are trying to decide between the following two choices for the structure of the API.
Choice 1: Single API, saveWorkflowDefinition, which takes the entire definition from the frontend as a json and dumps it into the db after validating the json.
Pros:
- Simpler API implementation, lesser dev effort.
Cons:
- Every API call will send the entire workflow definition which will result in high network bandwidth usage.
- Complex computation for workflow definition validation. Input structure will be too complex.
Choice 2: Multiple smaller APIs, like addWorkflowNode, removeWorkflowNode, updateNodeDefinition.
Pros:
Smaller API calls will result in optimal network bandwidth usage.
Easier to do input validation. Simpler api signatures
Given the above pros/cons and given that dev effort is not a major deciding factor, we are planning to go ahead with Choice 2. Are there any other pros/cons that we are missing for both the approaches?