Skip to main content

mojatax@1.0.0

post(path, data, options, [callback])
request(method, path, data, options, [callback])

This adaptor exports the following from common:

cursor()
dataPath()
dataValue()
dateFns
each()
field()
fields()
fn()
lastReferenceValue()
merge()
sourceValue()

Functions

post

post(path, data, options, [callback]) ⇒ Operation

Make a POST request to any Mojatax endpoint.

ParamTypeDescription
pathstringPath to resource
dataobjectObject which will be attached to the request body
optionsMojataxRequestOptionsOptional request options
[callback]functionOptional callback to handle the response

This operation writes the following keys to state:

State KeyDescription
dataThe response body (as JSON)
responseThe HTTP response from the Mojatax server (excluding the body)
referencesAn array of all previous data objects used in the Job

Example: Make a POST request to create an invoice

post("CreateInvoice", {
invoice_id: 'PID092',
customerId: '102',
items: [],
});

request

request(method, path, data, options, [callback]) ⇒ Operation

Make a general HTTP request against the Mojatax server.

ParamTypeDescription
methodstringHTTP method to use
pathstringPath to resource
dataobjectObject which will be attached to the POST body
optionsMojataxRequestOptionsOptional request options
[callback]functionOptional callback to handle the response

This operation writes the following keys to state:

State KeyDescription
dataThe response body (as JSON)
responseThe HTTP response from the Mojatax server (excluding the body)
referencesAn array of all previous data objects used in the Job

Example: Make a POST request to create an invoice

request("POST", "/client/CreateInvoice", {
invoice_id: 'PID092',
customerId: '102',
items: [],
});

Interfaces

MojataxRequestOptions

Options provided to Mojatax HTTP request

Properties

NameTypeDescription
bodyobject | stringbody data to append to the request. JSON will be converted to a string (but a content-type header will not be attached to the request).
errorsobjectMap of errorCodes -> error messages, ie, { 404: 'Resource not found;' }. Pass false to suppress errors for this code.
queryobjectAn object of query parameters to be encoded into the URL.
headersobjectAn object of headers to append to the request.
parseAsstringParse the response body as json, text or stream. By default will use the response headers.
timeoutnumberRequest timeout in ms. Default: 300 seconds.
tlsobjectTLS/SSL authentication options. See https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions