Skip to main content
Solved

Help with payload and Record ID

  • February 26, 2024
  • 2 replies
  • 43 views

Forum|alt.badge.img+4

HI, this is my code for my payload posting to a table using Google Apps Script:

 
var payload = JSON.stringify({
"records": [{
"fields": {
"OnlineSubmissionLink": [{ "id": linkedRecordID }], // Set the linked record field
// "SaleDate": formattedSaleDate,
// "SalePrice": donationAmount
 
},
"typecast": true
}]
});
 
My log says: Constructed Payload: {"records":[{"fields":{"OnlineSubmissionLink":[{"id":"recXE6yQpMi1NyWRx"}]},"typecast":true}]}
 
for my payload, but I'm getting this error:
 {"error":{"type":"INVALID_REQUEST_UNKNOWN","message":"Invalid request: parameter validation failed. Check your request data."}}
 
when I attempt to POST the Record ID into the linked record field. 
 
Sorry, I'm no expert so am struggling a bit. Any advice would be ssoooo welcome! 🙏

Best answer by kuovonne

Try using an array of the record ID "OnlineSubmissionLink": [linkedRecordID],, not an array of objects. The original web API takes an array of record IDs, not an array of objects (unlike Airtable scripting or the payload from a webhook).

2 replies

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • Answer
  • February 26, 2024

Try using an array of the record ID "OnlineSubmissionLink": [linkedRecordID],, not an array of objects. The original web API takes an array of record IDs, not an array of objects (unlike Airtable scripting or the payload from a webhook).


Forum|alt.badge.img+4
  • Author
  • New Participant
  • February 26, 2024

Try using an array of the record ID "OnlineSubmissionLink": [linkedRecordID],, not an array of objects. The original web API takes an array of record IDs, not an array of objects (unlike Airtable scripting or the payload from a webhook).


Thank you so much! Problem solved. 🙏