Using the REST Generator (Headers) in Workflow 7.6 with Mobility Suite

Published on Wednesday, 6 May 2015

In this Article I'm going to show you how to use HEADERS in the REST Component.

This builds upon a past article but shows using Parameters in Headers.

I noted before that

| **Warning!**Passing the API key as a query parameter is not recommended and is deprecated.

Support for passing the key via URL parameters will be removed in the near future. | | --- |

So to rectify this we can pass it in the Header.

When you're creating the REST Generator there is a "Headers..." button, click this.

Now add the requried values.

Content-Type application/json
X-Nukona-API-Key-v1 [lockapikey]

Here [lockapikey] is a parameter denoted by the square brackets [ ].

If you have multiple methods make sure to name this apikey differently each time or you will get an error.

This will then be available within the Workflow.

Request Headers.png

Once completed you can then set the Properties on your variable.

Component Properties.png

Now in your Workflow you can set the API Key dynamically.

I like to use Profile Properties within Process Manager, so there is one place to maintain/administer it.

REST Generator General.png

There is also a StatusCode you can get returned from the REST Generator, give this a name, but to use it you will need to declare it before.

REST Generator HTTP.png

Use an Add Data ElementData_Add.png and give it the same name.

Add Data Element Configuration.png

You can then use this Status Code for logging etc

Previous Articles

Protirus.png