Validation format

All POST and PATCH endpoints return responses in this format below.
If the operation is unsuccessful, it will return a 422 HTTP status.
If the operation is successful, 200 is returned for PATCH operations and 201 for POST operations.

{
  "success": false,
  "validation_errors": [
    {
      "attribute": "patient_information.last_name",
      "message": "can't be blank",
      "full_message": "Last name can't be blank"
    },
    {
      "attribute": "patient_information.email",
      "message": "must be a valid email",
      "full_message": "Email must be a valid email"
    }
  ],
  "object": {
    "id": "dd6a2c2b-78a4-4ec2-8d55-0ed08371cb45",
    "created_at": "2022-02-21T00:00:00.000Z",
     // etc...
  }
}
keydescription
successnon-null boolean indicating if the operation succeeded or not
validation_errorsList of validation errors. Empty if the operation succeeded
validation_errors[].attributeWhich attribute is failing validation
validation_errors[].messageShort validation error message
validation_errors[].full_messageSame validation error message but prepended with the humanize attribute name
objectThe object targeted by the operation. null If the operation is trying and failing to create an object

Some GET endpoints can also return validation errors. For example, the "List imaging providers" endpoint requires some valid query parameters. If the parameters are invalid, the HTTP status will be 422 and the response will be in this format:

{
  "success": false,
  "validation_errors": [
    "Please enter a valid location in the UK",
    "Please enter a valid modality",
    "Please select at least one body part"
  ],
  "data": []
}