Structured Messages
In this document
Structured Messages
Overview
Structured messages are returned in the messages array in a Cortex response and are used to communicate the following types of conditions:
Condition | Request Methods | HTTP Response Status Code |
---|---|---|
Input validation errors | POST, PUT | 400 Bad Request |
Business state errors | POST, PUT, DELETE | 409 Conflict |
Blocking conditions |
GET |
200 OK |
Informational messages | GET | 200 OK |
See Types of Structured Messages for further information and examples.
The messages currently returned by Cortex are listed on the following pages:
Message Fields
A structured message has the following fields:
Field / Object | Description | Example |
---|---|---|
type | The type of the message. See Types of Structured Messages. |
|
id | A unique identifier for the message condition. |
|
debug-message | A text description of the error as a debugging convenience. |
|
data |
A set of name/value pairs to convey message-specific data. |
|
blocks | (optional) The action that is blocked by the message condition. |
|
linked-to | (optional) A resource for users to act upon to resolve the condition. |
|
Example
Here is an example the messages returned when attempting to register a new account with an invalid password and email address.
- 400 Bad Request
- {
- "links": [],
- "messages": [
- {
- "type": "error",
- "id": "field.invalid.size",
- "debug-message": "Password must be between 8 to 255 characters inclusive",
- "data": {
- "field-name": "password",
- "min": "8",
- "max": "255"
- }
- },
...
Read more