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 270
2 REPLIES 2
Top Labels in this Space