Is it possible to cancel a sent API call?
Hello,
For some of our processes, we utilize a 3rd party that will make API calls to Smartsheet. Occasionally, the 3rd party claims that they don't receive a response back from Smartsheet, and the request will then timeout. They claim that when this timeout happens, they send a "cancellation request" to Smartsheet, and then re-submit the API call that timed out. Their assumption seems to be that when they send this cancellation request, Smartsheet should no longer process the timed-out call.
One of the issues, is that the first call actually seems to have processed fine on Smartsheet's end. So if the failing call is to add a row, the row is added, the 3rd party "cancels" the request, but then a second row is added when they resubmit the "failing" command. Obviously, duplicate rows can create a problem.
We've been going back and forth with the third party and Smartsheet on this for months, but my question on this post is this: Is there a method to cancel an API call that was made? The third party is using the C# SDK, and claims the timeout they're referring to is set by the "HttpClient Timeout via SmartSheetBuilder.SetHttpClient". I can't find anything in the API documentation to document a process to cancel a sent API call, but I also don't write in C#, so I'm not entirely sure how the SDK is functioning. My assumption is that it's not cancelling the sent API call, but just that the program using the SDK should stop waiting for a response once a timeout is reached.
Any insight that I can pass along to the third party support would be greatly appreciated.
Thank you!
Answers
-
From my experience it depends how they handle the timeouts/do error handling in general. I've written in Python to retry the call if I get a timeout error, or do other things depending on the error code I receive, but if I don't do that then it just times out and that's that, it's not going to keep trying over and over. It's hard to say without knowing more about what they're doing but I have never come across cancellation requests.
Depending on the context they could check for the row before retrying the push. I have never come across a situation where Smartsheet did not send a timeout code back to me, though, I find that very difficult to believe they simply receive nothing back. -
I don't think the API terminal will accept any cancel call, check the source code to be sure (github), now if the call is RESTFUL and the 3rd party developer is making a cancel call and there is no response, that means that either the server cannot handle the cancel call (this is what I think is the case) or the same issue that affected the first call is also affecting the cancel call, therefore, the only way to know if the transaction was completed is to query again. I've seen this happening in Rails too. (not in Python). I agree with erincarr as well.
Beware that re-query SS is not a fun thing to do, because performance and response times are not ideal. By experience I can tell that SS will force you to program in a not so standard way for some things, tell your 3rd party to re-query and end of the story. If you try to change SS API it won't happen any time soon.
-
Thank you both for your responses. I don't believe the third party is doing any querying between attempts to verify that the first attempt was/wasn't correctly processed. I'm not entirely sure what they're doing, and even if I did, I have very little hope of getting them to change what they're doing. However, I am hoping to nail down whether or not Smartsheet is even able to support a "cancellation request", as this is one of the items the third party is using to say it's a Smartsheet problem. If I can get a definite answer on whether or not this is supported, hopefully that will nip that reason in the bud.
To add to the confusion, I've had one Smartsheet support say they've never heard of this ability, and another say they think they have. Not only this, but Smartsheet support has said they don't see a reference to the first call happening in their logs, despite the row getting created and showing up in the sheet's activity log for each attempt the third party made.
But again, I can't find any documentation about it in the API docs, so my assumption is that the third party is misinterpreting what happens when the SDK hits a max timeout.
-
Anytime.
There is a chance, the 3RD party developer is trying to see SS as a transactional service, by definition, transactions can be cancelled and even reverted, while this could be possible in the backend (schema level transactions) I don't think SS has API support for transactional services.
On my own experience SS can be a little tricky, specially creating and deleting assets, but I can tell that it is possible to develop solutions using the timeouts and error responses you get. But any solution will be at the server pace not our own pace, neither at transactional level pace.
Just my two cents.
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.8K Get Help
- 434 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 65 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives