Hi,
My question is similar to this thread, however, slightly different.
I’m working on a scheduling application where appointments can be explicitly started and ended (think check-in/check-out). Starting an appointment is partially an update to the appointment status (changing it from scheduled to in progress), but it also kicks off a number of other processes, such as email notifications.
For example, my start endpoint is accessed at the following URL:
PATCH /appointments/{id}/start
In addition to the id
, I also pass lat
and lon
(the latitude/longitude of the check-in). lat
and lon
aren’t actually fields in my appointment
table, rather I have a checkinCoordinates
field that is computed based on those params and inserted as a PostGIS-compliant format.
In the spirit of keeping all of my requests/responses JSON API-compliant, I am wondering the proper way to represent something like this given that the fields aren’t part of the actual model?
My initial thought was something like this:
{
"data": {
"type": "appointment",
"id": "1",
"attributes": {
"lat": 39.232,
"lon": -132.232
}
}
}
All that said, in general, I believe I’m a little confused on how to represent non-CRUD actions like this in JSON API. Any advice or suggestions would be greatly appreciated!
Thanks,
James