How to call web services or Rest Api in SharePoint 2013 designer workflow?

Paragyte
Paragyte
27.6 هزار بار بازدید - 8 سال پیش - SharePoint 2013 designer has lots
SharePoint 2013 designer has lots of new actions, which provides developers the flexibility to write complex workflows and perform various operations on SharePoint objects. Check out https://www.paragyte.com/blog/how-to-...

Some of the new actions are:

a. Start a list/site workflow.

b. Build Dynamic Value.

c. Call HTTP Web Service.

The introduction of the call HTTP Web service is the most effective one, as we call a rest API to
fetch all items from SharePoint list and iterate over them. Also, we can create a new item in another list by using the rest API(Post) request.

This video will be going to guide you, how to use the SharePoint workflow action “Call HTTP Web Service” and how to iterate the collection of response object from the rest API.

Below are the steps for it:

1. Create a SharePoint list. In our case, it is “Employees”.

2. Create either a Site/List Workflow. In this video, we have created the site workflow.

3. Select the workflow template (SharePoint 2013 designer workflow).

4. Create 4 Stages in the workflow (Initiation, Calling Rest API, Process Rest API Response, Finished). Stages gives modularity to the workflow; we can also call the stages from anywhere in the workflow.

5. In the first stage, we will initialize some of the local variables that we are going to use throughout the workflow.

a. siteUrl = current site URL.

b. Index = 0 (to iterate over the collection of items)

c. requestHeader = A dictionary variable containing the request headers
Accept = application/json;odata=verbose
Content-Type= application/json;odata=verbose

6. In the second stage, we will call the rest API end by using the “Call HTTP Web Service Action “.

a. “local variable siteURL”/_api/web/lists/GetByTitle(“Employees”)/items?$select=FullName

b. Method : Get
We have associated a filter with the API to pull only the selected columns instead of pulling all.

7. In the third stage, “Process Rest API Response” we will iterate over the response result collection and log the “FullName” property of each object.
Visit us at: https://www.paragyte.com/services/mic...

Please do watch the video, and subscribe us at @Paragyte YouTube Channel.
8 سال پیش در تاریخ 1395/06/05 منتشر شده است.
27,639 بـار بازدید شده
... بیشتر