Introduction

The compile resource is used to create the documents via the DynamicDocs API. Use the compile API call to send the dynamic data and receive back a protected URL link to download the document.

End Point, Method and Path Parameters

The compile resource has only one end point and it uses the POST method.

End Point Structure - POST

.../templates/{templateToken}/compile?...

The templateToken are required path parameters and can be found in the settings page of your template.

Query String Parameters

The query parameters follow the ? in the end point and follow the template settings closely. If the query parameters are omitted the template settings will be used, while in a case where the query parameter is present, it will take precedence.

Technical Note - Settings versus Query Parameters

Note that the query parameters in the request take precendece over the settings in the Advicement API. In other words, if the setting indicates the parameter to be set to true, but in the request the parameter is set to false, the API would overwrite the settings and produce the document as if the parameter is false.

Response Parameters

The response settings deal with what happens to the document once it has been created and the various option to receive the document.

Doc Delivery Type - Example

.../templates/98765/compile?doc-delivery-type={docDeliveryType}&...

The docDeliveryType is a string parameter and can take the following values:

  • url
  • webhook (currently not available and under development)
urlExpiration - Example

.../templates/98765/compile?doc-url-expires-in={docUrlExpiresIn}&...

The docUrlExpiresIn is a numerical parameter which takes integers and describes after how many seconds the provided URL is available to download the document.

Compilation Parameters

The compilation parameters set the options on how the document is compiled with latex and provide various options.

Latex Compiler - Example

.../templates/98765/compile?latex-compiler={latexCompiler}&...

The latexCompiler parameter can take the following values:

  • pdflatex
  • luatex (currently not available and under development)
Number of Latex Compilation - Example

.../templates/98765/compile?latex-runs={latexRuns}&...

The latexRuns is a numerical parameter and can take values of 1, 2 and 3. Note that compiling multiple times may incur additional costs.

Main File to Compile - Example

.../templates/98765/compile?main-file-name={mainFileName}&...

The mainFileName is a string parameter which identifies the main file to compile. For example it can be the following value: mainfile.tex.

Doc File Name - Example

.../templates/98765/compile?doc-file-name={docFileName}&...

The docFileName is a string parameter which determines the name of the file. Note that the extension of the file is not required. For example it can be the following value: invoiceMar2020.

Security Parameters

The pdf security settings deal with whether the pdf should be encrypted and the settings of the password.

Encrypt PDF - Example - Under Development

.../templates/98765/compile?encrypt-type={encryptType}&...

The encryptType parameter can take the following values:

  • na
  • rc4 (currently not available and under development)
Technical Note - Using Query Parameters

In reality the query parameters can be used while integrating with the Advicement API. In production, instead of passing the settings through the query, we recommend changing the settings in your template and keeping your URL request short.

Request and Response Example

In this section we will show you an example of a request to the Advicement API.

URL Request - Example

.../templates/98765/compile?doc-url-expires-in=3600&latex-runs=1

