JavaScript API Call not working

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)
0 4 439
4 REPLIES 4

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:

3X_0_2_022483af8300c8ed3087c6b475d192d9c002c650.png

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,

Top Labels in this Space