Appsheet API Call Doesn't add records to table

Hello,

I’ve tried using javascript to add rows to a table, but it won’t work.
The Key Column has initial value (UNIQUEID())
All other colu

Here’s my code :

function myFunction() {

//Create Lines in RELATION_TABLE_PAGE_COLLECTION (EN CONSTRUCTION)
const response_appsheet = UrlFetchApp.fetch(‘https://api.appsheet.com/api/v2/apps/{appID}/tables/RELATION_TABLE_PAGE_COLLECTION/Action’, {
method: ‘POST’,
headers: {
‘applicationAccessKey’: ‘{applicationAccessKey}’,
‘contentType’: ‘application/json’
},
payload: {
“Action”: “Add”,
“Rows”: [
{

“collection_ID/title_ID”: “collectionid”

}
]
}
});

Logger.log(response_appsheet);
Logger.log(response_appsheet.getResponseCode());

}

The response code is 200 meaning it’s a success, but nothing is added to my table.

Any insights on this ?

Thank you,

You tested this using another tool like Postman or VSCode Thunder client?

1 Like

Your payload needs to be stringify’d.

1 Like

Thank you Marc_for the anwser,
I already tried with a stringifyed payload but I have the same result :confused:

Hello,

No I haven’t but I want to use the code in a javascript step within an automation.

I have the same problem. Then, I go to Manage → Monitor tag-> Audit History → Launch log analyzer. Here will log all REST API calls. You can check the failed API call and what is it missing. I hope this can help you :slightly_smiling_face:

3 Likes