Update service using JS


I am trying to run an update service of a collection in a database using JS, but for some reason I am receiving 2 errors:

OPTIONS https://api.appery.io/rest/1/db/colle... 400 (Bad Request)

Access to XMLHttpRequest at 'https://api.appery.io/rest/1/db/colle...' from origin 'https://appery.io' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

My collection is set as a secure collection, so I am passing the user's SessionToken. I want to change a specific cell in the database which is of type Boolean. My code looks as follows (where "Id" is the row Id and "to_Update" is the column name):

body: {
where: {_id:'"'+Id+'"'},
operations : {$set: {to_Update: true} }
"X-Appery-Database-Id": "5b8f9b99##########",
"X-Appery-Session-Token": localStorage.getItem("sessionToken")
success: onSuccess,
error: onError

Any idea what I might be doing wrong? (I already looked at these topics - https://getsatisfaction.com/apperyio/... )

1 person has
this question