Node.js client API for Applidok
This Node.js API allows to call PDF templating features exposed by Applidok.
Get started
This package can be installed as NPM package: npm install applidok
Then applidok
module can be required in your Node.js code: var applidok = require("applidok")
The main function to merge data (e.g. form submission) with PDF template managed on Applidok is applidok.merge
:
var applidok = ; applidok;
Example
Some examples using this module are available in the repository: see simple example.
var applidok = ; applidok;
API reference
The module is exposing following Applidok functions.
merge
.merge(options)
: Merge values with specified template;
Object options
is expecting following properties.
token
: Applidok application token (string
).template
: ID of Applidok template (string
).parameters
: Name/value pairs to be merged with areas (object
).success
: Success callback, is given a HTTP response as argument; Optional function, if undefined default handler (console.log
) is used.error
: Error callback, is given HTTP error code (int) as argument; Optional function, if undefined default handler (console.error
) is used.
Application token and template ID are visible in Integration tab on Template screen of Applidok management.
See code sample
auth
.auth(options)
: Authenticate and get the administration token to be able to manage the corresponding Applidok account.
email
: Applidok login (string
).password
: Applidok password (string
, cleartext)success
: Success callback, is given the admin token as argument; Optional, if undefined default handler (console.log) is used.- error: Error callback, is given error details as argument (e.g.
{'code':123, 'cause':"Error cause"}
; Optional, if undefined default handler (console.error) is used.
See code sample
Template list
.templateList(options)
: List the templates of Applidok account specified by the given administration token.
var dok = ; dok; The success handler is given an object with following properties ```javascript{ "token": "app_token", "activePlan": { "credits":1 }, "templates": [ { "id": "tmpl-1", "name": "Template #1", "expiration":1418833775372 }, { "id": "tmpl-2", "name": "Second template" }, { "id": "tmpl-3", "name": "The third one" }, { "id": "tmpl-4", "name": "Template #4", "expiration":1418228986489, "trial":true } ]}