When a request is successful, a response body will typically be sent back in the form of a JSON object. An exception to this is when a DELETE request is processed, which will result in a successful HTTP 204 status and an empty response body.
Inside of this JSON object, the resource root that was the target of the request will be set as the key. This will be the singular form of the word if the request operated on a single object, and the plural form of the word if a collection was processed.
For example, if you send a GET request to /api/projects/$PROJECT_ID
you will get back an object with a key called “project
“. However, if you send the GET request to the general collection at /api/projects
, you will get back an object with a key called “projects
“.
The value of these keys will generally be a JSON object for a request on a single object and an array of objects for a request on a collection of objects.
RESPONSE FOR A SINGLE OBJECT
{
"project": {
"title": "Project ABCDE"
. . .
}
}
RESPONSE FOR AN OBJECT COLLECTION
{
"projects": [
{
"title": "Project ABCDE"
. . .
},
{
"title": "Project FGHIJ"
. . .
}
]
}