Hello Folks,
I am trying to fill in collection properties using Web flow CMS API.
I have JavaScript code and sending post request to CMS api to add an item into CMS collection.
I am getting CORS issue.
On the other hand if I invoke same URL along with identical body items are getting created into the collection.
Does webflow cms api support javascript post requests?
Here is the code
var data ={“_archived”: false,
“_draft”: false,
“name”:“test eb request”,
“price”: 200,
“description”:“test”,
“offerings”: “5f7c9b303c8dba2400432fb8”,
“slug”:“test web 1”
};
$.ajax({
type:“POST”,
url:“https://api.webflow.com/collections/5f9048f656d14c0f6369cf99/items”,
beforeSend: function(xhr) {
xhr.setRequestHeader(“Authorization”, "Bearer " + window.btoa(“api key”));
},
data: JSON.stringify(data),
contentType: ‘application/json’,
acceptVersion:‘1.0.0’,
success: function(res) {
console.log(res);
console.log(“Added”);
}.bind(this),
error: function(xhr, status, err) {
console.error(xhr, status, err.toString());
}.bind(this)
});
Here is my site Read-Only: LINK
(how to share your site Read-Only link)