With The PDF Generator API your users can easily create and manage different document templates with an easy-to-use browser based document editor. And, you can use simple HTTP API calls to merge the templates with data from your own software to generate PDF and HTML documents. Or just use The PDF Generator API as an internal tool to manage and generate different outputs needed within your software. This way you don’t have to waste your time or your developers’ time on hard-coding the output layouts.
The PDF Generator API features a web API architecture, allowing you to code in the language of your choice. This API supports the JSON media type, and uses UTF-8 character encoding.
First thing is to create your FREE SANDBOX ACCOUNT, its free for testing and integration process. Once you are ready to go live just upgrade to one of the monthly plans that fits to your needs. If you need a custom quote then please contact us support@pdfgeneratorapi.com.
You can find the example documents with sample JSON data sets here.
Follow these steps to import one of the example documents to your workspace.
Organization is a group of workspaces owned by your account.
Workspace contains templates. Each workspace has access to their own templates and organization default templates.
Master Workspace is the main/default workspace of your Organization. The Master Workspace identifier is the email you signed up with.
Default template is a template that is available for all workspaces by default. You can set the template access type under Page Setup. If template has "Organization" access then your users can use them from the "New" menu in the Editor.
Access types
Private - template is visible only in workspace where it was created
Organization - template is visible on all workspaces
Data Field is a placeholder for the specific data in your JSON data set. In this example JSON you can access the buyer name using Data Field {paymentDetails::buyerName}
. The separator between depth levels is ::
(two colons).
When designing the template you don’t have to know every Data Field, our editor automatically extracts all the available fields from your data set and provides an easy way to insert them into the template.
{
"documentNumber": 1,
"paymentDetails": {
"method": "Credit Card",
"buyerName": "John Smith"
},
"items": [
{
"id": 1,
"name": "Item one"
}
]
}
The Base URI is
You can choose between Simple Authentication and Signature Authentication. The Signature Authentication adds an extra security as instead of sending your API secret, you need to send the HMAC signature. This means that your API secret is never exposed to the Internet and you can make sure that that your credentials are safe.
To use the Simple Authentication, you’ll need to include your API key, secret and workspace identifier with each API request, sent along with the following headers.
X-Auth-Key: {key}
X-Auth-Secret: {secret}
X-Auth-Workspace: {workspace}
Content-Type: application/json; charset=utf-8
Accept: application/json
Where
{key}
is your API key found under your Account Settings
{secret}
is your API secret found under your Account Settings
{workspace}
is an unique string created by your application that identifies the workspace.
The default (Master Workspace) {workspace}
identifier is the email you signed up with.
We don't suggest sending your secret
in query string as it can be copied and reused by others.
/** * Simple Authentication params sent in headers */ curl -H "X-Auth-Key: " \ -H "X-Auth-Secret: " \ -H "X-Auth-Workspace: " \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X POST -d '{"id":105,"email":"customer@gmail.com","order_number":105,"total_price":"12,240.00","total_tax":"2,040.00","billing_address":{"street_1":"S\u00fctiste tee 23","city":"Tallinn","zip":"123123","country":"Estonia","name":"Kalle Vallaste","company":"Vallaste Inc"},"line_items":[{"name":"[Sample] Chanel, the cheetah","sku":"123123","price":"4,080.00","total":"8,160.00","quantity":2}]}' \ '/templates/19375/output'
$key = ''; $secret = ''; $workspace = ''; $resource = 'templates/19375/output'; $documentData = json_encode([ "id" => 304355781, "name" => "#1014A", "number" => 15, "note" => "Customer Notes", "shipping_address" => [ "name" => "John Smith", "address" => "St Patrick Road 4", "city" => "London", "country" => "United Kingdom", "zip" => "UK12991" ] ]); $client = new \GuzzleHttp\Client([ 'base_uri' => '/' ]); /** * Authentication params sent in headers */ $response = $client->request('POST', $resource, [ 'body' => $documentData, 'headers' => [ 'X-Auth-Key' => $key, 'X-Auth-Secret' => $secret, 'X-Auth-Workspace' => $workspace, 'Accept' => 'application/json', 'Content-Type' => 'application/json; charset=utf-8', ] ]);
To use the Signature Authentication, you’ll need to use your app key and secret, sent along with the following headers.
You need to generate a new signature
value for each API request.
X-Auth-Key: {key}
X-Auth-Workspace: {workspace}
X-Auth-Signature: {signature}
Content-Type: application/json; charset=utf-8
Accept: application/json
As an alternative you can send key
, workspace
and signature
values as query parameters. This is useful for redirecting user to editor without a form submit.
/templates/19375/editor?key={key}&workspace={workspace}&signature={signature}
To create the signature you need to concatenate key
, resource
and workspace
values and then hash that string using HMAC-SHA256
and your secret
{signature} = HMAC-SHA256({key}{resource}{workspace}, {secret})
Where
{key}
is your API key found under your Account Settings
{secret}
is your API secret found under your Account Settings
{resource}
is the API request resource e.g templates/123456/output
{workspace}
is an unique string created by your application that identifies the workspace.
{signature}
is HMAC SHA256 hash
The default (Master Workspace) {workspace}
identifier is the email you signed up with.
/** * Signature Authentication params sent in headers */ curl -H "X-Auth-Key: " \ -H "X-Auth-Workspace: " \ -H "X-Auth-Signature: 34ced549ecf80ec48e079d4c845598cd99339757851ce02e32a8e884dc638b28" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X POST -d '{"id":105,"email":"customer@gmail.com","order_number":105,"total_price":"12,240.00","total_tax":"2,040.00","billing_address":{"street_1":"S\u00fctiste tee 23","city":"Tallinn","zip":"123123","country":"Estonia","name":"Kalle Vallaste","company":"Vallaste Inc"},"line_items":[{"name":"[Sample] Chanel, the cheetah","sku":"123123","price":"4,080.00","total":"8,160.00","quantity":2}]}' \ '/templates/19375/output' /** * Signature Authentication params sent in query string */ curl -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X POST -d '{"id":105,"email":"customer@gmail.com","order_number":105,"total_price":"12,240.00","total_tax":"2,040.00","billing_address":{"street_1":"S\u00fctiste tee 23","city":"Tallinn","zip":"123123","country":"Estonia","name":"Kalle Vallaste","company":"Vallaste Inc"},"line_items":[{"name":"[Sample] Chanel, the cheetah","sku":"123123","price":"4,080.00","total":"8,160.00","quantity":2}]}' \ '/templates/19375/output?key=&workspace=&signature=34ced549ecf80ec48e079d4c845598cd99339757851ce02e32a8e884dc638b28'
$key = ''; $secret = ''; $workspace = ''; $resource = 'templates/19375/output'; $documentData = json_encode([ "id" => 304355781, "name" => "#1014A", "number" => 15, "note" => "Customer Notes", "shipping_address" => [ "name" => "John Smith", "address" => "St Patrick Road 4", "city" => "London", "country" => "United Kingdom", "zip" => "UK12991" ] ]); $client = new \GuzzleHttp\Client([ 'base_uri' => '/' ]); /** Signature Authentication **/ $data = [ 'key' => $key, 'resource' => $resource, 'workspace' => $workspace ]; ksort($data); $signature = hash_hmac('sha256', implode('', $data), $secret); /** * Authentication params sent in headers */ $response = $client->request('POST', $resource, [ 'body' => $documentData, 'headers' => [ 'X-Auth-Key' => $key, 'X-Auth-Workspace' => $workspace, 'X-Auth-Signature' => $signature, 'Accept' => 'application/json', 'Content-Type' => 'application/json; charset=utf-8', ] ]); /** * Authentication params sent in query string */ $response = $client->request('POST', $resource, [ 'body' => $documentData, 'query' => [ 'key' => $key, 'workspace' => $workspace, 'signature' => $signature ] ]);
Errors are returned using HTTP error code syntax. All additional information about the error is sent in response body.
Code | Description |
---|---|
401 | Authentication failed |
401 | Required parameter missing |
403 | Access not granted |
404 | Entity not found |
404 | Resource not found |
422 | Incorrect parameter value |
500 | Internal error |
# Response
{
"error": "Authentication failed: key missing",
"status": 401
}
PDF Generator API comes with a powerful drag & drop editor that allows to create any kind of document templates, from barcode labels to invoices, quotes and reports.
Component specification
Expression Language documentation
Frequently asked questions and answers
The Base URI is
Each API request has to include key
, workspace
and signature
values in headers or in query params. For more information please see the Authentication section.
GET /templates
Returns list of templates in the workspace.
Get templates request diagramorganization
, private
true
access type: privatefalse
access type: organization
/** * Authentication params sent in headers */ curl -H "X-Auth-Key: " \ -H "X-Auth-Workspace: " \ -H "X-Auth-Signature: f6032be36f66ef41ac1eadb15ddf595c71f02720a69b6085a9ee24da539367c8" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X GET /templates /** * Authentication params sent in query string */ curl -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X GET '/templates?key=&workspace=&signature=f6032be36f66ef41ac1eadb15ddf595c71f02720a69b6085a9ee24da539367c8'
$key = ''; $secret = ''; $workspace = ''; $resource = 'templates'; $data = [ 'key' => $key, 'resource' => $resource, 'workspace' => $workspace ]; ksort($data); $signature = hash_hmac('sha256', implode('', $data), $secret); $client = new \GuzzleHttp\Client([ 'base_uri' => '/', ]); /** * Authentication params sent in headers */ $response = $client->request('GET', $resource, [ 'headers' => [ 'X-Auth-Key' => $key, 'X-Auth-Workspace' => $workspace, 'X-Auth-Signature' => $signature 'Accept' => 'application/json', 'Content-Type' => 'application/json; charset=utf-8' ] ]); $contents = $response->getBody()->getContents(); /** * Authentication params sent in query string */ $response = $client->request('GET', $resource, [ 'body' => $documentData, 'query' => [ 'key' => $key, 'workspace' => $workspace, 'signature' => $signature ] ]); $contents = $response->getBody()->getContents();
{ "response": [ { "id": 24382, "name": "Invoice template", "modified": "2017-10-30 16:49:28", "owner": true, "tags": [ "order", "invoice" ] }, { "id": 24381, "name": "Label template", "modified": "2017-10-21 11:49:28", "owner": false, "tags": [] } ] }
GET /templates/{template}
Returns template configuration
/** * Authentication params sent in headers */ curl -H "X-Auth-Key: " \ -H "X-Auth-Workspace: " \ -H "X-Auth-Signature: eab757d4d53fee939ab1816ae08dddcc745ed142d27ddf988b7403e04a1d6d23" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X GET /templates/19375 /** * Authentication params sent in query string */ curl -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X GET '/templates/19375?key=&workspace=&signature=eab757d4d53fee939ab1816ae08dddcc745ed142d27ddf988b7403e04a1d6d23'
$key = ''; $secret = ''; $workspace = ''; $resource = 'templates/19375'; $data = [ 'key' => $key, 'resource' => $resource, 'workspace' => $workspace ]; ksort($data); $signature = hash_hmac('sha256', implode('', $data), $secret); $client = new \GuzzleHttp\Client([ 'base_uri' => '/', ]); /** * Authentication params sent in headers */ $response = $client->request('GET', $resource, [ 'headers' => [ 'X-Auth-Key' => $key, 'X-Auth-Workspace' => $workspace, 'X-Auth-Signature' => $signature 'Accept' => 'application/json', 'Content-Type' => 'application/json; charset=utf-8' ] ]); $contents = $response->getBody()->getContents(); /** * Authentication params sent in query string */ $response = $client->request('GET', $resource, [ 'body' => $documentData, 'query' => [ 'key' => $key, 'workspace' => $workspace, 'signature' => $signature ] ]); $contents = $response->getBody()->getContents();
{ "response": { "id": 19378, "name": "New template via API", "tags": "", "isDraft": false, "layout": { "format": "A4", "unit": "cm", "orientation": "portrait", "rotation": 0, "margins": { "top": 0.5, "left": 0.5, "right": 0.5, "bottom": 0.5 }, "emptyLabels": 0, "width": 21, "height": 29.7, "repeatLayout": null }, "pages": [ { "width": 21, "height": 29.7, "components": [ { "width": 3, "height": 1, "top": 4, "left": 3, "zindex": 0, "value": "123456.1231", "dataIndex": "", "borderStatus": { "top": true, "right": true, "bottom": true, "left": true }, "borderWidth": 1, "borderColor": "#000000", "borderStyle": "dashed", "backgroundColor": "#ededed", "useFlexHeight": true, "isEditable": true, "padding": { "top": 0.05, "right": 0.05, "bottom": 0.05, "left": 0 }, "fontFamily": "opensans", "fontAlign": "center", "fontSize": 16, "fontType": [ "italic" ], "fontColor": "#000000", "cls": "numberComponent", "conditionalFormats": [], "decimalSeparator": ".", "decimalPlaces": 2, "thousandsSeparator": " ", "autoIncreaseStep": 0, "fontValign": "top" } ], "margins": { "right": 0.5, "bottom": 0.5 }, "border": false } ], "dataSettings": { "sortBy": [], "filterBy": [] }, "editor": { "heightMultiplier": 2 } }, "meta": [] }
POST /templates/{template}/output
Merges template with data and returns base64 encoded document or public url to a document.
You can send json encoded data in request body or a public url to your json file as data
parameter.
pdf
, html
, zip
pdf
base64
, url
, I
base64
output=base64
is used or URL to the document when the output=url
is used.
name
attribute is not defined in request.
/** * Authentication params sent in headers */ curl -H "X-Auth-Key: " \ -H "X-Auth-Workspace: " \ -H "X-Auth-Signature: 34ced549ecf80ec48e079d4c845598cd99339757851ce02e32a8e884dc638b28" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X POST -d '{"id":105,"email":"customer@gmail.com","order_number":105,"total_price":"12,240.00","total_tax":"2,040.00","billing_address":{"street_1":"S\u00fctiste tee 23","city":"Tallinn","zip":"123123","country":"Estonia","name":"Kalle Vallaste","company":"Vallaste Inc"},"line_items":[{"name":"[Sample] Chanel, the cheetah","sku":"123123","price":"4,080.00","total":"8,160.00","quantity":2}]}' \ '/templates/19375/output?format=pdf&output=base64' /** * Authentication params sent in query string */ curl -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X POST -d '{"id":105,"email":"customer@gmail.com","order_number":105,"total_price":"12,240.00","total_tax":"2,040.00","billing_address":{"street_1":"S\u00fctiste tee 23","city":"Tallinn","zip":"123123","country":"Estonia","name":"Kalle Vallaste","company":"Vallaste Inc"},"line_items":[{"name":"[Sample] Chanel, the cheetah","sku":"123123","price":"4,080.00","total":"8,160.00","quantity":2}]}' \ '/templates/19375/output?format=pdf&output=base64&key=&workspace=&signature=34ced549ecf80ec48e079d4c845598cd99339757851ce02e32a8e884dc638b28'
$key = ''; $secret = ''; $workspace = ''; $resource = 'templates/19375/output'; $documentData = json_encode([ "id" => 304355781, "name" => "#1014A", "number" => 15, "note" => "Customer Notes", "shipping_address" => [ "name" => "John Smith", "address" => "St Patrick Road 4", "city" => "London", "country" => "United Kingdom", "zip" => "UK12991" ] ]); $data = [ 'key' => $key, 'resource' => $resource, 'workspace' => $workspace ]; ksort($data); $signature = hash_hmac('sha256', implode('', $data), $secret); $client = new \GuzzleHttp\Client([ 'base_uri' => '/' ]); /** * Authentication params sent in headers */ $response = $client->request('POST', $resource, [ 'body' => $documentData, 'query' => [ 'format' => 'pdf', 'output' => 'base64' ], 'headers' => [ 'X-Auth-Key' => $key, 'X-Auth-Workspace' => $workspace, 'X-Auth-Signature' => $signature, 'Accept' => 'application/json', 'Content-Type' => 'application/json; charset=utf-8', ] ]); /** * Authentication params sent in query string */ $response = $client->request('POST', $resource, [ 'body' => $documentData, 'query' => [ 'key' => $key, 'workspace' => $workspace, 'signature' => $signature, 'format' => 'pdf', 'output' => 'base64' ] ]); $contents = $response->getBody()->getContents();
{ "response": "JVBERi0xLjcKJeLjz9MKNyAwIG9iago8PCAvVHlwZSA...", "meta": { "name": "a2bd25b8921f3dc7a440fd7f427f90a4.pdf", "display_name": "a2bd25b8921f3dc7a440fd7f427f90a4", "encoding": "base64", "content-type": "application\/pdf" } }
POST /templates/output
Allows to merge multiples template with data and returns base64 encoded document or public url to a document.
pdf
, html
pdf
base64
, url
, I
base64
output=base64
is used or URL to the document when the output=url
is used.
name
attribute is not defined in request.
/** * Authentication params sent in headers */ curl -H "X-Auth-Key: " \ -H "X-Auth-Workspace: " \ -H "X-Auth-Signature: 9212312080ac497115bc712d853d39ee59015d1f1c1117ecce4a79952212a7e8" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X POST -d '[{"template":[52272,52266,19375],"data":{"order_number":"91812","billing_receiver_fullname":"John Smith","line_items":[{"name":"Best product ever"}]}}]' \ '/templates/output?format=pdf&output=base64' /** * Authentication params sent in query string */ curl -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X POST -d '[{"template":[52272,52266,19375],"data":{"order_number":"91812","billing_receiver_fullname":"John Smith","line_items":[{"name":"Best product ever"}]}}]' \ '/templates/output?format=pdf&output=base64&key=&workspace=&signature=34ced549ecf80ec48e079d4c845598cd99339757851ce02e32a8e884dc638b28'
$key = ''; $secret = ''; $workspace = ''; $resource = 'templates/output'; $requestData = json_encode([{ "template": [52272, 52266, 19375], "data": { "order_number": "91812", "billing_receiver_fullname": "John Smith", "line_items": [{ "name": "Best product ever" } } }]); $data = [ 'key' => $key, 'resource' => $resource, 'workspace' => $workspace ]; ksort($data); $signature = hash_hmac('sha256', implode('', $data), $secret); $client = new \GuzzleHttp\Client([ 'base_uri' => '/' ]); /** * Authentication params sent in headers */ $response = $client->request('POST', $resource, [ 'body' => $requestData, 'query' => [ 'format' => 'pdf', 'output' => 'base64' ], 'headers' => [ 'X-Auth-Key' => $key, 'X-Auth-Workspace' => $workspace, 'X-Auth-Signature' => $signature, 'Accept' => 'application/json', 'Content-Type' => 'application/json; charset=utf-8', ] ]); $contents = $response->getBody()->getContents(); /** * Authentication params sent in query string */ $response = $client->request('POST', $resource, [ 'body' => $requestData, 'query' => [ 'key' => $key, 'workspace' => $workspace, 'signature' => $signature, 'format' => 'pdf', 'output' => 'base64' ] ]); $contents = $response->getBody()->getContents();
{ "response": "JVBERi0xLjcKJeLjz9MKNyAwIG9iago8PCAvVHlwZSA...", "meta": { "name": "a2bd25b8921f3dc7a440fd7f427f90a4.pdf", "display_name": "a2bd25b8921f3dc7a440fd7f427f90a4", "encoding": "base64", "content-type": "application\/pdf" } }
GET /templates/{template}/editor
Opens template in document editor. You need to redirect user to created url (redirect or POST form).
Open editor request diagramen
, et
, cs
, sk
REDIRECT '/templates/19375/editor?key=&workspace=&signature=d0bb31da8fe781c69a0a79b1d71806d46c18b1dff32af25310f0cfd0af1d7810&data=https://myawesomeapp.com/data/9129381823.json&language=en'
$key = ''; $secret = ''; $workspace = ''; $resource = 'templates/19375/editor'; $data = [ 'key' => $key, 'resource' => $resource, 'workspace' => $workspace ]; ksort($data); $signature = hash_hmac('sha256', implode('', $data), $secret); $params = [ 'key' => $key, 'workspace' => $workspace, 'signature' => $signature, 'data' => 'https://myawesomeapp.com/data/9129381823.json', 'langauge' => 'en' ]; $url = '/templates/19375/editor?'.http_build_query($params); header('Location: '.$url); exit;
POST /templates
Creates a blank template with given name. Template is placed to the workspace specified in authentication params.
Template data must be sent in request body.
/** * Authentication params sent in headers */ curl -H "X-Auth-Key: " \ -H "X-Auth-Workspace: " \ -H "X-Auth-Signature: f6032be36f66ef41ac1eadb15ddf595c71f02720a69b6085a9ee24da539367c8" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X POST -d '{"name":"New template via API"}' \ '/templates' /** * Authentication params sent in query string */ curl -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X POST -d '{"name":"New template via API"}' \ '/templates?key=&workspace=&signature=f6032be36f66ef41ac1eadb15ddf595c71f02720a69b6085a9ee24da539367c8'
$key = ''; $secret = ''; $workspace = ''; $resource = 'templates'; $templateData = json_encode([ "name" => 'New template via API', "tags" => ['order'] ]); $data = [ 'key' => $key, 'resource' => $resource, 'workspace' => $workspace ]; ksort($data); $signature = hash_hmac('sha256', implode('', $data), $secret); $client = new \GuzzleHttp\Client([ 'base_uri' => '/' ]); /** * Authentication params sent in headers */ $response = $client->request('POST', $resource, [ 'body' => $templateData, 'headers' => [ 'X-Auth-Key' => $key, 'X-Auth-Workspace' => $workspace, 'X-Auth-Signature' => $signature, 'Accept' => 'application/json', 'Content-Type' => 'application/json; charset=utf-8', ] ]); $contents = $response->getBody()->getContents(); /** * Authentication params sent in query string */ $response = $client->request('POST', $resource, [ 'body' => $templateData, 'query' => [ 'key' => $key, 'workspace' => $workspace, 'signature' => $signature ] ]); $contents = $response->getBody()->getContents();
{ "response": { "id": 33556, "name": "New template via API", "tags": "order", "isDraft": false, "layout": { "format": "A4", "unit": "cm", "orientation": "portrait", "rotation": 0, "margins": { "top": 0.5, "left": 0.5, "right": 0.5, "bottom": 0.5 }, "emptyLabels": 0, "width": 21, "height": 29.7, "repeatLayout": null }, "pages": [ { "width": 21, "height": 29.7, "components": [ ], "margins": { "right": 0.5, "bottom": 0.5 }, "border": false } ], "dataSettings": { "sortBy": [], "filterBy": [] }, "editor": { "heightMultiplier": 2 } }, "meta": [] }
PUT /templates/{template}
Updates template configuration.
The template configuration must be sent in request body.
The template configuration must be complete as entire template configuration is replaced.
/** * Authentication params sent in headers */ curl -H "X-Auth-Key: " \ -H "X-Auth-Workspace: " \ -H "X-Auth-Signature: eab757d4d53fee939ab1816ae08dddcc745ed142d27ddf988b7403e04a1d6d23" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X PUT -d '{"name":"Update template via API","tags":["tag 1","tag 2"]}' \ '/templates/19375' /** * Authentication params sent in query string */ curl -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X PUT -d '{"name":"Update template via API","tags":["tag 1","tag 2"]}' \ '/templates/19375?key=&workspace=&signature=eab757d4d53fee939ab1816ae08dddcc745ed142d27ddf988b7403e04a1d6d23'
$key = ''; $secret = ''; $workspace = ''; $resource = 'templates/19375'; $templateData = json_encode([ "name" => 'Update template via API', "tags" => ['tag1', 'tag2'] ]); $data = [ 'key' => $key, 'resource' => $resource, 'workspace' => $workspace ]; ksort($data); $signature = hash_hmac('sha256', implode('', $data), $secret); $client = new \GuzzleHttp\Client([ 'base_uri' => '/' ]); /** * Authentication params sent in headers */ $response = $client->request('PUT', $resource, [ 'body' => $templateData, 'headers' => [ 'X-Auth-Key' => $key, 'X-Auth-Workspace' => $workspace, 'X-Auth-Signature' => $signature, 'Accept' => 'application/json', 'Content-Type' => 'application/json; charset=utf-8', ] ]); $contents = $response->getBody()->getContents(); /** * Authentication params sent in query string */ $response = $client->request('PUT', $resource, [ 'body' => $templateData, 'query' => [ 'key' => $key, 'workspace' => $workspace, 'signature' => $signature ] ]); $contents = $response->getBody()->getContents();
{ "response": { "id": 19375, "name": "Update template via API", "tags": "tag1,tag2", "isDraft": false, "layout": { "format": "A4", "unit": "cm", "orientation": "portrait", "rotation": 0, "margins": { "top": 0.5, "left": 0.5, "right": 0.5, "bottom": 0.5 }, "emptyLabels": 0, "width": 21, "height": 29.7, "repeatLayout": null }, "pages": [ { "width": 21, "height": 29.7, "components": [ ], "margins": { "right": 0.5, "bottom": 0.5 }, "border": false } ], "dataSettings": { "sortBy": [], "filterBy": [] }, "editor": { "heightMultiplier": 2 } }, "meta": [] }
POST /templates/{template}/copy
Creates a copy of a template to the workspace specified in authentication params.
/** * Authentication params sent in headers */ curl -H "X-Auth-Key: " \ -H "X-Auth-Workspace: " \ -H "X-Auth-Signature: 625c6d51e761dacbe24092a84fde0a028a6678798fcb181996a264ac475f1a26" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X POST '/templates/19375/copy?name=Copied template' /** * Authentication params sent in query string */ curl -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X POST '/templates/19375/copy?name=Copied template&key=&workspace=&signature=625c6d51e761dacbe24092a84fde0a028a6678798fcb181996a264ac475f1a26'
$key = ''; $secret = ''; $workspace = ''; $resource = 'templates/19375/copy'; $data = [ 'key' => $key, 'resource' => $resource, 'workspace' => $workspace ]; ksort($data); $signature = hash_hmac('sha256', implode('', $data), $secret); $client = new \GuzzleHttp\Client([ 'base_uri' => '/' ]); /** * Authentication params sent in headers */ $response = $client->request('POST', $resource, [ 'query' => [ 'name' => 'Copied template' ], 'headers' => [ 'X-Auth-Key' => $key, 'X-Auth-Workspace' => $workspace, 'X-Auth-Signature' => $signature, 'Accept' => 'application/json', 'Content-Type' => 'application/json; charset=utf-8', ] ]); $contents = $response->getBody()->getContents(); /** * Authentication params sent in query string */ $response = $client->request('POST', $resource, [ 'body' => $templateData, 'query' => [ 'key' => $key, 'workspace' => $workspace, 'signature' => $signature, 'name' => 'Copied template' ] ]); $contents = $response->getBody()->getContents();
{ "response": { "id": 33556, "name": "Copied template", "tags": "", "isDraft": false, "layout": { "format": "A4", "unit": "cm", "orientation": "portrait", "rotation": 0, "margins": { "top": 0.5, "left": 0.5, "right": 0.5, "bottom": 0.5 }, "emptyLabels": 0, "width": 21, "height": 29.7, "repeatLayout": null }, "pages": [ { "width": 21, "height": 29.7, "components": [ { "width": 3, "height": 1, "top": 4, "left": 3, "zindex": 0, "value": "123456.1231", "dataIndex": "", "borderStatus": { "top": true, "right": true, "bottom": true, "left": true }, "borderWidth": 1, "borderColor": "#000000", "borderStyle": "dashed", "backgroundColor": "#ededed", "useFlexHeight": true, "isEditable": true, "padding": { "top": 0.05, "right": 0.05, "bottom": 0.05, "left": 0 }, "fontFamily": "opensans", "fontAlign": "center", "fontSize": 16, "fontType": [ "italic" ], "fontColor": "#000000", "cls": "numberComponent", "conditionalFormats": [], "decimalSeparator": ".", "decimalPlaces": 2, "thousandsSeparator": " ", "autoIncreaseStep": 0, "fontValign": "top" } ], "margins": { "right": 0.5, "bottom": 0.5 }, "border": false } ], "dataSettings": { "sortBy": [], "filterBy": [] }, "editor": { "heightMultiplier": 2 } }, "meta": [] }
DELETE /templates/{template}
Deletes template
/** * Authentication params sent in headers */ curl -H "X-Auth-Key: " \ -H "X-Auth-Workspace: " \ -H "X-Auth-Signature: 15138288ad75f14f2de75e42aa2367414ce38047c4499e4696b9b170ab2983ca" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X DELETE '/templates/33423' /** * Authentication params sent in query string */ curl -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X DELETE '/templates/33423?key=&workspace=&signature=15138288ad75f14f2de75e42aa2367414ce38047c4499e4696b9b170ab2983ca'
$key = ''; $secret = ''; $workspace = ''; $resource = 'templates/33423'; $data = [ 'key' => $key, 'resource' => $resource, 'workspace' => $workspace ]; ksort($data); $signature = hash_hmac('sha256', implode('', $data), $secret); $client = new \GuzzleHttp\Client([ 'base_uri' => '/' ]); /** * Authentication params sent in headers */ $response = $client->request('DELETE', $resource, [ 'headers' => [ 'X-Auth-Key' => $key, 'X-Auth-Workspace' => $workspace, 'X-Auth-Signature' => $signature, 'Accept' => 'application/json', 'Content-Type' => 'application/json; charset=utf-8' ] ]); $contents = $response->getBody()->getContents(); /** * Authentication params sent in query string */ $response = $client->request('DELETE', $resource, [ 'query' => [ 'key' => $key, 'workspace' => $workspace, 'signature' => $signature ] ]); $contents = $response->getBody()->getContents();
{ "response": { "success": true } }
DELETE /workspaces/{workspace}
Deletes workspace
/** * Authentication params sent in headers */ curl -H "X-Auth-Key: " \ -H "X-Auth-Workspace: " \ -H "X-Auth-Signature: c92e4ee08800e4cfaebe4103be066b73d0ee37949980f3edb2f7f16d46a2cc6b" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X DELETE '/workspaces/demo.example2@actualreports.com' /** * Authentication params sent in query string */ curl -H "Content-Type: application/json" \ -H "Accept: application/json" \ -X DELETE '/workspaces/demo.example2@actualreports.com?key=&workspace=&signature=c92e4ee08800e4cfaebe4103be066b73d0ee37949980f3edb2f7f16d46a2cc6b'
$key = ''; $secret = ''; $workspace = ''; $resource = 'workspaces/demo.example2@actualreports.com'; $data = [ 'key' => $key, 'resource' => $resource, 'workspace' => $workspace ]; ksort($data); $signature = hash_hmac('sha256', implode('', $data), $secret); $client = new \GuzzleHttp\Client([ 'base_uri' => '/' ]); /** * Authentication params sent in headers */ $response = $client->request('DELETE', $resource, [ 'headers' => [ 'X-Auth-Key' => $key, 'X-Auth-Workspace' => $workspace, 'X-Auth-Signature' => $signature, 'Accept' => 'application/json', 'Content-Type' => 'application/json; charset=utf-8' ] ]); /** * Authentication params sent in query string */ $response = $client->request('DELETE', $resource, [ 'query' => [ 'key' => $key, 'workspace' => $workspace, 'signature' => $signature ] ]); $contents = $response->getBody()->getContents();
{ "response": { "success": true } }