Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions healthcare/fhir/searchFhirResourcesPost.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,24 @@ const main = (
// Patient with the last name "Smith", set resourceType to "Patient" and
// specify the following params:
// params = {'family:exact' : 'Smith'};
const client = await auth.getClient();
const response = await client.request({url, method: 'POST', params});
const resources = response.data.entry;
console.log(`Resources found: ${resources.length}`);
console.log(JSON.stringify(resources, null, 2));

try {
const client = await auth.getClient();
const response = await client.request({
url,
method: 'POST',
params,
responseType: 'json',
});
const resources = response.data.entry;
console.log(`Resources found: ${resources.length}`);
console.log(JSON.stringify(resources, null, 2));
} catch (error) {
console.error(
`Error searching ${resourceType} resources:`,
error.response ? error.response.data : error.message
);
}
};

searchFhirResourcesPost();
Expand Down
Loading