Skip to content

1.1 Response Format

Aaron edited this page Nov 20, 2015 · 1 revision

The standard response payload for most APIs is described below.

JSON payload

{
  "data": [ // Example resource
    {
      "$id": "2",
      "patientId": 1,
      "userId": 1,
      "profileImagePath": "sample string 2",
      "fullName": "sample string 3",
      "phone": "sample string 4",
      "isAuthorized": true,
      "isActive": true
    },
    {
      "$ref": "2"
    }
  ],
  "total": 1
}

The content of the data field is always a collection, even if there is only one response returned. This makes it easier for API consumers to parse the response without have multiple code paths. The API consumer can determine the count of the response by examining the length of this array. The "total" value facilitates oData-type usage, and is good for pagination.

Clone this wiki locally