Clients API
General notes
Embeddable fields
| Name | Type | Description |
|---|---|---|
hourly_pays | HourlyPay[] | Array of hourly pays HourlyPay. |
newest_project | Project[] | Array of users assigned to project Project. |
projects_count | int | Client's projects count. |
profit | array | Profit, in money and percentage. |
responsible_user | User | Client's responsible User. |
Content
Roles collection:
Single role:
Client's notes:
Clients collection
Clients index
This method needs permission
accessonclients.
Request
| Index behaviour | Definition |
|---|---|
| Paginated by default | No |
| Sorting | id, name, goodday_id, address, city, postal_code, country_id, phone, fax, email, website, active, note, created_at, updated_at |
| Filters | id:enum, name:string, goodday_id:string, address:string, city: string, postal_code: string, country_id: string, phone: string, fax: string, email: string, website: string, active: bool, created_at: date, updated_at: date |
| Embedded | - |
GET /api/v0/clients HTTP/1.1
Content-Type: application/json
Response
200 OK
GET /api/v0/clients HTTP/1.1
Content-Type: application/json
{
"items": [
{
"id": 1,
"name": "Demo projects",
"goodday_id": "3MFGRZ",
"address": null,
"city": null,
"postal_code": null,
"country_id": null,
"phone": null,
"fax": null,
"email": null,
"website": null,
"active": true,
"note": null,
"created_at": "2022-11-23T15:59:55+0100",
"updated_at": "2022-11-23T15:59:55+0100",
"_links": [
{
"href": "/api/v0/clients/1",
"rel": "self",
"type": "GET"
}
]
}
]
}
Single client
Client detail
GET /api/v0/clients/{client_id}
This method needs permission
readonclients.
Get Client detail.
Request
| Index behaviour | Definition |
|---|---|
| Embedded | - |
Request
GET /api/v0/clients/1 HTTP/1.1
Content-Type: application/json
Response
200 OK
GET /api/v0/clients/1 HTTP/1.1
Content-Type: application/json
{
"id": 1,
"name": "Demo projects",
"goodday_id": "3MFGRZ",
"address": null,
"city": null,
"postal_code": null,
"country_id": null,
"phone": null,
"fax": null,
"email": null,
"website": null,
"active": true,
"note": null,
"created_at": "2022-11-23T15:59:55+0100",
"updated_at": "2022-11-23T15:59:55+0100",
"_links": [
{
"href": "/api/v0/clients/1",
"rel": "self",
"type": "GET"
}
]
}
404 NOT FOUND
Role was not found.
GET /api/v0/clients/2 HTTP/1.1
Content-Type: application/json
Status-Code: 404
{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}
Update Client
PUT/PATCH /api/v0/clients/{client_id}
This method needs permission
updateonclients.
Method for updating Client data.
Request
| Param | Type | Description | Requirements |
|---|---|---|---|
name | string | Client name | Sometimes. Has to be string. Max length is 150 chars. |
address | string | Client address | Sometimes. Has to be string. Max length is 255 chars. |
city | string | Client city | Sometimes. Has to be string. Max length is 255 chars. |
postal_code | string | Client postal code | Sometimes. Has to be string. Max length is 255 chars. |
country_id | string | Client country_id | Sometimes. Has to be string. Max length is 20 chars. |
phone | string | Client phone | Sometimes. Has to be string. Max length is 255 chars. |
fax | string | Client fax | Sometimes. Has to be string. Max length is 100 chars. |
email | string | Client email | Sometimes. Has to be string. Max length is 100 chars. |
website | string | Client website | Sometimes. Has to be string. Max length is 100 chars. |
active | bool | Activity flag | Sometimes. Has to be boolean. Max length is 255 chars. |
note | string | Client note | Sometimes. Has to be string. Max length is 255 chars. |
For PATCH method any field can be omitted.
PATCH /api/v0/clients/1 HTTP/1.1
Content-Type: application/json
{
"name": "Demo clientx",
}
Response
200 OK
Client successfully updated.
PATCH /api/clients/3 HTTP/1.1
Content-Type: application/json
{
"id": 1,
"name": "Demo clientx",
"goodday_id": "3MFGRZ",
"address": null,
"city": null,
"postal_code": null,
"country_id": null,
"phone": null,
"fax": null,
"email": null,
"website": null,
"active": true,
"note": null,
"created_at": "2022-11-23T15:59:55+0100",
"updated_at": "2022-11-24T16:19:09+0100",
"_links": [
{
"href": "/api/v0/clients/1",
"rel": "self",
"type": "GET"
}
]
}
404 NOT FOUND
Client was not found.
PATCH /api/clients/2 HTTP/1.1
Content-Type: application/json
Status-Code: 404
{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}
422 UNPROCESSABLE ENTITY
Validation error occurred.
PUT /api/clients HTTP/1.1
Content-Type: application/json
{
"type" : "ValidationError",
"message" : "The given data was invalid.",
"id" : "fe1b04de-b347-43b5-8118-864c1eefaccf",
"errors": [
{
"field": "name",
"message": "The name field is required."
}
]
}
Client notes index
GET /api/v0/clients/{client_id}/notes
This method needs permission
accessonnotes.
Get list of existing client Notes.
Request
| Index behaviour | Definition |
|---|---|
| Paginated by default | Yes |
| Sorting | id, noteable_type, noteable_id, text, user_id, created_at, updated_at |
| Filters | id:enum, noteable_type:string, noteable_id:int, text:string, user_id:int, created_at:date,updated_at:date |
GET /api/v0/clients/1/notes HTTP/1.1
Responses
200 OK
GET /api/v0/clients/1/notes HTTP/1.1
Content-Type: application/json
{
"items": [
{
"id": 1,
"noteable_type": "App\\Containers\\Clients\\Clients\\Models\\Client",
"noteable_id": 2,
"text": "Note update text",
"user_id": 1,
"created_at": "2023-01-05T15:35:48+0100",
"updated_at": "2023-01-06T11:11:51+0100",
"_links": [
{
"href": "/api/v0/notes/1",
"rel": "self",
"type": "GET"
}
]
},
{
"id": 2,
"noteable_type": "App\\Containers\\Clients\\Clients\\Models\\Clients",
"noteable_id": 2,
"text": "test poznamky",
"user_id": 1,
"created_at": "2023-01-05T15:37:12+0100",
"updated_at": "2023-01-05T15:37:12+0100",
"_links": [
{
"href": "/api/v0/notes/2",
"rel": "self",
"type": "GET"
}
]
}
],
"_meta": {
"page": 1,
"total_pages": 1,
"records": 2,
"per_page": 100
}
}
Create client note
POST /api/v0/clients/{client_id}/notes
This method needs permission
createonnotes.
Create client Note.
Request
| Param | Type | Description | Requirements |
|---|---|---|---|
text | string | User's first name | Required. |
user_id | int | Author's User id | Required. |
POST /api/v0/clients/1/notes HTTP/1.1
{
"text": "test poznamky"
"user_id": 2,
}
Responses
200 OK
POST /api/v0/clients/1/notes HTTP/1.1
Content-Type: application/json
{
"id": 9,
"noteable_type": "App\\Containers\\Clients\\Clients\\Models\\Client",
"noteable_id": 1,
"text": "User note test",
"user_id": 2,
"created_at": "2023-01-06T12:01:55+0100",
"updated_at": "2023-01-06T12:01:55+0100",
"_links": [
{
"href": "/api/v0/notes/9",
"rel": "self",
"type": "GET"
}
]
}