Calling Rest API from A SharePoint 2013 Designer Workflow

Here in this SharePoint designer tutorial, we will discuss how we can call REST API in SharePoint Designer Workflow using Call HTTP Web Service SharePoint 2013 designer workflow action. We have developed the workflow using SharePoint designer 2013.

Call Rest API from a SharePoint 2013 designer workflow

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.

call rest api from sharepoint designer workflow
call rest api from sharepoint designer workflow

Start SharePoint Designer 2013 and add a list Workflow on this IT list; make sure Workflow is a SharePoint 2013 Workflow.

SharePoint 2013 call rest api from designer workflow
SharePoint 2013 call rest api from designer workflow

In the screenshot 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.

SharePoint online call rest api from workflow
SharePoint online call rest api from workflow

Since the $json option is not supported in SharePoint 2013 REST API, to get 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.

call rest api from workflow sharepoint 2013
call rest api from workflow sharepoint 2013

Click this and click Build your dictionary; add the Accept and the Content-Type headers.

SharePoint 2016 call rest api from designer workflow
SharePoint 2016 call rest api from designer workflow

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.

SharePoint online call rest api from designer workflow
SharePoint online call rest api from designer workflow

Choose the Advanced Properties icon. In the Call HTTP Web Service Parameters dialog, click RequestHeaders dropdown, choose RequestHeader variable and click OK.

how to call rest api from sharepoint online designer workflow
how to call rest api from sharepoint online designer workflow

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.

how to call rest api from sharepoint 2013 designer workflow
how to call rest api from sharepoint 2013 designer workflow

Add a log activity and display the ShowTitle variable in the log.

how to call rest api from sharepoint 2016 designer workflow
how to call rest api from sharepoint 2016 designer workflow

The final stage should look as shown below. Publish and run the Workflow.

sharepoint workflow rest api call
sharepoint workflow rest api call

In the Workflow history, you should find Filter Title, which is shown below.

sharepoint 2013 workflow rest api call
sharepoint 2013 workflow rest api call

You may like following SharePoint workflow tutorials:

Hope this SharePoint 2013 tutorial explains, how to call Rest API from a SharePoint 2013 designer workflow.

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

Sagar Pardeshi

I am Developer working on Microsoft Technologies for the past 6+years. I am very much passionate about programming and my core skills are SharePoint, ASP.NET & C#,Jquery,Javascript,REST. I am running this blog to share my experience & learning with the community I am an MCP, MCTS .NET & Sharepoint 2010, MCPD Sharepoint 2010, and MCSD HTML 5,Sharepoint 2013 Core Solutions. I am currently working on Sharepoint 2010, MOSS 2007, Sharepoint 2013,Sharepoint 2013 App Dev, C#, ASP.NET, and SQL Server 2008.

>