I've been searching the web for this and haven't found an answer to a quite simple question: should JSON formats be the same for all HTTP verbs for a specific resource?
For example:
GET http://example.com/api/articles returns
[ { id: 1, ref: "21313-453542" }, { id: 2, ref: "23424-234243" }, ... ] GET http://example.com/api/articles/2 returns
{ id: 2, ref: "23424-234243", name: "Cofee", price: 23, provider: "112-411", } Is this a good practice or JSON objects should always keep a consistent format? To make myself clear, if the formats should be consistent the first request should return something like this:
[ { id: 1, ref: "21313-453542", name: "Oranges", price: 34, provider: "2424-12", } { id: 2, ref: "23424-234243", name: "Cofee", price: 23, provider: "112-411", } ]