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.
Param | Type | Description |
---|---|---|
path | string | Path to resource |
params | object | Optional object of query parameters to include in the request |
callback | function | An optional callback to handle the response |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | The response body (as JSON) |
response | The HTTP response from the Satusehat server (excluding the body) |
references | An 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.
Param | Type | Description |
---|---|---|
path | string | Path to resource and exact item to be partially updated |
data | Array | An array of objects which defines data that will be used to partially update a given instance of resource |
params | Object | Optional object of query parameters to include in the request. |
[callback] | function | Optional callback to handle the response |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | The response body (as JSON) |
response | The HTTP response from the Satusehat server (excluding the body) |
references | An 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.
Param | Type | Description |
---|---|---|
path | string | Path to resource |
data | object | JSON FHIR object to create a resource |
params | Object | Optional object of query parameters to include in the request |
[callback] | function | Optional callback to handle the response |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | The response body (as JSON) |
response | The HTTP response from the Satusehat server (excluding the body) |
references | An 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.
Param | Type | Description |
---|---|---|
path | string | Path to resource and exact item to be updated |
data | object | JSON FHIR object to update the resource |
params | Object | Optional object of query parameters to include in the request |
[callback] | function | Optional callback to handle the response |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | The response body (as JSON) |
response | The HTTP response from the Satusehat server (excluding the body) |
references | An 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 });