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.
The compile resource has only one end point and it uses the POST method.
.../templates/{templateToken}/compile?...
The templateToken are required path parameters and can be found in the settings page of your template.
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.
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.
The response settings deal with what happens to the document once it has been created and the various option to receive the document.
.../templates/98765/compile?doc-delivery-type={docDeliveryType}&...
The docDeliveryType is a string parameter and can take the following values:
.../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.
The compilation parameters set the options on how the document is compiled with latex and provide various options.
.../templates/98765/compile?latex-compiler={latexCompiler}&...
The latexCompiler parameter can take the following values:
.../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.
.../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.
.../templates/98765/compile?ignore_errors={ignoreErrors}&...
The ignoreErrors is a boolean parameter indicates whether the document can be complied with errors. If the paramter is set to true the pdf will be produced with error messages. If the parameter is set to false and there are errors, the document will not be produced.
.../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.
.../templates/98765/compile?doc-file-name-json-key={docFileNameJsonKey}&...
The docFileNameJsonKey is a string parameter which identifies the location of a string in the JSON payload to use and name the pdf document after compilation. For example it can be the following value: client.clientID.
The document will be named according to the docFileNameJsonKey parameter. If this parameter is not present or the string in the data.json cannot be located, then the document will be named according to the docFileName parameter. If this parameter is not present, then the document name will keep the name of the compiled tex file.
The pdf security settings deal with whether the pdf should be encrypted and the settings of the password.
.../templates/98765/compile?encrypt-type={encryptType}&...
The encryptType parameter can take the following values:
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.
In this section we will show you an example of a request to the Advicement API.
.../templates/98765/compile?url-expiration=3600&debug-mode=true&num-compilations=1
Key | Value |
---|---|
url-expiration | 3600 |
debug-mode | true |
num-compilations | 1 |
In this section we will show you the response from the Advicement API from the request performed in the previous section.