/templates/<template_id>/buyIndesignFile
Buys the InDesign file. This might incur a charge.
/templates/<template_id>/indesignFile
Fetches the template’s InDesign file, and returns it as an attachment.
/templates/<template_id>/edit
Creates a template instance from a template.id. This instance can be edited by further API calls — see below.
Parameter | Description |
---|---|
user_key | Your application’s key, from developer.templatecloud.com |
format | json or xml |
template_id | One template id (required) |
GET http://api.templatecloud.com/sandbox/templates/5277/edit?user_key=ba386e729c5f6870cea89f38e92d7a5c&format=json
{ "instance_id": "436935" }
/instances/<instance_id>/makePDF
Initiates the creation of a PDF file, and charges your account.
Parameter | Description |
---|---|
user_key | Your application’s key, from developer.templatecloud.com |
format | json or xml |
queue | 0 = generate and wait (synchronous) 1 = queue for later retrieval (asynchronous) – recommended! |
skip_buy | Some API consumers have a special permission enabled, to bypass the fees, which can be exercised using skip_buy=1. This option is disabled for the majority of API keys. |
PUT http://api.templatecloud.com/sandbox/instances/50010/makePDF?user_key=ba386e729c5f6870cea89f38e92d7a5c&format=json
{ "status": "ok", "message": "PDF generation in progress", "job": "2152428" }
No further edits of a template instance are possible after a call to makePDF; further edits must be made to a new template instance which may be created using call to /templates/<template_id>/edit
/instances/<instance_id>/pdf
If the PDF is ready to download, the response to a GET request is a URL to the PDF file; otherwise it is an error notification.
It is advised that you poll /pdf with a HEAD request until the 200 response is returned; feed back the latest result to your web page via AJAX.
HEAD http://api.templatecloud.com/sandbox/instances/50010/pdf?user_key=ba386e729c5f6870cea89f38e92d7a5c&format=json
{ "status": "error", "message": "PDF generation in progress." }
{ "status": "error", "message": "PDF generation failed." }
{ "status": "error", "message": "PDF not created (probably instance not found, or some unknown error)." }
{ "status": "ok", "message": "PDF ready." }
After receiving a 200 response, the file can be retrieved using the equivalent GET request:
GET http://api.templatecloud.com/sandbox/instances/50010/pdf?user_key=ba386e729c5f6870cea89f38e92d7a5c&format=json
If the file is still available, the 200 response will contain a binary stream. If the file is not available, the response will be an XML/JSON notification of the error (as above).
Jump to contents page of
|