SharePoint Designer Call HTTP Web service with RequestDigest

Using Sharpoint Designer we can create an activity of type “call Http Web Service” to manage sharepoint using Rest API.  Workflow 2013 support the JSON format. then we must to tell to the Rest call that we accept JSON format.

For any request (Add Items, manage permission). We need the X-RequestDigest. we can see together how to get the X-RequestDigest from SharePoint designer and then use it to call http rest.

  1. Create Build new Dictionnary called header

  2. Create two keys with this value:
    Accept:               application/json; odata=verbose
    Content-Type:  application/json; odata=verbose
  3. Create a “CALL HTTP WEB SERVICE”

    change the url to : [%site url%]_api/contextinfo
    type: POST
    Request Header:header
    Response Content: ResponseContent (Create new variable Dictionnary)
  4. Add “Get Item from dictionnary” activity
    path: d/GetContextWebInformation/FormDigestValue
    from: ResponseContent
    output: DigestID (new new vraiable string)

    Now we our FormDiguest value. we can use it to call another secure HTTP request.
  5. Create new dictionnary header2:
    Accept:               application/json; odata=verbose
    Content-Type:  application/json; odata=verbose
    X-RequestDigest: DigestID
This entry was posted in SharePoint 2013, sharepoint online. Bookmark the permalink.

Leave a comment