Directory API
Introduction to the API
Hosts
The REST API lets you interact directly with Clinia from anything that can send an HTTP request. All API accesses must use HTTPS. The primary host is https://api.clinia.ca
.
Format
The entire API uses JSON encoded as UTF-8.
The body of POST, PATCH and PUT requests must be a JSON object and their Content-Type
header should be set to application/son
.
The body of responses is always a JSON object, and their content type is always application/json
.
Authentication
All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.
For javascript usage, Cross-origin Resource Sharing (CORS) is supported by the API so that you can use XMLHttpRequest
.
Error Handling
All endpoints can return errors. Some error responses will come with a response body with more detail on the error.
Status Code | Description |
---|---|
400 - Bad Request | The request was malformed or not contained unexpected content. |
401 - Unauthorized | Authentication failed. |
404 - Not Found | Resource not found. |
422 - Unprocessable Entity | Request was understood by the server but could not be processed, probably due to validation errors or invalid values. |
Error response
Field | Type | Description |
---|---|---|
status | Integer | Status code. |
message | Symbol | Generic error message. |
errors | Array<ErrorMessage> | List of errors. |
Error Message
Field | Type | Description |
---|---|---|
code | Integer | Specific error code. |
type | Symbol | Type of error. |
message | Symbol | Error message. |
field | Symbol | Field that caused the error in the incoming request body. |