REST query from Workflow return Unauthorized RRS feed

  • Question

  • Hi, I have list workflow where i'm trying to get data from other list. list workflow located in site A, list which i'm trying to call located in site B, both sites located in the same site collection. I have access for both sites and can call next REST quesry from browser and get response http://rupappsps01/sites/edms/commercial/_api/web/lists/getbytitle('Commercial%20Team%20responsibilities')/items?$select=Client the same query I can execute from Fiddler and get Json format for response.

    But, if i'm trying to get data from workflow using Call http web service i'm receiving Unauthorized in ResponseStatusCode

    and next data in Response content - {"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"ru-RU","value":"Access denied. You do not have permission to perform this action or access this resource."}}}

    It's very similar to this bug - http://office.microsoft.com/en-001/help/sharepoint-server-2013-known-issues-HA102919021.aspx Calling HTTP web service fails when calling non-SharePoint HTTP (REST) web service from SharePoint workflow

    When a workflow developer writes a workflow that calls non-SharePoint HTTP (REST) web service from SharePoint workflow, “Authorization: Bearer” is added to HTTP header by default, which may sometimes result in “401 Unauthorized" error response.

    Workaround    A workflow developer explicitly needs to have “Authorization” field set with empty string (“”) in a “RequestHeader” property of “Call HTTP Web Service” action. This will result in suppressing the bearer authorization header for this HTTP request.

    I'm tried to add Authorization field to RequestHeaders, but it's didn't change anything. AppStep is also didn't change situation?

    Any suggestion very appreciated.

    Tuesday, September 10, 2013 9:15 AM


  • i'm rebuild that workflow from scratch, add authorization with blank filed and now it's working.
    Tuesday, September 10, 2013 10:51 AM

All replies

  • i'm rebuild that workflow from scratch, add authorization with blank filed and now it's working.
    Tuesday, September 10, 2013 10:51 AM
  • Hello, I am having the same problem. What did you do exactly to solve it? Thanks in advance.
    Tuesday, September 10, 2013 4:46 PM
  • For RequestHeaders variable you need to have next variables:

    Authorization type string value is empty!

    Accept type string value application/json; odata=verbose

    Content-Type type string value application/json; odata=verbose

    that's all.

    Wednesday, September 11, 2013 8:41 AM
  • Hi again. I think I have exactly the same case as you, or perhaps I'm missing something, but just add the header still gives me the same access denied error...

    Wednesday, September 11, 2013 10:47 AM
  • I believe, that Authorization parameter should be first, not last.
    Wednesday, September 11, 2013 11:02 AM
  • I think that does not matter. in fact I've put in all places. : (
    Wednesday, September 11, 2013 11:09 AM
  • Try to create new temp workflow, just add

    Set Variable: webServiceURL
    put here URI
    Build {...} Dictionary (Output to Variable: requestHeaders )

    (use provided order for parameters Authorization, Accept, Content-Type)

    Call [%Variable: webServiceURL%] HTTP web service with request (ResponseContent to Variable: jsonResponse |ResponseHeaders to responseHeaders |ResponseStatusCode to Variable: responseCode )


    Log ResponseCode value is: [%Variable: respo... to the workflow history list

    If you will see OK, then you win :)

    Wednesday, September 11, 2013 12:47 PM
  • I got the resolution of this problem. The issue was with user profiles.

    Step 1: Check if the user profile is exists in User Profile Service

    Step 2: if not exists create manually for the same user, if exists delete it and recreate it.

    I hope it solves your issue.

    Thursday, January 30, 2014 9:10 PM
  • Gave SPD workflow Full Permission.  Added everything to an App Step and then Added a Blank Authorization to the Header.  It worked.
    Monday, August 18, 2014 7:17 PM
  • I followed the same steps but I am still getting Unauthorized from the Rest Call.
    Monday, May 11, 2015 7:22 AM
  • I followed the same step  and build the new workflow but no luck.  Can provide me complete step to verify if I am missing something. 

    Thursday, July 16, 2015 1:55 PM
  • hi,

    did u get it working. I am also facing same issue

    Thanks Manohara R

    Wednesday, January 27, 2016 4:07 AM
  • I am able to resolve this issue by granting full acess to Workflow service account at Webapplication level (Webapplicaiton --> User Policy).

    As well as below request headers.

    Accept: "application/json;odata=verbose"

    Content-Type: "application/json;odata=verbose"

    Authorization: ""

    Sunday, May 13, 2018 6:41 PM