Posting multiple queries

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?

1 Like

Hey @enlightened,

Would you mind posting an example of some of the queries you are trying to run, as well as any errors it may return along with the 500 error? I’ll check in with the team and look into it.

-Daniel

mutation { change_column_value (board_id:218918653, item_id:218627573, column_id: “text21”, value: ““John Q Doe”” ) {id name}}

but it removed a slash “” before the "'s before John D Doe and immediately after. You can’t paste slashes into this text area. That’s problem.

Got it working! The issue was a hidden CRLF in the value. Now I’m filtering everything with a regular expresssion (RegExp) to make sure my string are clean before I attempt to post them.

2 Likes

Hey @enlightened,

Good catch!! I’m glad that did the trick - hope this helps others in the community who might run into this in the future as well. If you have any other questions please let us know.

-Daniel