Skip to main content

satusehat@2.0.5

get(path, params, callback)
patch(path, data, params, [callback])
post(path, data, params, [callback])
put(path, data, params, [callback])

This adaptor exports the following from common:

alterState()
arrayToString()
combine()
dataPath()
dataValue()
each()
field()
fields()
fn()
fnIf()
http
lastReferenceValue()
merge()
sourceValue()

Functions

get

get(path, params, callback) ⇒ Operation

Make a GET request to Satusehat

ParamTypeDescription
pathstringPath to resource
paramsobjectOptional request params such as name.
callbackfunctionAn optional callback to handle the response

Example

get("Organization", {"name": "somename"})

patch

patch(path, data, params, [callback]) ⇒ Operation

Make a PATCH request to Satusehat

ParamTypeDescription
pathstringPath to resource and exact item to be partially updated
dataArrayAn array of objects which defines data that will be used to partially update a given instance of resource
paramsObjectOptional request params.
[callback]functionOptional callback to handle the response

Example

patch(
"Organization/123",
[{
"op": "replace", // Operation - `replace` is the only one used to change a specific property or element
"path": "/language", // Path - The name of property/element of resource to be replaced
"value": "id" // Value- The value to be replaced
}]

);

post

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

Make a POST request to Satusehat

ParamTypeDescription
pathstringPath to resource
dataobjectObject or JSON which defines data that will be used to create a given instance of resource
paramsObjectOptional request params.
[callback]functionOptional callback to handle the response

Example

post(
"Organization",
{ "resourceType": "Organization", "active": true,
}
);

put

put(path, data, params, [callback]) ⇒ Operation

Make a PUT request to Satusehat

ParamTypeDescription
pathstringPath to resource and exact item to be updated
dataobjectObject or JSON which defines data that will be used to update a given instance of resource
paramsObjectOptional request params.
[callback]functionOptional callback to handle the response

Example

put(
"Organization/123",
{ "resourceType": "Organization", "active": false,
}
);