Here in this SharePoint desingner tutorial we will discuss how we can call REST API in SharePoint Designer Workflow. Whe have developed the workflow using SharePoint designer 2013.
Create a custom list, “IT,” and let’s say that we want to create a Workflow which returns the first one by using REST API, which is based on Dept. Filter, which shows Title Name.
Start SharePoint Designer 2013 and add a list Workflow on this IT list; make sure Workflow is a SharePoint 2013 Workflow.
Read some SharePoint 2013 tutorials:
- SharePoint Designer 2016 Download and Updates
- Packaging and Deploying in SharePoint 2013 designer workflow
- Export SharePoint designer List workflow from one site to another site
In the screen shot given below, we need to look back at the XML generated in the Browser. Looking at the JSON output given below from our .getJSON() call, we find the values to show and highlight/copy XML name as we’ll need the exact value since jQuery is case sensitive.
https://serversitename/_api/web/lists/getbytitle(‘IT’)/items?$filter=Dept eq ‘RnD’
You should get something, as shown below.
Since the $json option is not supported in SharePoint 2013 REST API, to get the the response in a JSON format, you will have to update the Accept and Content-Type http headers of your Rest http call to be more specific.
– Accept: application/json;odata=verbose
– Content-Type: application/json;odata=verbose
Now, let’s get back to our Workflow in SharePoint Designer 2013.
We need to create the Request header and this is possible by using a Dictionary ->.
In the existing stage, type Build -> rename the variable dictionary as RequestHeader.
Click this and click Build your dictionary; add the Accept and the Content-Type headers.
Go to Action ->Core Action->Call HTTP Web Service option. Now, let’s focus on the Http request by adding a Call action.
Click this and paste your http request.
Choose the Advanced Properties icon. In the Call HTTP Web Service Parameters dialog, click RequestHeaders dropdown, choose RequestHeader variable and click OK.
In the Call action, click Response and associate the response to a new variable: JSonResult (of type Dictionary) and a new variable: ShowTitle(of type String).
After the Call action, add a new Get action.
Add a log activity and display the ShowTitle variable in the log.
The final stage should look as shown below. Publish and run the Workflow.
In the Workflow history, you should find Filter Title, which is shown below.
Hope this will be helpful.
Download FREE SharePoint 2019 Installation PDF Guide
This FREE PDF contains, Steps by step guide to install SharePoint 2019 Preview, prerequisites, hardware and software new features. First impression to SharePoint Server 2019 new modern site, modern lists and modern document libraries.
You May Also like the Following SharePoint Online Tutorials: