In this article we will understand how to get a list item value in the SharePoint designer workflow using REST-API GET method. Designer workflows are a very essential part of most of the SharePoint development projects. Let’s see how we can use REST-API GET method in the designer workflow.
The step-by-step process of getting list item in the designer workflow using REST-API GET method
You can check how to get a list item using REST-API programmatically. The same example we have utilized for the reference in this article.
- Open SharePoint Designer. Here, we have shown List workflow. Click on List Workflow from Ribbon and add workflow details. Make sure you select latest platform Type – SharePoint 2013 Workflow
- In Stage 1, click on Action from Ribbon and then from dropdown select, Build Dictionary.
- We are going to create a variable of Type Dictionary and save REST call headers in it. As shown in the screenshot below, click on the ellipsis (…) to build dictionary variable values and add headers.
|
Name
|
Type
|
Value
|
|
Accept
|
String
|
application/json;odata=verbose
|
|
Content-Type
|
String
|
application/json;odata=verbose
|
- Next, we will add Call HTTP Web Service action.
- Select the web service action and then click on the Advanced Properties from Ribbon Menu.
- Now, we will add a few values which are very essential. Here, you are constructing the actual request. Mainly we have added below three parameters.
- Address: This is the REST API URL value. You can construct it according to your requirements.
- RequestType: Here we have used HTTP GET method as we are fetching a list item
- RequestHeaders: This is the headers of the REST call we will assign dictionary value that we created in the first step (HeaderDictionary)
- RequestContent: we can leave it blank for GET call
- ResponseContent: This is a variable of the type Dictionary that holds the data returning by the REST call.
- ResponseStatusCode: This is not mandatory but just kept to check the status of the REST call
- We will add one more action. Get an Item from a Dictionary.
- Select a path from JSON response which we got in earlier call and store value in a string variable
- The value that we want from the REST call is stored in a variable. You can utilize that variable as per your needs.
- I have logged the response just to show the value of the response.
- Complete REST-API GET call from SharePoint designer looks like below.
- Set Transition to stage add Go to End of Workflow
- Now you can publish this workflow.
- Go to your list and manually start the flow (you can set the trigger of the flow according to your requirement).
You can check some REST-API examples and create a designer workflow with their reference.
Conclusion:
We gone through the steps to create a designer workflow and how to create REST - GET requests using that.