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:
- Add an action “Build Dictonary”
- Select “this” after build
- Add the name Accept and the value application/json;odata=verbose
- Assign a new variable for the output and call it for example requestHeader
- Select your “Call HTTP web service” action, and click the right mouse button to open properties
- Assign the variable created on step 4 to the field RequestHeaders
- The final workflow could look like this