PDF Report Generations
The PDF Report Generations API allows you to retrieve generated reports for a schedule
The PDF Report Generation Resource
Properties
- Name
id
- Required
- Type
- integer
- Description
Unique identifier for the generation record
- Name
schedule_id
- Required
- Type
- integer
- Description
ID of the schedule this generation is attached to
- Name
dealer_id
- Required
- Type
- integer
- Description
ID of the dealer this generation is targeting
- Name
status
- Required
- Type
- GenerationStatusEnum
- Description
The status of the generation
Value Description filtering The generation is being checked to see whether it is appropriate to generated based on the schedules filters pending The generation has passed filtering, and a file is scheduled to be generated rejected The generation did not pass filtering, and a file will not be generated generated A file has been generated for this generation record failed There was an error at some point during the lifecycle of the generation. Further details can be found within the errors
payload key
- Name
errors
- Required
- Type
- array | null
- Description
If the status is set to
failed
orrejected
, this key will contain any additional error messages or reasons. For all other statuses, this value will benull
- Name
chosen_for_review
- Required
- Type
- bool
- Description
Determines if the generated record requires a review. A schedule can only be approved once all generations chosen for review have been marked as reviewed.
- Name
dates
- Required
- Type
- object
- Description
- Name
reviewed_at
- Required
- Type
- datetime | null
- Description
The date the generated record was reviewed, represented in
YYYY-MM-DD HH:MM:SS
format. Will be set tonull
if the generated is not reviewed.
- Name
created_at
- Required
- Type
- datetime
- Description
The date the generation record was created, represented in
YYYY-MM-DD HH:MM:SS
format
- Name
updated_at
- Required
- Type
- datetime
- Description
The date the generation record was last updated, represented in
YYYY-MM-DD HH:MM:SS
format
- Name
deleted_at
- Required
- Type
- datetime | null
- Description
The date the generation record was deleted, represented in
YYYY-MM-DD HH:MM:SS
format. Will be set tonull
if not deleted.
Generation Resource
{
"id": 1,
"schedule_id": 2,
"dealer_id": 12935,
"status": "generated",
"chosen_for_review": true,
"dates": {
"reviewed_at": null,
"created_at": "2024-01-01 00:00:00",
"updated_at": "2024-01-02 12:00:00",
"deleted_at": null
}
}
Search Generations
The search generations endpoint uses the standard Search package from the SDK.
An array of generation resources are returned. If no results are found, an empty collection is returned.
Search Filters
- Name
filters.id.equals
- Required
- Type
- integer
- Description
Match a single generation by ID
- Name
filters.id.in
- Required
- Type
- array<integer>
- Description
Match generations by multiple IDs
- Name
filters.report_schedule_id.equals
- Required
- Type
- integer
- Description
Match a generations by its schedule ID
- Name
filters.report_schedule_id.in
- Required
- Type
- array<integer>
- Description
Match generations by multiple schedule IDs
- Name
filters.dealer_id.equals
- Required
- Type
- integer
- Description
Match a generations by its dealer ID
- Name
filters.dealer_id.in
- Required
- Type
- array<integer>
- Description
Match generations by multiple dealer IDs
- Name
filters.dealer_id.equals
- Required
- Type
- integer
- Description
Find schedules for a given dealer ID. If schedules are still in a
scheduling
state, the results may not contain all the schedules.
- Name
filters.status.equals
- Required
- Type
- string
- Description
Match generations by a given status
- Name
filters.status.in
- Required
- Type
- Array<string>
- Description
Match generations by multiple statuses
- Name
filters.chosen_for_review.equals
- Required
- Type
- boolean
- Description
Filter records by whether it was chosen for review or not
- Name
filters.is_reviewed.equals
- Required
- Type
- boolean
- Description
Filter records by whether its received a review or not
- Name
filters.is_preview.equals
- Required
- Type
- boolean
- Description
Find records generated for a preview only
- Name
filters.is_deleted.equals
- Required
- Type
- boolean
- Description
Filter records by whether its been deleted or not
Search Ordering
- id
- report_schedule_id
- dealer_id
- status
- chosen_for_review
- reviewed_at / reviewed
- created_at / created
- updated_at / updated
- deleted_at / deleted
Request
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;
use Compliance\Sdk\Search\Search;
private ApexV3SdkInterface $sdk;
$search = new Search();
$response = $this->sdk
->v2(new Machine())
->pdfReports()
->generations()
->search($search);
Response
{
"data": [
{
"id": 1,
"schedule_id": 2,
"dealer_id": 12935,
"status": "generated",
"chosen_for_review": true,
"dates": {
"reviewed_at": null,
"created_at": "2024-01-01 00:00:00",
"updated_at": "2024-01-02 12:00:00",
"deleted_at": null
}
}
]
}
Retrieve Generation
Will retrieve a specific generation record by ID
URL Parameters
- Name
generation_id
- Required
- required
- Type
- integer
- Description
ID of the generation to retrieve
Error Codes
Status | Description |
---|---|
404 | The requested generation could not be found |
Request
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;
private ApexV3SdkInterface $sdk;
$response = $this->sdk
->v2(new Machine())
->pdfReports()
->generation(1)
->get();
Response
{
"data": {
"id": 1,
"schedule_id": 2,
"dealer_id": 12935,
"status": "generated",
"chosen_for_review": true,
"dates": {
"reviewed_at": null,
"created_at": "2024-01-01 00:00:00",
"updated_at": "2024-01-02 12:00:00",
"deleted_at": null
}
}
}
Retrieve File
Will retrieve a the file contents of the given generated file.
All content will be returned as a base64 string.
URL Parameters
- Name
generation_id
- Required
- required
- Type
- integer
- Description
ID of the generation to retrieve
Error Codes
Status | Description |
---|---|
404 | The requested generation could not be found |
409 | The file has not yet been generated, or the file failed to generate |
500 | There was an error reading the contents of the file |
Request
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;
private ApexV3SdkInterface $sdk;
$response = $this->sdk
->v2(new Machine())
->pdfReports()
->generation(1)
->file();
Response
{
"data": {
"id": 1,
"schedule_id": 2,
"content": "JVBERi0xLj...CiUlRU9GCg=="
}
}
Review Generation
This endpoint can be called to mark a generation as reviewed.
chosen_for_review
must be reviewed in order to approve the schedule. Generations not marked as chosen_for_review
can still be reviewed, but wont count towards the schedule review.URL Parameters
- Name
generation_id
- Required
- required
- Type
- integer
- Description
ID of the generation to review
Error Codes
Status | Description |
---|---|
404 | The generation couldn't be found |
409 | The generation was not in a reviewable state |
Request
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;
private ApexV3SdkInterface $sdk;
$response = $this->sdk
->v2(new Machine())
->pdfReports()
->generation(1)
->review();
Response
{
"data": {
"id": 1,
"schedule_id": 2,
"dealer_id": 12935,
"status": "generated",
"chosen_for_review": true,
"dates": {
"reviewed_at": "2024-01-03 00:00:00",
"created_at": "2024-01-01 00:00:00",
"updated_at": "2024-01-02 12:00:00",
"deleted_at": null
}
}
}
Delete Generation
This endpoint can be called to remove a generation from the schedule.
URL Parameters
- Name
generation_id
- Required
- required
- Type
- integer
- Description
ID of the generation to delete
Error Codes
Status | Description |
---|---|
404 | The generation couldn't be found |
409 | The generation was not in a deletable state |
Request
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;
private ApexV3SdkInterface $sdk;
$response = $this->sdk
->v2(new Machine())
->pdfReports()
->generation(1)
->delete();
Response
{
"data": {
"id": 1,
"schedule_id": 2,
"dealer_id": 12935,
"status": "generated",
"chosen_for_review": true,
"dates": {
"reviewed_at": "2024-01-03 00:00:00",
"created_at": "2024-01-01 00:00:00",
"updated_at": "2024-01-02 12:00:00",
"deleted_at": "2024-01-03 00:00:00"
}
}
}