Skip to main content

et-mfr@1.0.0

get(path, options)
post(path, body, options)
request(method, path, body, options)

This adaptor exports the following from common:

as()
assert()
combine()
cursor()
dataPath()
dataValue()
dateFns
each()
field()
fields()
fn()
fnIf()
group()
lastReferenceValue()
log()
map()
merge()
parseCsv()
scrubEmojis()
sourceValue()
util

Functions

get

get(path, options) ⇒ Operation

Make a GET request to Ethiopia MFR

ParamTypeDescription
pathstringPath to resource
optionsRequestOptionsOptional request options

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the HTTP server, including headers, statusCode, etc
referencesan array of all previous data objects used in the Job

Example: Get all regions

get('/Location/Regions');

Example: Get a facility with id

get('Facility', {
query: {
id: '1071644',
},
});

Example: Get all facility details matching a name

get('Facility/All', {
query: {
name: '010 Kombolcha Health Post',
},
});

post

post(path, body, options) ⇒ Operation

Make a POST request to Ethiopia MFR

ParamTypeDescription
pathstringPath to resource
bodyobjectObject which will be attached to the POST body
optionsRequestOptionsOptional request options

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the HTTP server, including headers, statusCode, etc
referencesan array of all previous data objects used in the Job

Example: Retrieve facilities with pagination

post('Facility/GetFacilities', {
pageNumber: 1,
showPerPage: 25,
});

Example: Retrieve facility details as CSV strings

post(
'Facility/ExportCSV',
{ name: '010 Kombolcha Health Post' },
{ parseAs: 'text' }
);

request

request(method, path, body, options) ⇒ Operation

Make a general HTTP request to Ethiopia MFR

ParamTypeDescription
methodstringHTTP method to use
pathstringPath to resource
bodyobjectObject which will be attached to the POST body
optionsRequestOptionsOptional request options

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the HTTP server, including headers, statusCode, etc
referencesan array of all previous data objects used in the Job

Example

request(
'POST',
'Facility/ExportCSV',
{ name: '010 Kombolcha Health Post' },
{ parseAs: 'text' }
);

Interfaces

HttpState

State object

Properties

NameDescription
datathe parsed response body
responsethe response from the HTTP server, including headers, statusCode, etc
referencesan array of all previous data objects used in the Job

RequestOptions

Options provided to the HTTP request

Properties

NameTypeDescription
bodyobjectbody data to append to the request.
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.