SharePoint 2013 Hosting – ASPHostPortal.com :: Integrating WordPress Website Into SharePoint 2013

Within this blog post, I’ll go over about how we will easily combine a WordPress blog with your SharePoint site with all the help of SharePoint 2013 work flow.

ahp_freehostSHP
Using SharePoint 2013 REST API and creating SPD based simple Workflow, we are going to fetch most recent 2 or more submit in the blog site and add those within a SharePoint checklist.

If you’re more fascinated regarding the pros and cons in the REST API, and to get a comparison with other API’s, make sure you refer the MSDN site.

REST API Reference

First of all, we will try to get the REST API supplied by WordPress. Let us go to WordPress developer’s assets site.

http://developer.wordpress.com/docs/api/

Right here, you can receive the listing of REST API, from which you’ll pick according to your prerequisite.

To be able to retrieve most recent two blogs we are going to be specifying the number=2 inside the parameter this sort of as beneath:

https://public-api.wordpress.com/rest/v1/sites/yourwordpressblog.com/posts/?number=2

Creating SP2013 SPD Workflow

Open the SharePoint Designer and click on site work flow.

1dffbrWhen you can see in the image, we are going to build a web site workflow named “Get WordPress Recent Blogs”, which can read the information from WordPress Website, produce checklist products in a SharePoint checklist for further use.

As soon as the positioning workflow is developed, you just incorporate phases, loops and title them effectively, after which website link them actions.

Identify Phase 1 “Get Myblog Recent Items” after which include five steps and a single Loop block, as proven in Figure 1.

2rbgerbFigure 1. Workflow Stage 1

  • Action 1 is not really required, but it will add one item to the history list, which can be used for debugging.
  • Action 2 is added to Call HTTP Web Service action. The HTTP URL is set to https://public-api.wordpress.com/rest/v1/sites/yourwordpressblog.com/posts/?number=2  and the HTTP method is set to “GET”.
  • Action 3 is again logging to history, the response should be “OK”. This means the WF is calling API perfectly.
  • Now we are creating a variable “itemcount “as Integer and setting the value to 2, since we require only 2 blogs.
  • Last action is to create another variable “Index” and set the value to 0.

3bsen
In the “Call HTTP Net Service” action assertion we don’t established RequestContent or RequestHeaders parameter since we do not want to. We have been only intrigued in the output of that web service. By simply environment the response parameter to a variable ResponseContent, the output of the web services get in touch with can get stored in the variable ResponseContent, which is a dictionary type variable.

The output from the net support seems like the following:

{“found”:5,”posts”:[{“ID”:124,”author”:{“ID”:7899331,”email”:false,”name”

To handle each blog item we could use the “responsecontent” variable so that we can put our action statement like “Get ([%Variable: Index%])/Title from Variable: responsecontent” to get Post’s  property.

From the web service output we can see the ID, title. These are within “posts{“.

Just to make  things simple and to show a clear structure of post inside web service output, the  full path to access post’s properties,  the statement like “Get posts[%Variable: Index%])/ID from Variable: ResponseContent“ will retrieve ID property of an item.4bsrtb

These are the workflow variable details:

5tnsrtynFigure 2 shows all the different action items.

  •     Firstly, pick the ID
  • Next, delete the same ID if the item exits in the SP list
  • Next four action is updating the variables with posts’ value
  • Last item in the loop is to add an item in the SharePoint ListNow increase the counter by 1 and the same actions are for the 2nd Item.

This is it! You are now you are ready to publish and start this workflow.

If you want to run the workflow daily, then add another action item after the loop end such as below:

6dmnytm

Now your SharePoint List will have the blog content . That’s it

7dmytmAnd finally, adding a delay for 24 hours every day will allow the listing to update with two latest weblogs. This is a really easy but really potent example of REST API and SPD workflow.