Archive

Posts Tagged ‘Expected Content Type: ‘application/json’’

SharePoint 2013: Designer workflow error with ‘Call HTTP web service’ action

February 17, 2015 4 comments

While working on one of the workflow development task, it was required to have a web service call to fetch data from SharePoint. To achieve that I used ‘Call HTTP web service’ action but with that I was getting following exception “Unable to deserialize HTTP response content. Expected Content Type: ‘application/json’, ‘text/plain’ or ‘text/html’”.

Suspended

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

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

  1. Go to SharePoint 2013 designer.
  2. Build a Dictionary variable named ‘WSHearder’WF1
  3. Add two values in newly created dictionary
Accept = application/json;odata=verbose
Content-Type = application/json;odata=verbose
WF2
  1. Now select ‘Call HTTP web service’ action and select Properties.              WF3
  2. Select newly created dictionary variable as value for ‘RequestHeaders’.WF4
  3. Press OK and publish the workflow.