Hi there,
I have some problems in invoking the API to add a record to the table User Settings in my App (this is not the built-in User Settings table, instead it has been created by me).
I am getting a 404 error resource not found.
Note that the App, being a prototype, hasnโt been deployed yet. Should I?
Here my JS code (I have replaced {AppId} with my Appโs ID and {AccessKey} with my Appโs Access Key):
var apiUrl = 'https://api.appsheet.com/api/v2/apps/{AppID}/User%20Settings/Add';
var payload = {"Action": "Add","Rows": [{"Language": "bc9f3548", "Rental Point": "48d86e98"}]} ;
var options = {
'headers' : {'ApplicationAccessKey' : '{AccessKey}',
'Content-type': 'application/json;charset=UTF-8'
},
'method' : 'POST',
'payload' : JSON.stringify(payload)
};
fetch(apiUrl, options)
It is applicationAccessKey
(lowercase โaโ at the beginning, not uppercase).
Whatโs up with the โ{AccessKey}โ part? I assume this is just a placeholder so youโre not exposing your key to everyone here? Just want to make sure youโre not using curly braces there.
It has been a while since Iโve experimented with it, but you might need the โPropertiesโ object in your payload. I just use:
"Properties": {
"Locale": "en-US",
}
Thanks for the attention, @Marc_Dillon
Changed to lowercase the โaโ in applicationAccessKey
, but didnโt help.
Yes: {AccessKey}
is a placeholder, I am not using curly braces there. However I do put the key in the request header.
I also added the Properties dictionary, but didnโt help either.
I fear it might be something related to cross-origin resource sharing (CORS), but I have to study more before figuring it outโฆ
Now I am testing the JS snippet in a static webpage. In the future, it will be hosted in a website, and I think Iโll need to put some attention to this.
Maybe I found the reason. Tried to integrate my App with Zapier, and I got this from Zapier:
So one of my initial guesses was correct: my App is not enabled to accept API requests. Is there anybody in the AppSheet Team that can help me on this? Should I deploy the app?
Thanks!
Hello,
Any updates on this ? Did you manage to make it work ?
Thanks,
User | Count |
---|---|
40 | |
34 | |
29 | |
23 | |
17 |