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

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.

1 Like