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.
- Create Build new Dictionnary called header
- Create two keys with this value:
Accept: application/json; odata=verbose
Content-Type: application/json; odata=verbose - 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) - 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. - Create new dictionnary header2:
Accept: application/json; odata=verbose
Content-Type: application/json; odata=verbose
X-RequestDigest: DigestID