SharePoint 2013 Workflows: The HTTP header ACCEPT is missing or its value is invalid

Problem 
A SharePoint 2013 workflow is receiving information from the SharePoint 2013 site by using the Call HTTP web service action. When you run the workflow, then the following value inside the response is logged:
{“error”:{“code”:”-1, Microsoft.SharePoint.Client.ClientServiceException”,”message”:{“lang”:”en-US”,”value”:”The HTTP header ACCEPT is missing or its value is invalid.”}}}
The problem occurs, because the SharePoint server needs to know which type of data you want to receive. This can be achieved by adding an Accept header and the data type. To be able to consume the data inside the workflow as a dictionary application/json;odata=verbose can be used.
Resolution
You need to add a request header to your action. This can be achieved by the following steps:
  1. Add an action “Build Dictonary”
    wf_1
  2. Select “this” after build
  3. Add the name Accept and the value application/json;odata=verbose
  4. Assign a new variable for the output and call it for example requestHeader
  5. Select your “Call HTTP web service” action, and click the right mouse button to open properties
    wf_2
  6. Assign the variable created on step 4 to the field RequestHeaders
    wf_3
  7. The final workflow could look like this
    wf_4

Leave a Reply

Your email address will not be published. Required fields are marked *