I am drafting a JSON schema for an API. One of the responses aims to show all the updates to different properties of an given entity. The number of updates may vary from one response to another. For example, it can be that the values of property_a
and property_d
change in one response, and those of property_a
, property_b
, and property_c
in the next.
I want to design a schema that is both friendly to human interpretation and programmatic execution.
A concrete example of such an entity can be appointment bookings. Each appointment may consist of a place, a date, a time and a list of attendees, and all of them may change after an appointment is created. Now we want to have an API endpoint that would return any update to an existing appointment. The response contains the updated properties only.
So far I come up something like below:
{
"event": "update",
"appointment_id": 123,
"updated_properties": ["place", "time"],
"place": "some new location",
"time": "some new time"
}
In essence, this schema tells which properties are updated and simply returns these properties only with their new values.
Is this a sensible design? Any alternative schema for improvements?