Create an API endpoint for an application
Initial Situation
You use the "Task Planning" application to manage your projects.
The "Task Planning" application is one of the many application templates available for free in Intrexx. For more information on this topic, see the following sections:
Your company has three teams: Finance, Marketing, and Sales.
You (David Winter) are a member of the Sales team.
Your team is currently working on the "New ERP" project. Three tasks have been created for your team. There is one task each in the "To Do," "In Progress," and "Completed" statuses.
Objective
As a member of the Sales Team, you'll be traveling a lot. You'd also like to quickly get an overview of the teams while on the go using a mobile app or other "third-party software." This tutorial describes the solution to this problem.
You use the Intrexx Application API to create a REST interface for task scheduling. It provides all the data you need. These can then be accessed by an app or a cloud-based product.
The Intrexx Application API allows you to generate OpenAPI-compatible documentation (Swagger documentation). You can use these yourself to create an app or share them with a third-party provider.
Contents of this tutorial
This tutorial provides a detailed explanation of how to create a REST interface for the "Task Planning" application in Intrexx. This process involves creating the necessary data set endpoints, assigning the appropriate permissions, and—for authentication—generating an API key.
The following section describes how to generate the Swagger documentation.
In this tutorial, "Postman" is used as an example of an app or cloud product for API consumers.
Preparatory Activities
-
Create a demo portal or import the "Task Planning" application into an existing portal
This tutorial describes how to create a REST API based on the Intrexx demo portal. You can find out how to create a new portal using the Intrexx demo portal as a template in the following section: Using the Intrexx Demo Portal as a Portal Template
Alternatively, you can also use the application template "Import Task Planning into an Existing Portal." The procedure is described in the following section: Import Online Application Templates.
-
Create the user "David Winter."
In the tutorial, the user who is supposed to use the REST API is named David Winter. He has the "User" role.
This user is created by default in the Intrexx Demo Portal.
-
Download Postman or use it online
Install the Postman client or use "Postman for the Web."
Create a Data Group Endpoint - Read Multiple Data Sets
Step-by-Step
-
Open the "Task Management" app.
Click "
."To display the "API Endpoints" section, you must select the "API Endpoints" checkbox under "View" in the main menu Enable the "API Endpoints" view.
You will be taken to the "General" dialog step.
-
Enter a name and a description for the endpoint.
The name must be unique, consist of at least two characters, and begin with a letter. Only alphanumeric characters, hyphens, underscores, and periods are allowed.
The text captured in the dialogs is incorporated into the Swagger documentation. Therefore, it is very helpful for both you and a potential service provider if you choose descriptive names and follow a naming convention.
-
Click "Data Group Endpoint."
-
Click "Next."
You will be taken to the "Data Group Selection" dialog step.
-
In the "Action" drop-down menu, select "Read multiple records."
-
In the "Data Group" drop-down menu, select "Team."
Step-by-Step
-
Click the "
" icon.The "Add Data Fields" dialog box appears.
-
Uncheck the checkbox "(PK) (S) (ID) <string>"
-
Select the following checkboxes:
-
Description <text>
-
Title <string>
-
Team Leader - Full Name <string>
-
-
Click "OK."
You will return to the "Data Group Selection" dialog step.
The previously selected data fields are displayed in the "Query Return Values" section.
To make the return values and the Swagger documentation easier to read, it is recommended that you rename the return values.
-
In the "Query Return Values" section, select a return value.
-
In the right-hand pane, enter a name and a description for the return value.
In our example, we use "camel case." The first part of the name specifies the application or resource.
-
teamDescription
-
teamTitle
-
teamFullNameTeamLeader
-
-
Rename all return values.
-
Click "Next."
This will take you to the "Path Parameters" dialog box.
A path parameter must be specified. We use a static parameter. We use the static path parameter to specify the resource.
Step-by-Step
In the "Query Parameters" dialog step, no information or queries are required, since we want to identify all teams.
Click "Next."
This takes you to the "Filter and Sort" dialog step.
In the "Filter and Sort" dialog step, we specify how the return values are sorted. It should be based on the team title.
Step-by-Step
In this step, we grant the user David Winter permission to use the endpoint we created earlier.
In the next step, we assign the API key to the user David Winter so that he will have all the necessary permissions to use the API endpoint.
Step-by-Step
-
Open the Properties dialog box for the "Task Management" application.
To do this, select the application and press "ENTER."
Or
Select the application and right-click it.
Click "Properties" in the context menu.
The "Properties - Application" dialog box appears.
-
Go to the "Permissions" tab.
-
In the left pane, switch to the "API Endpoints" tab.
Select the endpoint "/taskmanagementTeams".
-
Click "Add."
This will take you to the "Add Rights Holder" dialog box.
-
Select the user "David Winter."
-
Click "OK."
The user "David Winter" is displayed.
He has the "Use Endpoint" permission.
Click "OK."
You will be returned to the application.
-
Click the "
" icon (Publish the application in full).
Step-by-Step
-
Launch the "Integration" module.
-
Click "Application API" > "API Keys."
-
Right-click on "API Keys without a role."
A context menu appears.
-
Click "Create New API Key."
The "Create New API Key" dialog box appears.
-
In the "Name" field, enter a descriptive name for the API key.
-
In the "User" drop-down menu, select the user "David Winter."
-
Select the "Task Scheduling" checkbox.
This automatically enables the API endpoint as well.
-
Click "OK."
The API key entry is displayed under "API Keys Without a Role."
Step-by-Step
-
Launch the "Integration" module.
-
Click "Application API" > "API Endpoints."
-
Select the application for which you want to create the Swagger documentation.
-
Right-click.
A context menu appears.
-
Click "Create Swagger Documentation."
-
Save the Swagger documentation.
The Swagger documentation is stored in "yaml" format ("taskmanagement.yml").
Step-by-Step
-
Click the folder with the name of the imported Swagger documentation.
-
Click the "Authorization" tab.
-
From the "Type" drop-down list, select "API Key" (
). -
In the "Key" input field, enter the value "X-API-KEY" (
). -
In the "Value" input field, enter the API key you copied from Intrexx (see Step 8 - Copy the API key) (
). -
In the "Add to" drop-down menu, select "Header" (
). -
Save your information.
Step-by-Step
-
Click the "Get-all-teams" API endpoint (
). -
On the "Params" tab, disable the query parameter keys (
). (The relevant settings are controlled by the Swagger documentation.) -
Click "Send."
The return values you defined are displayed under "Body."
Display on the "Visualize" tab
Postman offers the option to display the transmitted JSON data in HTML format via the "Visualize" tab.
To do this, you must enter the appropriate code on the "Tests" tab (
). You can find detailed information on this topic at the following link: Postman Learning Center - Visualizing Responses.If you then run the request again and switch to the "Visualize" tab (
), the data will be displayed as it would appear in an app or a cloud solution.Below is the code that was used in the "Tests" tab.
Sample Code
pm.test("Status code is 200 and Present in Tabular form", function () { pm.response.to.have.status(200); let template = ` <style type="text/css"> .ixtable {font-size:14px;color:#ffffff;width:100%;border-width: 1px;border-color: #00a3c7;border-collapse: collapse;} .ixtable th {color: #ffffff;font-size:16px;background-color:#00a3c7;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;text-align:left;} .ixtable tr {color:#2a2a2a;background-color:#ffffff;} .ixtable td {font-size:14px;border-width: 1px;padding: 8px;border-style: solid;border-color: #87ceeb;} .ixtable tr:hover {background-color:#e0ffff;} </style> <div> <table class="ixtable" border="1"> <tr> <th>Name</th> <th>Teamleader</th> <th>Beschreibung</th> </tr> {{#each .}} <tr> <td>{{teamTitle}}</td> <td>{{teamFullNameTeamLeader}}</td> <td>{{teamDescription}}</td> </tr> {{/each}} </table> </div>`; let response = pm.response.json(); pm.visualizer.set(template, response.data); });
































