Why is a date field posted in one format and returned in a different?

skybow's picture

I started working on a C++/Qt library for accessing a Drupal site via Services and a REST server (I'm more into C++ than PHP and Drupal module hacking), when I ran into the following problem: When I retrieve a node via node.retreive request, modify some fields of the returned JSON object and repost the changes via node.update request, Date field content will be killed.

The problem is somewhat described in Cannot create or update Date field using Services API and in Setting Date(Unix timestamp) with JSON, but from my point of view, the problem arises because on input a different JSON representation is needed for Date fields than what is returned by node retrieval.
I haven't checked (so far – I just started coding) if other field types are affected as well.

I followed the instructions how to determine the input format and got the following for input:

This is the structure that is returned on retreival:

However from an API user point of view, I find this behavior really annoying: instead of simply modifying the JSON object returned, I would need to write some fix to this issue. Sure, this can be done, but I would consider this at least a design weakness that should be fixed – unless someone is willing to tell me the concepts behind.

Is the intended behavior? Can it be solved? Can it be solved without breaking everything?

AttachmentSize
DateOnInput.png73.43 KB
DateAsRetreived.png93.71 KB