How to know which items have been failed to update due to time error in an API call

I have 20 items to be updated via one API call, sometimes it run successfully and sometime it give me time out error after one minute of execution, I noticed that even it give time out error it updates some items, I want to know what items it exactly updated, or what items it failed to update, is there any way to know this information?

Assuming you’re making one request per item, and not multiple items per request, then you know by virtue of which request failed.

This is why I never use multiple mutations per request, and just execute 20 requests in parallel. Much easier to handle errors.

1 Like

I am updating 20 items in one call.

In that case you will likely be told the name of the mutation (since with multiple mutations in one call you have to name them) in the error which you will need to parse out manually from the error messages.

This is Javascript, will be different if you’re using another language of course…

This is why I only make one update per call, i can always use await Promise.allSettled([promises]) and handle each one separately. It also means I don’t need code to build a query string from the source data, and I can just use one query with variables. The Promise.all method actually improves apparent performance because the monday API resolver processes each mutation in the query one at a time. Promise.all() will let them process asynchronously then process the results when they are all done.

1 Like

How could I get an error message from the call?

These are returned in the body of the response. Most calls return with an HTTP 200 code, but then contain the errors (in the formats in that link) for handling. The best way to check if there are errors is by checking if “data” exists - it won’t exist if there is an error. Then you know to look at errors.

1 Like

Thank you @Cody, you solved my problem. I appreciate it.

1 Like