Designer Workflow Error With "Call HTTP Web Service" Action in SharePoint

When working on one of the workflow development tasks, it was required to have a web service call to fetch data from SharePoint. To do that I used a "Call HTTP web service" action but with that I was getting the following exception “Unable to de-serialize HTTP response content. Expected Content Type: 'application/json', 'text/plain' or 'text/html'”.



After struggling with this issue, the solution I used thought to share the solution with the developer community.

Solution: The reason for the issue is, by default response from SharePoint REST is in XML and the SharePoint designer workflow is not able to parse the XML and needs a JSON response. To resolve this issue we need to pass Accept and Content-Type as application/json;odata=verbose to request the headers. This way we will get a JSON response. To resolve this use the following procedure.

  1. Go to SharePoint 2013 designer.

  2. Build a Dictionary variable named "WSHearder".



  3. Add two values in the newly created dictionary.

    Accept = application/json;odata=verbose

    Content =Type = application/json;odata=verbose



  4. Now select a "Call HTTP web service" action and select Properties.



  5. Select the newly created dictionary variable as value for "".



  6. Press OK and publish the workflow.

Recommended Ebook

Getting Started with SharePoint Framework Development using TypeScript, PnP JS, and React JS

Download Now!
Similar Articles