Skip to main content

Users Invoices API

General notes

Api for managing user invoices.

Content

Users collection:

Single user:

User Invoices collection

Embeddable fields

NameTypeDescription
statisticsarray[]Array with amount of vacating days spent and with reported time this month.
fileFileFile model with download url.

User Invoices index

GET /api/v0/user-invoices

This method needs permission read on user-invoices.

Get list of existing User Invoices

Request

Index behaviourDefinition
Paginated by defaultNo
Sortingid, user_id, month, year, invoice_received, file_id, invoice_not_received_notified, user_comment, note, created_at, updated_at
Filtersid:enum, user_id:int, month:int, year:int, invoice_received:bool, file_id:int,invoice_not_received_notified:bool, user_comment:string, note:string, created_at:date, updated_at:date
GET /api/v0/user-invoices HTTP/1.1

Responses

200 OK

GET /api/v0/user-invoices HTTP/1.1
Content-Type: application/json
Status-Code: 200

{
"items": [
{
"id": 3,
"user_id": 1,
"month": 6,
"year": 2023,
"invoice_received": false,
"file_id": 1,
"invoice_not_received_notified": true,
"user_comment": "Hello",
"note": null,
"created_at": "2023-07-25T13:37:56+0200",
"updated_at": "2023-07-25T14:17:32+0200",
"_links": [
{
"href": "/api/v0/user-invoices/3",
"rel": "self",
"type": "GET"
}
]
},
],
}


Single User Invoice

User Invoice detail

GET /api/v0/user-invoices/{user_invoice_id}

This method needs permission read on user-invoices.

Get User Invoice detail.

Request

GET /api/v0/user-invoices/3 HTTP/1.1

Responses

200 OK

GET /api/v0/user-invoices/3 HTTP/1.1
Content-Type: application/json
Status-Code: 200

{
"id": 3,
"user_id": 1,
"month": 6,
"year": 2023,
"invoice_received": false,
"file_id": 1,
"invoice_not_received_notified": true,
"user_comment": "Hello",
"note": null,
"created_at": "2023-07-25T13:37:56+0200",
"updated_at": "2023-07-25T14:17:32+0200",
"_links": [
{
"href": "/api/v0/user-invoices/3",
"rel": "self",
"type": "GET"
}
]
}

404 NOT FOUND

GET /api/v0/user-invoices/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 User Invoice

PUT/PATCH /api/v0/user-invoices/{user_invoices_id}

This method needs permission update on user-invoices.

Method for updating User Invoice data.

Request

ParamTypeDescriptionRequirements
user_commentstringUser's commentNullable. Must be string.
notestringInternal noteNullable. Must be string.

For PATCH method any field can be omitted.

PATCH /api/v0/user-invoices/3 HTTP/1.1
Content-Type: application/json

{
"note": "Paid."
}

Responses

200 OK

User Invoice successfully updated.

PATCH /api/v0/user-invoices/3 HTTP/1.1
Content-Type: application/json
Status-Code: 200

{
"id": 3,
"user_id": 1,
"month": 6,
"year": 2023,
"invoice_received": false,
"file_id": 1,
"invoice_not_received_notified": true,
"user_comment": "Hello",
"note": "Paid.",
"created_at": "2023-07-25T13:37:56+0200",
"updated_at": "2023-07-25T14:17:32+0200",
"_links": [
{
"href": "/api/v0/user-invoices/3",
"rel": "self",
"type": "GET"
}
]
}

404 NOT FOUND

User Invoice was not found.

PUT /api/v0/user-invoices/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/v0/users/3 HTTP/1.1
Content-Type: application/json
Status-Code: 422

{
"type": "ValidationError",
"message": "The given data was invalid.",
"id": "5c99f70a-e400-44bb-9cd4-592b0a30e145",
"errors": [
{
"field": "note",
"message": "Pole musí být řetězec znaků."
}
]
}