Skip to content
Open
Changes from 1 commit
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
16 changes: 14 additions & 2 deletions healthcare/fhir/patchFhirResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function main(
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
}),
headers: {'Content-Type': 'application/json-patch+json'},
responseType: 'json',
});

async function patchFhirResource() {
Expand All @@ -50,8 +51,19 @@ function main(
requestBody: patchOptions,
};

await healthcare.projects.locations.datasets.fhirStores.fhir.patch(request);
console.log(`Patched ${resourceType} resource`);
try {
const resource =
await healthcare.projects.locations.datasets.fhirStores.fhir.patch(
request
);
console.log(`Patched ${resourceType} resource`);
console.log(JSON.stringify(resource.data, null, 2));
} catch (error) {
console.error(
`Error patching ${resourceType} resource:`,
error.message || error
);
}
}

patchFhirResource();
Expand Down
Loading