updated_at datetime value in the payload

Hi guys,

I fancy myself as an amateur API designer & I really like to see the current time (or maybe the time the data is relevant to) sent in the payload. I wrote my reasons upon: http://dabase.com/blog/APIs_must_send_time/

I did have a quick look at http://jsonapi.org/format/ and ctrl+f {date,time} and I left a little unsatisfied. Has this come up for discussion? Is there a reason why this is not recommended practice? I guess you can probably get datetime from the new fetch API, though I just prefer it in the payload.

Many thanks!

I think this concern is an application level issue that should be up to the specific implementation and not the spec.
If I read your blog post correctly, both the “What is server time” and “When was the payload last updated” are things maybe not every api needs and should be up to the implementer.
For example, all my resources contain an attribute “updated_at” that lets me see how current the resource is.

Let me know if you think I understood the question.

Cheers

I was trying to argue every API should have some temporal value. However the choice between server time and when the payload was last updated is a tricky one. Maybe both? :joy:

Hi @hendry,

While I’m not sure that every API needs those fields, there’s nothing to stop a JSON API API from adding them, as @hglattergotz said. They could go either in the resource objects or in JSON API’s "meta" key.

We’re also working on an extension system that’ll soon allow users to add fields to a document in a standard way (i.e. that other clients and APIs can reuse).