I am developing a REST API and although you are spending a lot of best practice guides, I cannot find much regarding the best practice of handling the mismatch in the presentation structure needed for POST vs the same presentation structure returned from GET .
GET for a dummy user view might look like this:
{ "id": 1234, "created": "2012-04-23T18:25:43.511Z", "username": " johndoe@example.com ", "name": "John Doe" }
However, the POST for the same dummy user view cannot specify specific properties (namely id and created ):
{ "username": " johndoe@example.com ", "name": "John Doe" }
Obviously, this is an oversimplified example, but provided that the user cannot specify certain fields (and it may not always be clear which of them relate to the method used), is it best practice to create separate views for each or to expect the most complete version and transparently handle the imbalance of data on the server?
Despite the apparent ease of having a single view and handling of the server side of the mismatch, I fear that it will be a bad experience for the user if it is not clear which values ββcan be specified (or changed using PUT for example). If the trend is to create separate views, is there a naming convention to define the view?
eg. i_user for the incoming user and o_user for the outgoing user. Or user_full and user_min or user and .user etc.
Update: My overly simplified example may have incorrectly illustrated the problem. Imagine a view that has 50 properties (for example, a server view with all its monitoring attributes - cpu, ram, temp, storage_drive_a, storage_drive_b, file_permission, etc.). Of these 50 properties, 30 are read-only properties, and 20 of them are values ββthat can be set.