Key Value
doc-url-expires-in 3600
latex-runs 1
{ "client": { "preferedName": "Igz", "name": "John", "surname": "Smith", "email": "info@gmail.com", "mobileNumber": " 27 82 123 4567", "dateOfBirth": "1990-12-01", "nationality": "South African", "address": "1 Rivonia Road, Sandton, 2193", "taxResidence": "South Africa", "taxNumber": "12345678", "prefferedCommunication": "Email", "age": 33, "weightKG": 78.65, "gender": "Male", "professional": true } }
{ "documentStatusUrl": "https://advicement-dev-api-calls.s3.eu-west-1.amazonaws.com/12345/98765/f5c5cb80-efe9-4632-bf67-2541a77e32a7/output/progress.json?AWSAccessKeyId=ASIA2LMZZZXSP23HL2MY&Expires=1609014601&Signature=iyS1DOdGIbaOo9eYeRofGOJ%2FXws%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEGUaCWV1LXdlc3QtMSJGMEQCIDLygbd8q1Uv8Wxainse9NDxbmSYR76uCMPfPq3DhRS3AiA2UG4fpCHYGmst7ulQc%2BuQ29aZnvgcQB9uXT%2BxknXObirLAQgdEAEaDDcxMTY3NjUxMzc2NCIMTFXrgrPKZ36y%2FcMDKqgBnVLzlhB8%2B7a1ha8hnm%2BLGuC%2B5NzYw38gNtAv8sU4niAXSM1qF95pes4u870xmqawY8qIp25a1NPDPkvo3TqqrQJ5cajqK4bBVVaT7WHoI1AB%2BEzJhuxdS8%2FZnEqvBtuDB%2BYKAEIe3aquwCN1szorL3mNDESYB5ewL0pyp3EylXDEx04PYBmVcrQdCkYO3MCM%2Bl7pcqyFGz8cfQl3wQBs1jCQySfmMD3D2ZTssqLNarj06XIPO5YCB8FGc2nJfpkFf5Ex6mskSeG9Kz7hNjr746yDkbcgSpLcXcR4bsP3FgWQ9Rb%2FJgvgzE9Z276GZgID3IWNV%2Bg5YqZkYGNjX359ynqgZl3QJAgTnFJwfOKQz4%2BLjUjdBMkQVy5t32WCTh7OUefLbMNVvNIa%2FudHigie6BW4l1pHy5VMGsfRiDiZzhTy" }
{ "id": "47c2451a-8aa8-47eb-b5db-842dc770b53a", "startedAt": "Tue Mar 30 2021 19:03:57 GMT+0000 (Coordinated Universal Time)", "statusCode": 201, "statusDescription": "document created successfully", "calculationLogUrl": "https://advicement-prod-api-calls.s3.eu-west-1.amazonaws.com/test/blank-template/47c2451a-8aa8-47eb-b5db-842dc770b53a/output/log/calcLog.txt?AWSAccessKeyId=ASIA2LMZZZXSAJLLMJQE&Expires=1617134650&Signature=RIrZOv%2FsgDHPQlZHXsb9MOy1fBk%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEDMaCWV1LXdlc3QtMSJGMEQCIGyiE%2B6bndHbq8u9oFwUYfNgMGvXYfk8NCODxVs28gBUAiBdQ10r4eAUSbKi59ZJ6voXCFaTTGxZq03GecvWAXc8%2BSrUAQh8EAIaDDcxMTY3NjUxMzc2NCIMoXJCfr48DOjUdJnpKrEBLZ68%2BKA%2BmL3%2BnWvkDnRgWdiL5hSJPRD0vfzbPXMD%2FGa%2FX5%2BoM%2FUIAKx1bcT4g2OTHeNyOU227m6tSTkKXilPCHE4bBfIo2czG2ax3VC7Z1P9ReAfWNBz9nrRNRyXup6VI92f5iQBatWI7qF1dddQgPC9FPetNzpTGbbDKUnVoiK%2BN4kErI9XURdNBnsnxS3YR02M%2FVNb4y1PPTzYhPDHWsoHqVKddasdE3EY9xULe2yR8jvMKnsjYMGOuEBAJgoc0GSTKGWU3Im8lsliqx4iSvhsFMqpD08RkcjINcWPJHsZnJGxrg2gQ4zxRMojqdcA5wO8D%2BQkI0EzvJTiKoVhXzbC4fxx1tCL5g7beguIVeLIEvEUZon8moCHz36q4GiC9eoQ2%2BEAVcC7hAnygTndC4yRPPobeQZqqpasBZRbXUT8GihbhTZOmF2Ztksl0bI%2FwS6ICeITIPQIi1Gv1tQeyYTaRbMF%2BtAJNW5qJ0flvpDiWaPHH2HxaABCF4jZ71wx2lzduWOX0p2Uny%2Bl868KH5TLHEyq7cQi4Big2nY", "latexLogUrl": "https://advicement-prod-api-calls.s3.eu-west-1.amazonaws.com/test/blank-template/47c2451a-8aa8-47eb-b5db-842dc770b53a/output/log/inputFile.log?AWSAccessKeyId=ASIA2LMZZZXSAJLLMJQE&Expires=1617134650&Signature=NNvcz2Csp5I8Ky7BOysoIUvqI4M%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEDMaCWV1LXdlc3QtMSJGMEQCIGyiE%2B6bndHbq8u9oFwUYfNgMGvXYfk8NCODxVs28gBUAiBdQ10r4eAUSbKi59ZJ6voXCFaTTGxZq03GecvWAXc8%2BSrUAQh8EAIaDDcxMTY3NjUxMzc2NCIMoXJCfr48DOjUdJnpKrEBLZ68%2BKA%2BmL3%2BnWvkDnRgWdiL5hSJPRD0vfzbPXMD%2FGa%2FX5%2BoM%2FUIAKx1bcT4g2OTHeNyOU227m6tSTkKXilPCHE4bBfIo2czG2ax3VC7Z1P9ReAfWNBz9nrRNRyXup6VI92f5iQBatWI7qF1dddQgPC9FPetNzpTGbbDKUnVoiK%SDFS2BN4kErI9XURdNBnsnxS3YR02M%2FVNb4y1PPTzYhPDHWsoHqVKddE3EY9xULe2yR8jvMKnsjYMGOuEBAJgoc0GSTKGWU3Im8lsliqx4iSvhsFMqpD08RkcjINcWPJHsZnJGxrg2gQ4zxRMojqdcA5wO8D%2BQkI0EzvJTiKoVhXzbC4fxx1tCL5g7beguIVeLIEvEUZon8moCHz36q4GiC9eoQ2%2BEAVcC7hAnygTndC4yRPPobeQZqqpasBZRbXUT8GihbhTZOmF2Ztksl0bI%2FwS6ICeITIPQIi1Gv1tQeyYTaRbMF%2BtAJNW5qJ0flvpDiWaPHH2HxaABCF4jZ71wx2lzduWOX0p2Uny%2Bl868KH5TLHEyq7cQi4Big2nY", "documentUrl": "https://advicement-prod-api-calls.s3.eu-west-1.amazonaws.com/test/blank-template/47c2451a-8aa8-47eb-b5db-842dc770b53a/output/inputFile.pdf?AWSAccessKeyId=ASIA2LMZZZXSAJLLMJQE&Expires=1617134650&Signature=9Wmv5MufzjOiH0HNS3kswqwzKmk%3D&x-amz-security-token=IQoJb3JpZ2luX2VjEDMaCWV1LXdlc3QtMSJGMEQCIGyiE%2B6bndHbq8u9oFwUYfNgMGvXYfk8NCODxVs28gBUAiBdQ10r4eAUSbKi59ZJ6voXCFaTTGxZq03GecvWAXc8%2BSrUAQh8EAIaDDcxMTY3NjUxMzc2NCIMoXJCfr48DOjUdJnpKrEBLZ68%2BKA%2BmL3%2BnWvkDnRgWdiL5hSJPRD0vfzbPXMD%2FGa%2FX5%2BoM%2FUIAKx1bcT4g2OTHeNyOU227m6tSTkKXilPCHE4bBfIo2czG2ax3VC7Z1P9ReAfWNBz9nrRNRyXup6VI92f5iQBatWI7qF1dddQgPC9FPetNzpTGbbDKUnVoiK%2BN4kErI9XURdNBnsnxS3YR02M%2FVNb4y1PPTzYhPDHWsoHqVKddE3EY9xULe2yR8jvMKnsjYMGOuEBAJgoc0GSTKGWU3Im8lsliqx4iSvhsFFSMqpD08RkcjINcWPJHsZnJGxrg2gQ4zxRMojqdcA5wO8D%2BQkI0EzvJTiKoVhXzbC4fxx1tCL5g7beguIVeLIEvEUZon8moCHz36q4GiC9eoQ2%2BEAVcC7hAnygTndC4yRPPobeQZqqpasBZRbXUT8GihbhTZOmF2Ztksl0bI%2FwS6ICeITIPQIi1Gv1tQeyYTaRbMF%2BtAJNW5qJ0flvpDiWaPHH2HxaABCF4jZ71wx2lzduWOX0p2Uny%2Bl868KH5TLHEyq7cQi4Big2nY" }

Code Samples

In this section we will show you the response from the Advicement API from the request performed in the previous section.