SharePoint Workflow Manager workflows allows creating workflows that communicate with the SharePoint objects through the REST API calls. End of the day a REST API is connected through the Client.svc endpoint of a particular site. Somehow there are situations I have experienced Cancellation of workflows due to the failures of REST calls.
There are instances where when you make too many REST API calls, a 429 HTTP Status Code is returned. I have explained this in one of my previous articles here. That is a carefully handled scenario of the Client.svc.
But there are some instances where we will not get the correct response or even an empty response. This is quite surprising at times but in reality, it just happens.
This is why we need to handle this from the workflow design logic. In my case, I have put a Do-While condition until the 'OK' response is received through the REST service. Also have included a time interval during the REST calls in order to avoid the unsuccessful calls.
Here is a little Pseudo-Code like set of steps.
- Do While Status Code is OK
- Make REST call using HTTPGet action.
- Wait for n amount of seconds.
- Continue to loop.
So has this worked? Yes it has. So far so good and no reason to fail.