1. Home
  2. Create and integrate a REST call into your processes

Create and integrate a REST call into your processes

This short tutorial will help you understand how to prepare and integrate REST requests into your processes. We will see how to define two services, offering the possibility to manipulate tables by contacting the API of your instance from a process.

Tutorial: Preparing for the REST call service

For this tutorial I will use “myInstance”, in your it is necessary to replace it with the name of your instance. You can find the name of your instance in your URL when you are on your Iterop page.

I. Creation of the service

  1. Go to your space Design more precisely in the ” Services ” tab.
  2. First we need to create a service of type REST.
  3. To do this, click on Create a new service in the top right corner of the service configuration page, then select the service type : REST.
  4. Name your service and add a description if you wish.
  5. Now fill in the field url base with the path to your api: https://www.myInstance.iterop.cloud/api
  6. Now choose your authentication type, in our case we will use the ” HTTP basic “.
  7. Fill in the authentication data with your API accesses.
  8. Finally, click OK, you will be redirected to the Service Transaction Structure window.

You can find out how to generate REST accesses by following this link: https://doc.iterop.com/knowledge-base/utiliser-lapi-rest-2/.

II. Creating a Simple Operation ( GET )

Once your department is created, you will assign it a set of operations, a number of methods. In this first case, we will see how to create a simple “GET” call to retrieve a list.

You will find the list of possible REST calls on the internal documentation of your instance. To locate her, go to this page: https://monInstance.iterop.cloud/api-docs/index.html.

  1. Name your operation for our example, I chose a GET method: Get business table

2. Once your operation is named, click on the tab below Path Setup and fill the field: ” path HTTP ” with the end of your URL. In our example, it would be “tables/tables”.

3. The field Address updates and should display the full path corresponding to the method: https://monInstance.iterop.cloud/api/table/{tableId}

À quoi sert le type (MINE) réponse ?

By default, the type application/json is selected, which designates a textual data. If your answer is a file, you must select the type application/byte-stream. However, your operation will still work if you leave the default value.

Vous avez pu apercevoir des sortes d’onglets à côté des éléments de configuration. En effet, chaque champ peut être rendu accessible à la configuration processus, ou fixé durant cette configuration. Pour ce faire, utilisez le bouton à droite de ces champs. L’interrupteur basculé vers la droite signifie qu’il peut être configuré par le designer, l’inverse signifie qu’il est fixé.

As you can see in our path, we have a “tableID” variable. So now it has to be declared and set up.

Go to the execution data part and add a new intermediate variable.

  1. In the part key, copy the name of the parameter, “tableId” in our case.
  2. Now add a ” $ ” in front of the variable in the path. So we have for path: table/${tableId}.

Click on Test operation. An intermediate window asks you for a value for tableID, now enter the ID of the table you want to retrieve.

5. Your procedure is now functional.

6. You just have to specify to Iterop in which variable you want to put the query response to find it in your process. In the Configuration Output data pane, at the bottom right of the window, select the type of transformation: File. Then click on configure a new variable.

7. Name your variable and click OK.

III. Creating a complex operation ( POST )

I remind you that you can find the list of possible REST calls as well as their documentation by following this link: https://myInstance.iterop.cloud/api-docs/index.html

We will now see how to create a more complex query that will use in addition to the so-called Path params, a body.

For this example I chose to show you how to add a column in a business repository. To do this, go to the internal documentation of your instance to find all the information necessary for the request.

Technical documentation of the request

A- General configuration of the request

  1. Create now in your service a new operation.
  2. As in the second part of this tutorial, start by giving a name and description to your operation.
  3. Set the method to ” POST “. (“GET” being the default )
  4. Now add le path, in our case: ” /table/{tableId}/column “.
  5. Check that the complete link is correct. ( You can find it under : test operation )
  6. Configure the type (MIME) response based on the return you expect. ( In our case, we leave by default : application/json )

B- Configuration of input parameters

As with the GET method, the request needs an ID in parameter.

  1. Add “tableId” in the top right corner in the runtime data.
  2. Add a ” $ ” in front of {tableId} : /table/${tableId}/column

C- Body configuration

  1. Go to: Query configuration.
  2. Select the content format, you can find this information in the query documentation below ” Parameter content type “. For our part, it will be “application/json”.
  3. Copy the sbody structure present in the documentation then paste it in the ” body ” part.
  4. Then adapt this skeleton as you see fit. Be careful to respect the imperatives given in the documentation.

All fields are not necessarily mandatory, please refer to the doc.

As seen previously, add or not add a output variable at the bottom right if you want to retrieve the query response.

V. Implementation of the service

Before proceeding to this step, check that your queries are working properly with the button, ” Test operation ” and ” Evaluate my variables “.

Go to Iterop Design and create a new template.

  1. Position 2 tasks of services and one task human.
  2. Name the first service task “add column” and the second one “get table”. As for the human task, call it “display”.
  3. Click on ” Validate and configure “.
  4. Add a argument ” table Id ” in the form of the Start.
  5. Now go to the “add column” configuration, then in ” select service “, choose the operation “Add Business Table Collumn”. After, in ” select data ” select the variable of the Start and drag it into the required field by the operation.
  6. Then do the same with “Get table”, and choose the operation “Get Business Table”.
  7. Now all you have to do is set up the task “Display” by dragging in information to be displayed: Get table: “out”.

Go to Dynamic Assignment then Task Actor: Process Launcher, to be able to test your process more easily.

Here’s what I get out of it:

Updated on 13 November 2020

Was this article helpful?

Need Support?
Can't find the answer you're looking for?
Contact Support