Skip to main content

Reports API

General notes

Embeddable fields

NameTypeDescription
report_settingReportSettingReport setting for report ReportSetting.
projectProjectProject of report Project.
edit_allowedboolIndicates if tasks to_invoice_price and to_invoice_time can be edited.

Content

Reports collection:

Single report:

Report to PDF

Approve report

More:

Reports collection

Reports index

This method needs permission access on reports

Request

Index behaviourDefinition
Paginated by defaultYes
Sortingid, name, report_setting_id, to_invoice_price, is_active, state, approved_at, sent_at, invoiced_at, from_at, to_at, created_at, updated_at, hash
Filtersid:enum, name:string, report_setting_id:int, to_invoice_price:int, is_active:int, state:bool, approved_at:date, sent_at:date, invoiced_at:date, from_at:int, to_at:date, created_at:date, updated_at:date, hash:string
Embedded-
GET /api/v0/reports HTTP/1.1
Content-Type: application/json

Responses

200 OK

GET /api/v0/reports HTTP/1.1
Content-Type: application/json

{
"items": [
{
"id": 11,
"name": "01 Initiation",
"report_setting_id": 11,
"to_invoice_price": 9500,
"is_active": true,
"state": 1,
"approved_at": null,
"sent_at": null,
"invoiced_at": null,
"from_at": "2023-01-01T00:00:00+0100",
"to_at": "2023-01-31T23:59:59+0100",
"created_at": "2023-01-11T15:46:49+0100",
"updated_at": "2023-01-11T17:26:10+0100",
"hash": "heXH149oREPbrv0KJeqrQF9eABosyDYP3LIPuigJP90uezEGHVvJFpLoKQkdIfJS",
"_links": [
{
"href": "/api/v0/reports/11",
"rel": "self",
"type": "GET"
}
]
}
],
"_meta": {
"page": 1,
"total_pages": 5,
"records": 5,
"per_page": 1
}
}

Single report

Report detail

GET /api/v0/reports/{report_id}

This method needs permission read on reports.

Get Report detail.

Request

Index behaviourDefinition
Embedded-

Request

GET /api/v0/reports/11 HTTP/1.1
Content-Type: application/json

Response

200 OK

GET /api/v0/reports/11 HTTP/1.1
Content-Type: application/json

{
"id": 11,
"name": "01 Initiation",
"report_setting_id": 11,
"to_invoice_price": 9500,
"is_active": true,
"state": 1,
"approved_at": null,
"sent_at": null,
"invoiced_at": null,
"from_at": "2023-01-01T00:00:00+0100",
"to_at": "2023-01-31T23:59:59+0100",
"created_at": "2023-01-11T15:46:49+0100",
"updated_at": "2023-01-11T17:26:10+0100",
"hash": "heXH149oREPbrv0KJeqrQF9eABosyDYP3LIPuigJP90uezEGHVvJFpLoKQkdIfJS",
"_links": [
{
"href": "/api/v0/reports/11",
"rel": "self",
"type": "GET"
}
]
}

404 NOT FOUND

Report was not found.

GET /api/v0/reports/50 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 report

PUT/PATCH /api/v0/reports/{report_id}

This method needs permission update on reports.

Method for updating Report data.

Request

ParamTypeDescriptionRequirements
stateintReport stateRequired. Must be enumerator of report_state
invoice_numberintReport invoice numberRequired.

For PATCH method any field can be omitted.

PUT /api/v0/reports/1 HTTP/1.1
Content-Type: application/json

{
"state": 2,
"invoice_number": 20230001
}

Response

200 OK

Report successfully updated.

PUT /api/reports/1 HTTP/1.1
Content-Type: application/json

{
"id": 11,
"name": "01 Initiation",
"report_setting_id": 11,
"to_invoice_price": 9500,
"is_active": true,
"state": 2,
"approved_at": null,
"sent_at": "2023-01-13T14:18:22+0100",
"invoiced_at": null,
"from_at": "2023-01-01T00:00:00+0100",
"to_at": "2023-01-31T23:59:59+0100",
"created_at": "2023-01-11T15:46:49+0100",
"updated_at": "2023-01-13T14:18:22+0100",
"hash": "heXH149oREPbrv0KJeqrQF9eABosyDYP3LIPuigJP90uezEGHVvJFpLoKQkdIfJS",
"_links": [
{
"href": "/api/v0/reports/11",
"rel": "self",
"type": "GET"
}
]
}

404 NOT FOUND

Report was not found.

PUT /api/v0/reports/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/reports/2 HTTP/1.1
Content-Type: application/json

{
"type" : "ValidationError",
"message" : "The given data was invalid.",
"id" : "fe1b04de-b347-43b5-8118-864c1eefaccf",
"errors": [
{
"field": "state",
"message": "The state field is required."
}
]
}

Delete report

DELETE /api/v0/reports/{report_id}

This method needs permission delete on reports.

Method for deleting Report.

Request

DELETE /api/v0/reports/1 HTTP/1.1
Content-Type: application/json

Response

204 NO CONTENT

Report successfully deleted.

404 NOT FOUND

Report was not found.

DELETE /api/v0/reports/1 HTTP/1.1
Content-Type: application/json
Status-Code: 404

{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}


Download report as PDF

GET /api/v0/reports/{report_id}/download-pdf

This method needs report hash

Request

GET /api/v0/reports/6/download-pdf?hash=GyhrUFdG84Buc9EVVHqvkJevxATxs6KLVwipvXS07jdSqa5vaPiSJZip2o4U21QP
Content-Type: application/json

Response

403 FORBIDDEN

Incorrect hash given.

404 NOT FOUND

Report was not found.

200 OK

Report as PDF will be downloaded and shown.


Approve Report

POST /api/v0/reports/{report_id}/approved

This method requires hash and logged-in User or known ClientUserAgent.

Request

GET /api/v0/reports/6/approved
Content-Type: application/json

{
"hash": "xACuGpAo8GZF4kHHuKBj6MsqoHcsTX5Et73ZTvVgF77khjbn"
}

Response

403 FORBIDDEN

Incorrect hash given.

401 UNAUTHORIZED

User is not logged-in and client's user-agent is unknown.

404 NOT FOUND

Report was not found.

200 OK

Report is approved by User or Client. Report copy as PDF is saved to the server and email is sent to responsible person.


View Public Report

This method needs report hash

Embeddable fields

NameTypeDescription
report_settingReportSettingReport setting for report ReportSetting.
responsible_userResponsibleUser
report_tasksReportTaskCollection of ReportTasks.

Request

GET /api/v0/reports/6/public?hash=GyhrUFdG84Buc9EVVHqvkJevxATxs6KLVwipvXS07jdSqa5vaPiSJZip2o4U21QP
Content-Type: application/json

403 FORBIDDEN

Incorrect hash given.

404 NOT FOUND

Report was not found.

200 OK

Report will be shown.


Issue external (idoklad) invoice

GET /api/v0/reports/{report_id}/issue-invoice

This method requires permissions update on Report.

Request

GET /api/v0/reports/6/issue-invoice
Content-Type: application/json

204 NO CONTENT

Report will be converted to new IDoklad invoice.