FHIR store is returning {} for data, using GET, POST, and .search (?)

---- .search not working

Google is not returning data from a search call. The Parent string is valid. the auth is valid. What’s incorrect about this? This should return Practitioners in the db as a bundle. I get {}

const parent = projects/${PROJECT_ID}/locations/${LOCATION}/datasets/${DATASET_ID}/fhirStores/${FHIR_STORE_ID};
const searchobj = {
parent: parent,
resourceType: “Practitioner”,
auth: auth,
};
const response = await healthcare.projects.locations.datasets.fhirStores.fhir.search(searchobj);

response is {“config”:{“url”:“https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-central1/datasets/COMBINE-FHIR-v1/fhirStores/1/fhir/_search?resourceType=Practitioner”,“method”:“POST”,“apiVersion”:“”,“userAgentDirectives”:[{“product”:“google-api-nodejs-client”,“version”:“7.2.0”,“comment”:“gzip”}],“headers”:{“x-goog-api-client”:“gdcl/7.2.0 gl-node/20.14.0”,“Accept-Encoding”:“gzip”,“User-Agent”:“google-api-nodejs-client/7.2.0 (gzip)”,“Authorization”:“Bearer --”},“params”:{“resourceType”:“Practitioner”},“retry”:true,“responseType”:“unknown”},“data”:{},“headers”:{“alt-svc”:“h3=":443"; ma=2592000,h3-29=":443"; ma=2592000”,“content-length”:“5951”,“content-type”:“application/fhir+json;charset=utf-8”,“date”:“Sun, 08 Sep 2024 23:48:45 GMT”,“server”:“ESF”,“vary”:“Origin, X-Origin, Referer”,“x-content-type-options”:“nosniff”,“x-frame-options”:“SAMEORIGIN”,“x-xss-protection”:“0”},“status”:200,“statusText”:“OK”,“request”:{“responseURL”:“https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-central1/datasets/COMBINE-FHIR-v1/fhirStores/1/fhir/_search?resourceType=Practitioner”}}

