Skip to main content

satusehat@2.0.6

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. Use this to fetch resources directly from the Satusehat REST API. You can pass Satusehat query parameters as an object of key value pairs, which will map to parameters in the URL.

ParamTypeDescription
pathstringPath to resource
paramsobjectOptional object of query parameters to include in the request
callbackfunctionAn optional 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 Satusehat server (excluding the body)
referencesAn array of all previous data objects used in the Job

Example: Get a resource by Id. Equivalent to GET <baseUrl>/Organization/abcde

get("Organization/abcde")

Example: Get resources with a query. Equivalent to GET <baseUrl>/Patient?identifier=https://fhir.kemkes.go.id/id/nik|9271060312000001

get('/Patient', {
identifier:'https://fhir.kemkes.go.id/id/nik|9271060312000001'
});

patch

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

Make a PATCH request to Satusehat. Use this to directly update resources on Satusehat REST API. You can pass Satusehat an array of objects which contains op, path, and value as the body. You can also pass Satusehat query parameters as an object of key value pairs, which will map to parameters in the URL.

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 object of query parameters to include in the request.
[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 Satusehat server (excluding the body)
referencesAn array of all previous data objects used in the Job

Example: Update a property of a resource. Equivalent to PATCH <baseurl>/Organization/abcde

patch('Organization/abcde', [
{
op: 'replace',
path: '/language', // Name of property/element of resource to be replaced
value: 'id', // Value to be replaced
},
]);

post

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

Make a POST request to Satusehat. Use this to send resources directly to Satusehat REST API. You can pass Satusehat body data as a JSON FHIR object.

ParamTypeDescription
pathstringPath to resource
dataobjectJSON FHIR object to create a resource
paramsObjectOptional object of query parameters to include in the request
[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 Satusehat server (excluding the body)
referencesAn array of all previous data objects used in the Job

Example: Create an encounter resource. Equivalent to POST <baseUrl>/Encounter

post('Encounter', { resourceType: 'Encounter', ...state.data });

put

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

Make a PUT request to Satusehat. Use this to directly update resources on Satusehat REST API. You can pass Satusehat body data as a JSON FHIR object. You can also pass Satusehat query parameters as an object of key value pairs, which will map to parameters in the URL.

ParamTypeDescription
pathstringPath to resource and exact item to be updated
dataobjectJSON FHIR object to update the resource
paramsObjectOptional object of query parameters to include in the request
[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 Satusehat server (excluding the body)
referencesAn array of all previous data objects used in the Job

Example: Update a resource. Equivalent to PUT <baseurl>/Organization/abcde

put('Organization/abcde', { resourceType: 'Organization', active: false });