# Responses
# Status codes
| Status | When |
|---|---|
| 200 OK (opens new window) | Item was handled successfully |
| 201 Created (opens new window) | Item was created |
| 403 Unauthorized (opens new window) | Not authorized |
| 404 Not Found (opens new window) | Item was not found |
| 422 Unprocessable Entity (opens new window) | Item was unprocessable |
| 5xx Internal Server Error | Server error (e.g. 500 (opens new window), 502 (opens new window) or 503 (opens new window)) |
# Methods
| Method | CRUD | Example | When | Request Body | Expected Response | Exceptions |
|---|---|---|---|---|---|---|
POST | Create | /customers | Create an item | FormData (or JSON) | 201 | 403, 404, 422 |
POST | Read | /customers/search | Fetching a collection | JSON | 200 | 403, 404 |
GET | Read | /customers/metadata | Fetching the meta data for a collection | - | 200 | 403, 404 |
GET | Read | /customers/new | Fetching the meta data and default values for an item | - | 200 | 403, 404 |
GET | Read | /customers/:customerId | Fetching an item | - | 200 | 403, 404 |
PUT | Update/Replace | /customers/:customerId | Updating an item | FormData (or JSON) | 200 | 403, 404, 422 |
DELETE | Delete | /customers/:customerId | Deleting an item | - | 200 | 403, 404 |
# Data structures
# Messages
For the Notifications we have created a data structure convention.
It is compliant with the ElementUI notification (opens new window).
Data structure (Example)
Each call in the backoffice can return a messages-array.
{
"messages": [
{
"type": "success", // success/warning/info/error
"title": "notifications.importSuccess.title",
"message": "notifications.importSuccess.message",
"duration": 0 // Forever visible
}
]
}
You do not have to handle these messages yourself. The axiosPlugin will handle the messages for you.
# Options
For the Select boxes we have created a data structure convention.
Data structure (Example)
For example /api/customers/options POST
{
"total": 14,
"totalWithFilter": 4,
"data": [
{
"value": "605dff5df6337113277e4c98",
"label": "Euro (EUR)"
},
{
"value": "605dff5df6337113277e4c99",
"label": "Dollar (USD)"
},
{
"value": "605dff5df6337113277e4c9a",
"label": "British Pound (GBP)"
},
{
"value": "605dff5df6337113277e4c9b",
"label": "Japanese Yen (JPY)"
}
]
}
TIP
The options-call can be sorted and filtered. Check the Select-component for more information.