Updated: Mar 18, 2019
In SharePoint 2013 Workflows, you call a Web Service using a new action, which was introduced in SharePoint 2013 named Call HTTP Web Service. This action is flexible and allows you to make the simple calls to a Web Service easily, or, if needed, you can create more complex calls, using HTTP verbs as well as allowing you to add HTTP headers.
The Call HTTP Web Service action lets you specify any of the several request methods, including GET, PUT, POST and DELETE. This lets you tell the Web Services, specifically RESTful services what is to be done on the service that you’ve specified with the URL property on the activity. For more details, please refer to this link.
In this article, you will be creating a Site Workflow and log the entire list names in the Workflow history list.
To get all the lists from SharePoint site endpoint, URL will be http://sitename/_api/web/lists
GET – Read a Resource.
Workflow will be designed with the stages (Retrieve Lists and Process Lists), as shown below:
Create Site Workflow
Open SharePoint Site in Designer 2013.
In the top navigation bar, click Site Workflow.
Enter the Name and Description. Select Platform Type and click OK button.
Create Workflow Local Variables
In the top navigation bar, click Local Variables and create the following variables:
Stage 1- Retrieve Lists
Set Workflow Variable Action – Set the workflow variable varStrURL to http://sitename/_api/web/lists.
Build Dictionary Action – Add the dictionary items, given below. Set the varDicRequestHeaders variable.
Call HTTP Web Service Action – Set the variable, as shown below. Right click Call HTTP Web Service action and click Properties. Set RequestHeaders parameter to varDicRequestHeaders variable.
Transition to stage – Go to next stage Process Lists.
Stage 2- Process Lists
Get an Item from a Dictionary Action.
Count the items in a Dictionary Action.
Log to History List Action.
Set the Workflow Variable Action.
Add loop up to n times and add the actions, as shown below:.
Transition to stage – Go to End of Workflow.
Publish the workflow
In the top navigation bar, click Publish. The workflow will be published successfully.
Test the workflow
Navigate to the site.
Click Settings and subsequently click Site Contents.
Click Site Workflows.
Click Get SharePoint Lists Workflow.
Once the Workflow is completed, click Completed link.
You will be able to see the Workflow history, as shown below:
Thus, in this article, you have seen, how to get all the lists using HTTP Web Service in SharePoint Designer 2013 Workflow.