Short answer
The GET /api/v1/tests/reports/pdf endpoint returns a testing report PDF by uniqueId. The uniqueId query parameter is required, and lang can be sent to select the PDF report language. Before returning the PDF, the server checks that the report belongs to the current company.
Which endpoint is used?
Use GET /api/v1/tests/reports/pdf. The endpoint returns a binary PDF file by the unique testing report identifier.
| Parameter | Value |
|---|---|
| Method | GET |
| Endpoint | /api/v1/tests/reports/pdf |
| Base URL | [https://smartway.pro](https://smartway.pro) |
| Auth | Bearer token |
What is this API endpoint used for?
This endpoint is used to download or open a testing report PDF. It is used after retrieving uniqueId from the testing report list.
What prerequisites are required before sending the request?
-
A Bearer token with company context is required.
-
The token must include the
tests.readscope. -
A
uniqueIdof a testing report belonging to the current company is required.
| Prerequisite | Description | Required |
|---|---|---|
access_token |
Bearer token with company context | Yes |
tests.read |
Scope for reading testing reports | Yes |
uniqueId |
Unique testing report identifier | Yes |
Which parameters must be sent in the request?
Headers
| Header | Type | Required | Description |
|---|---|---|---|
Authorization |
string | Yes | Bearer token in the Bearer <access_token> format |
Accept |
string | Yes | application/pdf |
Path parameters
Path parameters are absent.
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
uniqueId |
string | Yes | Unique testing report identifier |
lang |
string | No | PDF report language; default en, available languages: uk, ru, en |
Request body
Request body is not used.
curl example
curl -X GET 'https://smartway.pro/api/v1/tests/reports/pdf?uniqueId=abc12345&lang=en' \
-H 'Authorization: Bearer <access_token>' \
-H 'Accept: application/pdf' \
--output test-report-abc12345.pdf
What response does the API return?
A successful request returns 200 OK and a binary PDF file. The successful response has Content-Type: application/pdf and Content-Disposition: inline; filename=test-report-<uniqueId>.pdf.
JSON response body is not used because the response is a binary PDF file.
What do the API response fields mean?
Insufficient data to describe response fields.
What happens under the hood?
-
Before returning the PDF, the server checks that the report belongs to the current company.
-
Access requires the
tests.readscope.
Which edge cases should be considered?
| Scenario | API behaviour | Integrator action |
|---|---|---|
uniqueId not found |
API returns 404 Not Found |
Check uniqueId from the testing report list |
| Report does not belong to the current company | API returns 404 Not Found |
Use only uniqueId values available in the current company tenant context |
lang not sent |
API uses en |
Send lang when another PDF language is required |
Which errors can the API return?
| HTTP status | Description |
|---|---|
401 Unauthorized |
Missing or invalid Bearer token |
403 Forbidden |
Insufficient permissions |
404 Not Found |
Report not found or does not belong to the current company |
500 Internal Server Error |
Unexpected error |
503 Service Unavailable |
Service failure |
How to use the result in subsequent API requests?
The uniqueId value comes from the POST /api/v1/tests/reports/search response. Save the PDF request result to a file or open it as a PDF document.
Example of retrieving uniqueId from the report list:
curl -X POST 'https://smartway.pro/api/v1/tests/reports/search?lang=en' \
-H 'Authorization: Bearer <access_token>' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"page": 0,
"size": 20,
"view": "all"
}'
Which mistakes should integrators avoid?
-
Sending a
uniqueIdthat does not belong to the current company. -
Omitting
Accept: application/pdf. -
Expecting a JSON response instead of a binary PDF file.
-
Calling the endpoint without the
tests.readscope.
FAQ
Which parameter is required?
The uniqueId query parameter is required.
Which PDF language can be requested?
lang supports uk, ru and en; if it is not sent, en is used.
What does the API return?
The API returns a binary PDF file with Content-Type: application/pdf.
What happens if the report does not belong to the company?
The API returns 404 Not Found.
Which scope is required?
The tests.read scope is required.