Skip to content

Template

Workflow and activity templates.

Endpoints

EndpointArgumentsReturns
v3.template.createtemplate: { description: string, global: boolean, processId?: string, configuration: any }HailerResult
v3.template.deletetemplateId: stringboolean
v3.template.gettemplateId: stringunknown
v3.template.listprocessId?: stringany[]
v3.template.previewdata: { activityId: string, templateId: string }unknown
v3.template.updateupdate: { templateId: string, description?: string, global?: boolean, processId?: string, configuration?: any }boolean

v3.template.create

Description

Create document template. Returns created template

Parameters

Argument 1 (object, optional):

FieldTypeRequiredDescription
descriptionstringnoDescription what this template is doing
globalbooleanyesIf global, allow all processes to use the template
fileTypeanyyesAllowed filetypes: pdf, csv
contentstringyesScript to generate pdf, csv from
ownerCidsObjectId[]noNetworkIds for those who are allowed to edit template
configurationobjectnoconfiguration. Configuration for template. This will be copied to process.documentTemplates
processIdObjectIdnoProcess Id to which this template belongs
cidObjectIdnoNetwork to which this template belongs

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.template.create', [
  {
    global: false, // If global, allow all processes to use the template
    fileType: '...', // Allowed filetypes: pdf, csv
    content: 'string', // Script to generate pdf, csv from
  },
]);
console.log(result);

Returns

HailerResult

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, debug? }.

v3.template.delete

Description

Delete document template. Returns true if OK

Parameters

Argument 1 (ObjectId, required): templateId

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.template.delete', [
  '507f1f77bcf86cd799439011', // ObjectId (required)
]);
console.log(result);

Returns

boolean

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, debug? }.

v3.template.get

Description

Get document template by id

Parameters

Argument 1 (ObjectId, required): templateId

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.template.get', [
  '507f1f77bcf86cd799439011', // ObjectId (required)
]);
console.log(result);

Returns

Undocumented

The return value is not described in the source yet.

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, debug? }.

v3.template.list

Description

List templates

Parameters

Argument 1 (ObjectId, optional): processId

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.template.list', [
  '507f1f77bcf86cd799439011', // ObjectId
]);
console.log(result);

Returns

Array of any.

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, debug? }.

v3.template.preview

Description

Get preview data for document template by activityId

Parameters

Argument 1 (object, optional):

FieldTypeRequiredDescription
activityIdactivityIdyesId of activity
templateIdObjectIdyesId of template

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.template.preview', [
  {
    activityId: '507f1f77bcf86cd799439011', // Id of activity
    templateId: '507f1f77bcf86cd799439011', // Id of template
  },
]);
console.log(result);

Returns

Undocumented

The return value is not described in the source yet.

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, debug? }.

v3.template.update

Description

Update document template. Returns updated document template

Parameters

Argument 1 (object, optional):

FieldTypeRequiredDescription
templateIdObjectIdyesId of template
descriptionstringnoDescription what this template is doing
globalbooleannoIf global, allow all processes to use the template
fileTypeanynoAllowed filetypes: pdf, csv
contentstringnoScript to generate pdf, csv from
ownerCidsObjectId[]noNetworkIds for those who are allowed to edit template
configurationobjectnoconfiguration. Configuration for template. This will be copied to process.documentTemplates
processIdObjectIdnoProcess Id to which this template belongs
cidObjectIdnoNetwork to which this template belongs

Example

javascript
const { Client } = require('@hailer/cli');

const client = await Client.create({
  host: 'https://api.hailer.com',
  username: 'you@example.com',
  password: '••••••',
});

const result = await client.request('v3.template.update', [
  {
    templateId: '507f1f77bcf86cd799439011', // Id of template
  },
]);
console.log(result);

Returns

boolean

Auth: requires an authenticated session.

Errors: on failure returns the standard Hailer error object { code, msg, details?, debug? }.

Hailer Developer Documentation