openlmis@1.0.7
- get(path, options, [callback])
- post(path, body, [callback])
- put(path, body, [callback])
- request(method, path, body, options, [callback])
This adaptor exports the following from common:
- cursor()
- dataPath()
- dataValue()
- dateFns
- each()
- field()
- fields()
- fn()
- fnIf()
- lastReferenceValue()
- merge()
- sourceValue()
Functions
get
get(path, options, [callback]) ⇒ Operation
Send a GET request to OpenLMIS
Param | Type | Description |
---|---|---|
path | string | Path to resource (relative to the base URL defined in configuration) |
options | RequestOptions | Optional request options |
[callback] | function | Optional callback to handle the response |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the HTTP server, including headers, statusCode, body, etc |
references | an array of all previous data objects used in the Job |
Example: Get all supplyLines
get("/supplyLines");
post
post(path, body, [callback]) ⇒ Operation
Send a POST request to OpenLMIS
Param | Type | Description |
---|---|---|
path | string | Path to resource (relative to the base URL defined in configuration) |
body | object | Object which will be attached to the POST body |
[callback] | function | Optional callback to handle the response |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the HTTP server, including headers, statusCode, body, etc |
references | an array of all previous data objects used in the Job |
Example: Creates new program
post("/programs", { name: "Bukayo", code: "abc" });
put
put(path, body, [callback]) ⇒ Operation
Send a PUT request to OpenLMIS
Param | Type | Description |
---|---|---|
path | string | Path to resource (relative to the base URL defined in configuration) |
body | object | Object which will be attached to the PUT body |
[callback] | function | Optional callback to handle the response |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the HTTP server, including headers, statusCode, body, etc |
references | an array of all previous data objects used in the Job |
Example: Update existing program
put("/programs/123", { name: "DigTalent", code: "123" });
request
request(method, path, body, options, [callback]) ⇒ Operation
Send a HTTP request to OpenLMIS
Param | Type | Description |
---|---|---|
method | string | HTTP method to use |
path | string | Path to resource (relative to the base URL defined in configuration) |
body | object | Object which will be attached to the POST body |
options | RequestOptions | Optional request options |
[callback] | function | Optional callback to handle the response |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the HTTP server, including headers, statusCode, body, etc |
references | an array of all previous data objects used in the Job |
Example
request("POST", "/programs", { name: "WSH", code: "123" });
Interfaces
RequestOptions
Options provided to the HTTP request
Properties
Name | Type | Description |
---|---|---|
body | object | body data to append to the request. |
query | object | An object of query parameters to be encoded into the URL. |
headers | object | An object of headers to append to the request. |