Add row from app script in app

Hello,
I am from a non technical background, i wrote a code in app script to add a row in my poshest AppSheet Audit Log shows this error -

Action Details
Email Details
REST API:
{
โ€œActionโ€: โ€œโ€˜Actionโ€™ is missing.โ€,
โ€œPropertiesโ€: {},
โ€œRowsโ€:
}

Properties:
{
โ€œRestAPIVersionโ€: 2,
โ€œTableNameโ€: โ€œAPIBOTโ€,
โ€œAppTemplateVersionโ€: โ€œ1.001222โ€,
โ€œErrorsโ€: โ€œโ€˜Actionโ€™ is missing.โ€,
โ€œAppTemplateNameโ€: โ€œ4d0e346f-17c7-4b2b-bf84-20***6983ca6โ€,
โ€œOperationโ€: โ€œREST API invokeโ€,
โ€œRecordTypeโ€: โ€œStartโ€,
โ€œResultโ€: โ€œFailureโ€
}

Here is my app script codeโ€“

function myFunction() {
let data = {
โ€œActionโ€: โ€œAddโ€,
โ€œPropertiesโ€: {
โ€œLocaleโ€: โ€œen-INโ€,
โ€œLocationโ€: โ€œ47.623098, -122.330184โ€,
โ€œTimezoneโ€: โ€œPacific Standard Timeโ€,
โ€œUserSettingsโ€: {
โ€œOption 1โ€: โ€œvalue1โ€,
โ€œOption 2โ€: โ€œvalue2โ€
}
},
โ€œRowsโ€: [
{
โ€œCOUNT1โ€: โ€œ1โ€

}

]
};

const params = {
โ€˜methodโ€™: โ€˜POSTโ€™,
โ€˜payloadโ€™: JSON.stringify(data),
}

const res = UrlFetchApp.fetch(โ€˜https://api.appsheet.com/api/v2/apps/4d6f-17c7-4b2b-bf84-200c3ca6/tables/APIBOT/Action?applicationAccessKey=V2-oK**s-9hthE-5nGku-GXjrq-erleI-S****-E7J04-t0hdIโ€™, ****ms)
// CONST res = UrlFetchApp.fetch(โ€˜URL Fetch Service | Apps Script | Google Developersโ€™);

Logger.log(res.getContentText());
}

It will be a great help if someone can correct my code

0 2 269
2 REPLIES 2

Can someone please reply this.

This isnโ€™t a Google Apps Scripts forum, so you canโ€™t expect much help in that regards.

I donโ€™t see any glaring issues with your code, but it is also incredible hard to read in the format that you have posted, Iโ€™d advise utilizing markdown to make it easier to read.

Top Labels in this Space