Skip to main content

satusehat@1.1.2

Functions

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

The following functions are exported from the common adaptor:

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

get

get(path, params, callback) ⇒ Operation

Make a get request to any satusehat endpoint

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,
}
);