Skip to content

Jobs

The Jobs API provides the ability to render PDF documents offline. Rendering documents via jobs is the recommended approach when a large number of documents need to be rendered in a single request.

Compared to the Generate Documents API (which requires the request connection remain open throughout the render process), a call to the Create job API will return immediately and (if a notify URL is provided) will send a notification once the job is complete. Completed jobs will store their results for 8 hours after which the job will expire and its results deleted.

Jobs can also be periodically queried for their status if needed. If it is not possible to supply a notify URL, periodically querying the status of a job can be used to determine when (or if) a job has completed successfully in order to retrieve its results.

Creates a new rendering job and places it in the job queue.

https://api.astradoc.io/jobs/v1.0/create?notifyUrl={url}
POST
PropertyTypeRequiredDescription
notifyUrlStringNoAn optional URL parameter that the render system will attempt to post a request to once the job is complete.

The endpoint for this URL must accept JSON POST requests. The body of the request will contain a JobStatus object identical to what is returned by the GetStatus API.
PropertyTypeRequiredDescription
documentsDocumentData[]YesAn array of DocumentData objects containing data for each of the documents being generated.
PropertyTypeDescription
SuccessBoolA Boolean indicating whether or not the request was successful.
MessageStringA message containing error information if the request was unsuccessful.
DataGuidA Guid value holding the Id for the job. This value can be used later on to request the status of the job or to retrieve the results of the job once completed.

Note: This value will only be populated if the job was created successfully.

Returns the status of the given job or a 404 if the job is not found. The status for the job can be any one of the following:

StatusDescription
QUEUEDThe job has been successfully created and is waiting in the render queue.
IN_PROGRESSRendering of the documents for this job is currently in progress.
COMPLETEDRendering of the documents for this job has been completed and its results are ready to be retrieved.
COMPLETED_WITH_ERRORSRendering of the documents has been completed, but some documents were not able to render successfully. Partial results can be retrieved. See the Message property on the JobStatus object for more information about the failure.
FAILEDRendering of the documents has failed and no results are available. See the Message property on the JobStatus object for more information about the failure.
EXPIREDThe job has been marked as expired and is queued for deletion. All jobs are marked as expired 8 hours after they have been completed.
https://api.astradoc.io/jobs/v1.0/GetStatus?jobId={id}
GET
PropertyTypeRequiredDescription
jobIdGuidYesThe Id of the job whose status is being retrieved. This value is returned by the CreateJob API.
PropertyTypeDescription
SuccessBoolA Boolean indicating whether or not the request was successful.
MessageStringA message containing error information if the request was unsuccessful.
DataJobStatusA JobStatus object containing status data for the job
PropertyTypeDescription
JobIdGuidA Guid value containing the Id of the job.
StatusStringA string value containing the status of the job. Will be one of the status values listed in the Job Statuses table above.
MessageStringA string containing the possible reason for the failure of a job. Will be blank if the job completed successfully or is yet to be completed.

Retrieves the rendered PDF data for a job that has been completed successfully. Only jobs with the status of COMPLETED or COMPLETED_WITH_ERRORS will have results that can be retrieved. Attempting to retrieve the results for jobs in any other state will result in a 404 response.

https://api.astradoc.io/jobs/v1.0/GetResults?jobId={id}
GET
PropertyTypeRequiredDescription
jobIdGuidYesThe Id of the job whose results is being retrieved. This value is returned by the CreateJob API.
PropertyTypeDescription
SuccessBoolA Boolean indicating whether or not the request was successful.
MessageStringA message containing error information if the request was unsuccessful.
DataDocumentCollectionResult[]An array of DocumentCollectionResult objects.