Using the REST Generator in Workflow 7.6

Published on Friday, 6 March 2015

In this Article I will explain how to use the REST Generator within Workflow 7.6.

Follow up articles

I'm going to be using the RESTful APIs available in to us from http://swapi.co/. The Star Wars API.

A little background:

REST or Representational State Transfer is an architecture style or design pattern used as a set of guidelines for creating web services which allow anything connected to a network (web servers, private intranets, smartphones, fitness bands, banking systems, traffic cameras, televisions etc.) to communicate with one another via a shared common communications protocol known as Hypertext Transfer Protocol (HTTP). The same HTTP verbs (GET, POST, PUT, DELETE etc.) used by web browsers to retrieve and display web pages, audio/video files, images etc. from remote servers and post data back to them when performing actions like filling out and submitting forms are used by all of the aforementioned devices/services to communicate with one another.

Link: http://en.wikipedia.org/wiki/Representational_state_transfer

To Test an APIs you could use a Chrome Plugin called PostmanLogo.pngPostman [http://www.getpostman.com/]

Or on a Mac there is an App you can get called Cocoa Rest Client [http://mmattozzi.github.io/cocoa-rest-client/]

Most APIs will require a Key to use them, but don't share it, luckily the Star Wars API doesn't need one.

Now go to your Workflow Server.

Open Workflow.png Workflow Manager.

File | New Project and create a new Forms (Web).png Forms (Web) Project.

Give this a name (POC_JSON_WEB).

We will be using this later to display our results.

Now back in the main Workflow Manager window click on

File | New Project and create a new Int.png Integration Project.

Give this a name (POC_JSON_SW_INT).

New Project - Integration_0.png

Scroll down to Enterprise Resources and choose ‘REST Generator’ and give it a name: "StarWars"

Create Generator.png

Put in your

then click Next.

1. REST Service URL (Star Wars).png

Click Add.

Give it a name: "Planets"

You can change the Method to any of the following:

  • GET
  • PUT
  • POST
  • DELETE

2. Components (1) (Star Wars).png

Click on the ellipse (…) below ‘Response Content’.

Choose "JSON"

Then in Create choose "Create From Request"

2. Components (3).png

Click Next

Create From Request.png

The response is then shown, click Next.

Create From Request - JSON.png

You will then see the Data Type that has been created, you edit this if necessary. Click Finish.

Create From Request - DataType.png

You will see the chosen Data Type, click OK.

2. Components (4).png

Now you can click Finish and save your new Integration Project.

2. Components (7).png

You can see what was generated for you.

Generators Management.png

Back to your Web Forms Project.

Add the Library to this.

You can now call the INT and display the results in a Web Form.

POC_JSON_WEB (2).png

And your Web Page

POC_JSON_WEB (3).png

And there you have a way of retrieving data from an API and displaying it in a Web Form.

Follow up articles

Protirus.png