I’m posting queries (that I know are correct) to “https://api.monday.com/v2” using “fetch” in Javascript. Method, headers and body are all good. But only my first post works (it returns what it should).
I can’t post more than one. The next one (milliseconds later) returns a 500 error. I’ll be needing to sequentially post hundreds.
Here’s the code:
fetch(“https://api.monday.com/v2”,{
method: ‘post’,
headers: {“Authorization”: “<%=strToken %>”,
“Accept”: “application/json”,
“Content-type”: “application/json”},
body: myJSON})
.then(
function(response) {
if (response.status !== 200) {
console.log('Problem! Status code: "+ response.status);
return;
}
response.json().then(function(data) {
console.log(data);
});
}
)
.catch(function(err) {
console.log('Fetch Error: ', err);
});
I’ve also tried with a simple request, using:
oRequest = new XMLHttpRequest();
oRequest.open(“POST”,“https://api.monday.com/v2”, false);
oRequest.setRequestHeader(“Authorization”, “<%=strToken %>”);
oRequest.setRequestHeader(“Content-Type”, “application/json”);
oRequest.setRequestHeader(“Accept”, “application/json”);
oRequest.onreadystatechange = mondayUpdatePost;
oRequest.send(myJSON);
Same results. 500 error after the first one.
Anybody?