Contact us

Applies to: Customer's Canvas On-Premises; Customer's Canvas Hub cloud; Preflight Tool 2.0

Skip to main content

Finish product

You can complete the product workflow by using the POST ~/api/product/finish endpoint. This endpoint finalizes the product state and returns the print-ready files.

Request payload​

To finish a product, pass the stateId in the request body:

{
"stateId": "4afcbe97-b51d-4f6f-b9db-70c55536b80a"
}

Example call​

const finishProduct = async () => {
const response = await fetch(appUrl + "api/product/finish", {
method: "POST",
body: JSON.stringify({
stateId: "4afcbe97-b51d-4f6f-b9db-70c55536b80a"
}),
headers: {
'Content-Type': 'application/json'
}
});
const result = await response.json();
console.log(result);
};

Success response​

This endpoint returns preview URLs, hi-res URLs, origin file data, and the state identifier. Preview and hi-res URLs are dictionaries keyed by page index:

Status Code: 200 OK
Content:
{
"previewUrls": {
"0": "http://example.com/pt/api/files/get/preview-1.jpg"
},
"hiresUrls": {
"0": "http://example.com/pt/api/files/get/print-1.pdf"
},
"originUrls": {},
"stateId": "4afcbe97-b51d-4f6f-b9db-70c55536b80a"
}

The originUrls dictionary contains OriginFileModel values. Its fields depend on the origin file saved by the back end.

Error response​

When the DisableFinishEndpoint parameter is set to true in the configuration, this endpoint returns:

Status Code: 403 Forbidden
Content:
{
"error": "The finish endpoint is disabled"
}

Configuration​

To disable this endpoint, set the DisableFinishEndpoint parameter to true in your configuration.

Was this page helpful?