-------- POST not working
yikes, POST for searching the Google FHIR store also does not return any data.
const parent = projects/${PROJECT_ID}/locations/${LOCATION}/datasets/${DATASET_ID}/fhirStores/${FHIR_STORE_ID};
const searchurl = [https://healthcare.googleapis.com/v1/${parent}/fhir/PractitionerRole/_search](https://healthcare.googleapis.com/v1/${parent}/fhir/PractitionerRole/_search);
// const params = { ‘practitioner’: ‘30904792-995a-4551-b185-657d8e4ea08e’ }; // attempt to limit response to Roles of one Practitioner
const params ={}; //attempt to retrieve all PractionerRoles
const client = await auth.getClient();
const response = await client.request({
url: searchurl, // The URL must be passed as ‘url’
method: ‘POST’, // Use POST method for _search
params: params, // Pass the search parameters
headers: {
‘Content-Type’: ‘application/fhir+json’, // Set header for FHIR
}
});
no data in the response :
{“config”:{“url”:“https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-central1/datasets/COMBINE-FHIR-v1/fhirStores/1/fhir/PractitionerRole/_search”,“method”:“POST”,“params”:{},“headers”:{“Content-Type”:“application/fhir+json”,“Authorization”:“Bearer --”,“User-Agent”:“google-api-nodejs-client/9.14.1”,“x-goog-api-client”:“gl-node/20.14.0”},“responseType”:“unknown”},“data”:{},“headers”:{“alt-svc”:“h3=":443"; ma=2592000,h3-29=":443"; ma=2592000”,“content-length”:“6150”,“content-type”:“application/fhir+json;charset=utf-8”,“date”:“Mon, 09 Sep 2024 00:47:33 GMT”,“server”:“ESF”,“vary”:“Origin, X-Origin, Referer”,“x-content-type-options”:“nosniff”,“x-frame-options”:“SAMEORIGIN”,“x-xss-protection”:“0”},“status”:200,“statusText”:“OK”,“request”:{“responseURL”:“https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-central1/datasets/COMBINE-FHIR-v1/fhirStores/1/fhir/PractitionerRole/_search”}}

— GET not working either.
Note that this search string works in the Google Healthcare FHIR viewer , also note that there is no _search in this… (?)
https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-central1/datasets/COMBINE-FHIR-v1/fhirStores/1/fhir/PractitionerRole?practitioner=30904792-995a-4551-b185-657d8e4ea08e
So therefor a GET request should work…
so.. refactoring to :
const practitionerId = ‘30904792-995a-4551-b185-657d8e4ea08e’;
const searchUrl = [https://healthcare.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION}/datasets/${DATASET_ID}/fhirStores/${FHIR_STORE_ID}/fhir/PractitionerRole?practitioner=${practitionerId](https://healthcare.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION}/datasets/${DATASET_ID}/fhirStores/${FHIR_STORE_ID}/fhir/PractitionerRole?practitioner=${practitionerId)};
const client = await auth.getClient();
const response = await client.request({
url: searchUrl, // The URL with query parameters
method: ‘GET’, // Use GET method for search with query parameters
headers: {
‘Accept’: ‘application/fhir+json’, // Request FHIR in JSON format
}
});

response has no data (ugh) :thinking: , even though the url is exactly like the one that works in the Google FHIR store explorer:
[https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-centr[…](https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-centr[…)]erRole?practitioner=30904792-995a-4551-b185-657d8e4ea08e
{“config”:{“url”:“https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-central1/datasets/COMBINE-FHIR-v1/fhirStores/1/fhir/PractitionerRole?practitioner=30904792-995a-4551-b185-657d8e4ea08e”,“method”:“GET”,“headers”:{“Accept”:“application/fhir+json”,“Authorization”:“Bearer --”,“User-Agent”:“google-api-nodejs-client/9.14.1”,“x-goog-api-client”:“gl-node/20.14.0”},“responseType”:“unknown”},“data”:{},“headers”:{“alt-svc”:“h3=":443"; ma=2592000,h3-29=":443"; ma=2592000”,“content-length”:“2455”,“content-type”:“application/fhir+json;charset=utf-8”,“date”:“Mon, 09 Sep 2024 01:08:23 GMT”,“server”:“ESF”,“vary”:“Origin, X-Origin, Referer”,“x-content-type-options”:“nosniff”,“x-frame-options”:“SAMEORIGIN”,“x-xss-protection”:“0”},“status”:200,“statusText”:“OK”,“request”:{“responseURL”:“https://healthcare.googleapis.com/v1/projects/combine-fhir-smart-store/locations/us-central1/datasets/COMBINE-FHIR-v1/fhirStores/1/fhir/PractitionerRole?practitioner=30904792-995a-4551-b185-657d8e4ea08e”}}
something else must be wrong…

Hello,

Thank you for contacting the Google Cloud Community.

Ensure that the Cloud Dataflow API is enabled for your project. You can do this in the API Library section of the Google Cloud Console.

I have gone through your reported issue, however it seems like this is an issue observed specifically at your end. It would need more specific debugging and analysis. To ensure a faster resolution and dedicated support for your issue, I kindly request you to file a support ticket by clicking here. Our support team will prioritize your request and provide you with the assistance you need.

For individual support issues, it is best to utilize the support ticketing system. We appreciate your cooperation!

Hello Jaia, thanks for the response. I will use the ticket system. Very good.

The solution here was to realize that data was being returned, but as a Blob rather than a JSON object. So I process through

// Handle blob responses (for some APIs that return blob)
export const handleBlobResponse = async (responseData) => {
if (responseData && responseData[Symbol.toStringTag] === ‘Blob’) {
const buffer = await responseData.arrayBuffer();
return JSON.parse(Buffer.from(buffer).toString(‘utf-8’));
} else if (typeof responseData === ‘object’ && responseData !== null) {
return responseData;
} else {
throw new Error(‘Unexpected response type’);
}
};