Article published on the 4th of February, 2022.
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' titles and CVR numbers using the company names.
2. Example configuration
We will start by creating a new Http endpoint configuration:
- In the Http Endpoint Library, we click the "Add" button.
- As we will use this Http endpoint to search for companies using company names, we give the Http endpoint a fitting title.
- For now, we leave the "Parameters" list empty.
- We also make sure that the Http endpoint is active.
- 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://s5-certservices.datafordeler.dk/CVR/SoegCVRData/1/rest/soegVirksomhedMedNavn
- 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.
- In this example, we do not need to provide any additional information with the HTTP request, so we leave the "Header" list blank.
- 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 parameter called "pNavn" which is used to provide the company name for which we want to get the corresponding CVR number. In the Key field, we therefore type the "pNavn" parameter name.
- In the "Value" field, we type in square backets a arbitrary 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 [Name].
- To add the Query configuration to the Query list, we click the "+" button. This will add the query configuration to the Query list:
We can now go back to the "Parameters" list and add a parameter for the query:
- In the input field in the Parameters list, we type in a name for our parameter. This should correspond to the title we gave our search query. In this case, we titled the query "Name", so we use the same title here.
- To add the parameter, we click the "+" button:
The parameter is now added to the Parameters list:
- We can use the "Test Value" input field to test the configuration of our Http endpoint. We will do this in just a minute.
- The "Body" field is disabled because we are using a "GET" Http(s) endpoint action type.
- From the documentation of our API, we know that it returns data in JSON format. We therefore use the "application/json" Media type.
- The API we are using requires authentication. For this example, we have set up an authentication configuration which we can use as credentials for calling the API. In this example, our authentication configuration is called "WP".
We can now test our configuration and see if we can get a response from the API:
- In the "Name" parameter in the Parameters list, in the "Test Value" field, we type in "workpoint". Ideally, this should help the API return some company information, including the CVR number of WorkPoint A/S.
- 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:
Note that one of the returned properties of the returned object is the "CVRNummer" which is the CVR number of WorkPoint A/S.
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:
- 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:
- 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:
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.