Follow

HTTP Endpoint Configuration Example

Article last updated on the 30th of September, 2022.

Contents

1. Introduction

In this example, we will configure an Http endpoint to look up companies in the Danish CVR. The CVR is a database of all registered companies in Denmark. We can use the data that the endpoint returns to fill in meta data for companies in our WorkPoint processes. Our Http endpoint will be used to search for companies using their CVR numbers or their names in order to retrieve information about the company.

2. Example configuration

We will start by creating a new Http endpoint configuration:

  1. In the Http Endpoint Library, we click the "Add" button.
Add Http Endpoint - Google Chrome
  1. As we will use this Http endpoint to search for companies using company names, we give the Http endpoint a fitting title.
  2. For now, we leave the "Parameters" list empty.
  3. We also make sure that the Http endpoint is active.
  4. In the URL field, we paste the address to the Http endpoint we want to make requests to and get response from. In this example, our endpoint is located at: https://api.cvr.dev/api/cvr/virksomhed
  5. Next, we select which type of Http(s) endpoint action we would like to use. As we want to retrieve information about an item in the CVR database, we select the "GET" action.
  1. The endpoint we use in this example requires an API key to be passed into the "Authorization" header. In the "Key" field in the "Header" section, we there type in "Authorization".
  2. In the "Value" field of the Authorization header, we paste in our API key. You can retrieve an API key by creating an account here (external link) and create a new API key.
  3. To add the header, we click the "+" button.
  1. In the "Query" list, we need to add a query for the Http endpoint to use in our request for data. The specific Http endpoint we are trying to request data from requires a query called "cvr_nummer". This query is used to provide the CVR number of the company we want to get from the endpoint. In the Key field, we therefore type the "cvr_nummer" query name.
  2. In the "Value" field, we type in square brackets a title for the parameter. This will be shown in UI interfaces where the Http endpoint is used, e.g. when using it in a User Step in a WorkPoint Process. In this case, we type in [cvr_number].
  3. To add the Query configuration to the Query list, we click the "+" button. This will add the query configuration to the Query list:

The "cvr_nummer" query has now been added:

The endpoint we want to request information from also allows us to search for company names. We therefore also add the following "navn" query for the company names:

We can now go back to the "Parameters" list and add the parameters for the queries:

  1. In the input field in the Parameters list, we type in a name for our query. This should correspond to the title we gave our search query. In this case, we titled the query "cvr_number", so we use the same title here.
  2. To add the parameter, we click the "+" button:

The parameters are now added to the Parameters list:

Add Http Endpoint - Google Chrome

We can use the "Test Value" input field to test the configuration of our Http endpoint. We will do this in just a minute.

  1. The "Body" field is disabled because we are using a "GET" Http(s) endpoint action type.
  2. From the documentation of our API, we know that it returns data in JSON format. We therefore use the "application/json" Media type.
  1. In this instance, we provide authentication for using the API in the Authentication header. In this case, we leave the "Credential" field blank.

We can now test our configuration and see if we can get a response from the API:

Add Http Endpoint - Google Chrome
  1. In the "cvr_number" parameter in the Parameters list, in the "Test Value" field, we type in "26082668", which is the CVR number of WorkPoint A/S. Ideally, this should help the API return some company information of WorkPoint A/S.
  1. To test the configuration, we click the "Test" button.

In the window above the Test button, we can see the response we get from the Http endpoint:

The information returned by the endpoint includes a wide range of data, all related to the company we have searched for.

Now that we have a functioning Http endpoint configured and we can get a response from the API, we can generate a schema for the data we get out:

  1. To generate the schema from our test results, we click the "Autogenerate from test" button.

The generated schema now appears in the windows above the "Autogenerate from test" button:

We can now save our configuration and start using our Http endpoint in WorkPoint processes:

Add Http Endpoint - Google Chrome
  1. To save the Http endpoint configuration and save it to our Http Endpoint Library, we click the "Add" button. We can now see the Http endpoint configuration in the Http Endpoint Library:
Http Endpoint Library - Google Chrome

3. Implementing Http endpoints in a WorkPoint process

Please visit this article for a guide on how to implement this configuration example in a WorkPoint process.

Have more questions? Submit a request