Client Contacts API
General notes
Content
Client Contacts collection:
Single role:
Clients collection
Client Contacts index
This method needs permission
accessonclient-contacts.
Request
| Index behaviour | Definition |
|---|---|
| Paginated by default | No |
| Sorting | id, email, client_id, is_active, is_primary |
| Filters | id:int, email:string, client_id:int, is_active:bool, is_primary:bool |
| Embedded | - |
GET /api/v0/client-contacts HTTP/1.1
Content-Type: application/json
Response
200 OK
{
"items": [
{
"id": 1,
"client_id": 2,
"email": "a@simplo.cz",
"is_active": true,
"is_primary": false,
"_links": [
{
"href": "/api/v0/client-contacts/1",
"rel": "self",
"type": "GET"
}
]
}
]
}
Create Client Contacts
This method needs permission
createonclient-contacts.
Request
| Param | Type | Description | Requirements |
|---|---|---|---|
email | string | Contact email | Required. |
client_id | int | Client Identifier | Required. |
is_active | bool | Is contact active flag. | Required. |
is_primary | bool | Is contact primary flag. | Required. |
POST /api/v0/client-contacts HTTP/1.1
Content-Type: application/json
{
"client_id": 2,
"email": "a@simplo.cz",
"is_active":true,
"is_primary":false
}
Response
201 CREATED
{
"id": 1,
"client_id": 2,
"email": "a@simplo.cz",
"is_active": true,
"is_primary": false,
"_links": [
{
"href": "/api/v0/client-contacts/1",
"rel": "self",
"type": "GET"
}
]
}
422 UNPROCESSABLE ENTITY
Validation error occurred.
403 FORBIDDEN
Unauthorized.
Single Client Contact
Client Contact detail
GET /api/v0/client-contacts/{contact_id}
This method needs permission
readonclient-contacts.
Request
GET /api/v0/client-contacts/1 HTTP/1.1
Content-Type: application/json
Response
200 OK
{
"id": 1,
"client_id": 2,
"email": "a@simplo.cz",
"is_active": true,
"is_primary": false,
"_links": [
{
"href": "/api/v0/client-contacts/1",
"rel": "self",
"type": "GET"
}
]
}
404 NOT FOUND
Not found.
Update Client Contact
PUT/PATCH /api/v0/client-contacts/{contact_id}
This method needs permission
updateonclient-contacts.
Request
| Param | Type | Description | Requirements |
|---|---|---|---|
email | string | Contact email | |
client_id | int | Client Identifier | |
is_active | bool | Is contact active flag. | |
is_primary | bool | Is contact primary flag. |
For PATCH method any field can be omitted.
PATCH /api/v0/client-contacts/5 HTTP/1.1
Content-Type: application/json
{
"email": "b@simplo.cz",
}
Response
200 OK
Successfully updated.
404 NOT FOUND
Not found.
{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}
422 UNPROCESSABLE ENTITY
Validation error occurred.
{
"type" : "ValidationError",
"message" : "The given data was invalid.",
"id" : "fe1b04de-b347-43b5-8118-864c1eefaccf",
"errors": [
{
"field": "name",
"message": "Value must be of type string."
}
]
}
Delete Client Contact
DELETE /api/v0/client-contacts/{contact_id}
This method needs permission
deleteonclient-contacts.
Request
DELETE /api/v0/client-contacts/5 HTTP/1.1
Content-Type: application/json
Response
204 NO CONTENT
Successfully deleted.
404 NOT FOUND
Not found.