Workflow and ServiceDesk Community

 View Only

Using the REST Generator in Workflow 7.6 

Mar 06, 2015 12:39 PM

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

Statistics
0 Favorited
9 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

Feb 18, 2019 03:13 AM

What error are you getting?

Feb 18, 2019 02:18 AM

Hello Alex,

 

Thanks For your responce.

Yes it is a Post request to get the token.

I am using REST API to get the acess token from one of our tool, for getting the same I am using REST Generator in Symantec Workflow.

 

Regards,

Kaustubh

Jan 24, 2019 03:55 AM

Could you explain a little more about the API you are using?

What error are you getting?

Is it a POST to a Token/Login endpoint that returns an Access Token?

Workflow - How To Create Authenticated REST Components
https://www.symantec.com/connect/articles/workflow-how-create-authenticated-rest-components

which you then use in subsequent requests as a Auth HEADER?

Using the REST Generator (Headers) in Workflow 7.6 with Mobility Suite
https://www.symantec.com/connect/articles/using-rest-generator-headers-workflow-76-mobility-suite

The REST Generator isn't great with Authenticated APIs so you may have to generate the endpoints manually by putting in the Response Content in manually

Using the REST Generator (Response Content) in Workflow 7.6
https://www.symantec.com/connect/articles/using-rest-generator-response-content-workflow-76

Jan 24, 2019 12:19 AM

Hello Team,

I am working on REST Generator to get Access token,.

I have onfigured the componanet properly with API url as well as headers, But I am not able to get the access token using REST generator.

The same configuration I have used with Postman client and I am able to get the token.

Can you please help on the same. how to get the access token using REST Generator.

Please let me know in case any additonal information required.

 

Thanks !!

Jul 16, 2015 03:41 AM

You can create the Response manually, the auto one is just easier.

https://msdn.microsoft.com/office/office365/APi/complex-types-for-mail-contacts-calendar#EventResource

You would then be able to pass the login to the component, if the REST service allows it.

Are you using the following documentation?

https://msdn.microsoft.com/office/office365/APi/calendar-rest-operations

Looks like you need to request an Access Token.

 

This blog might be useful

http://blogs.msdn.com/b/exchangedev/archive/2014/03/25/using-oauth2-to-access-calendar-contact-and-mail-api-in-exchange-online-in-office-365.aspx

Jul 14, 2015 08:03 PM

Thanks Alex, appreciate it - i'm still stuck at the 

              Choose "JSON"

              Then in Create choose "Create From Request"

part with my o365 project...

What I see is a catch-22.

I ned to authenticate to get the JSON Request to build the component, but if i build the component, i can add the authentication to the component . . .

I suppose what I need is a simple eay of passing the Authentication to the Request, so that the generator can build the component!

I need this for more than one project now, but the O365 one is a big help.

 

Cheers, appreciate your time

 

 

 

Jun 26, 2015 06:10 AM

I've written a couple of follow on articles that maybe of use

They don't cover using Authentication but on HTTP tab of the component there is a HTTP Authentication box you can check which then allows you to pass in your credentials, you could use Project or Profile Properties here or just hardcode them if you wanted.

HTTP - Authentication.png

Jun 24, 2015 12:35 AM

Nice writeup Alex, but I have one question . . .

If the REST Service requires authentication - how can we get the response?

Mosly what I am after is creating calendar appointments in an Office 365 calendar . . .

I have most of the guide, jsut missing the authentication part :)

Cheers

 

Mar 17, 2015 05:33 AM

Thanks Alex, this feature helps many in different ways. You have explained it very nicely.

Mar 06, 2015 12:52 PM

Fantastic - thanks for the write-up, Alex!  Good to have a walkthough of a very handy new feature.  Especially handy when packing for a trip to Dantooine.

Related Entries and Links

No Related Resource entered.