How to timeout a REST request

We’ve noticed that sometimes requests made through the REST API can take a while to process, even very simple ones and in particular when doing a file upload (even if the file is just a few kB).

Since we lock the UI in our app until the clients receives a response, it leads to a poor UX if the user cannot do anything while they wait for the action to be completed. Is there a way to timeout the request such that it will be cancelled/throw an error if it’s taking too long?

Hi Juan,

Once a request is sent out, you can “cancel” it on the client-side by “abandoning” the request. There is no way to cancel it on the server since the server has already started executing the request.

Regards,
Mark

1 Like

Hey @mark-piller, I guess I was wondering whether the server has a timeout parameter that we might be able to set/modify, either as part of the request or directly from the console.

Yes, there is a timeout implemented on the server, I believe it is set to 2 minutes and is not configurable. Requests that take more than 2 minutes will be aborted by the server automatically.

2 Likes