I have an api to create a ticket for a given component_id, POST /api/ticket
that takes an input of (“component_id”, “ticket_number”, “ticket_date”).
Now at the time of firing of this API, there is an option to perform an operation on another table/resource of the component. This is based of the user ticking a box, and for the example lets say it’s called reset_fl
.
Would it be appropriate to pass in this key of reset_fl
to the ticket object even though this key does not belong to that resource/table. I would take the value of this flag and then perform an operation on another table.
Or would it be better to create another API and fire off another call to perform this operation? Something like POST /api/component/{component_id}/reset
The pros to this would be having the functionality separated, so if one fails it doesn’t affect the other. The cons would be having to call two different API’s.
What would be the best approach here.