Firestore batchGet does not work properly in Data Resource REST API Direct Integration

I ran the code below directly using Apps Script and the output is as expected. The HTTP request returns array with 2 items.

function getConv() {
try
{
var url = “https://firestore.googleapis.com/v1beta1/projects/valley-chat/databases/(default)/documents:batchGet”;
var params = {
method: “POST”,
contentType: ‘application/json’,
headers: {
Authorization: “Bearer <TOKEN_ID>”,
},
payload: JSON.stringify({
documents: [
“projects/PROJECT_ID/databases/(default)/documents/COLLECTION_ID/DOCUMENT_ID1”,
“projects/PROJECT_ID/databases/(default)/documents/COLLECTION_ID/DOCUMENT_ID2”
]
})
};
var res = UrlFetchApp.fetch(url, params);
Logger.log(res.getContentText());
return JSON.parse(res.getContentText());
}
catch(e)
{
Logger.log(e);
return;
}
}

However, when I integrate this to a data resource, I did not get the expected output.

Hi, what kind of error are you getting? I would double-check that you:

  1. Are configuring it for “Create record” (POST)
  2. Have configured the Authorization header correctly
  3. Are binding the payload object { documents: [ “projects/PROJECT_ID/databases/(default)/documents/COLLECTION_ID/DOCUMENT_ID1”, “projects/PROJECT_ID/databases/(default)/documents/COLLECTION_ID/DOCUMENT_ID2” ] } to “Record properties”

If you keep Chrome’s Network tab (right click → choose “Inspect”) open while testing the API calls on the Test tab in the data configurator, you’ll be able to see the requests you are sending and the responses you’re getting, they can also help in finding the issue.