Connection
APIs usually employ some sort of authentication/authorization to limit access to their endpoints.
Make platform provides you with a list of the most used types of connections while in every each there is a code prefilled. You only need to edit it up to your and/or API's needs.

Mostly, you will need to change the URLs and names of the parameters.
Setting up a connection for our demo API
While the
/helloworld
endpoint was accessible without any authentication/authorization, the other endpoints of the Demo API will require an API key.Let’s try to call endpoint
/books
that should respond with a list of books in the library:http://demo-api.integrokit.com/api/v1/books
Without providing the API key, the response will contain the following error:
To enable the user of your Module to specify her/his own API key (assuming each user has got her/his own API key to access the API), you need to create a Connection.
We have covered the basics of creating a simple module. Since the /books
endpoint will always return an array with items, you will need to create a new module type Search. Now, let’s see how to update our search module with a variable API token for each user.
Click the tab Connections. The (probably still empty) list of all your connections will be shown. Click the large button with the plus sign and choose Create a new Connection. A dialog will pop up, where you can name your connection and choose its type. Fill the dialog as shown and click Save.

The new Connection will appear in the list. Click the new Connection. A page with two tabs will be shown: COMMUNICATION and PARAMETERS.
A pre-configured communication will look like this:

Since our Demo API doesn't have any suitable endpoint, we will not use any.
The code should be as below:
Once you finish the connection configuration, you can go back to your search module and click Attach Connection.

An Attach Connection dialog will appear. There, select the currently created connection.

When we are setting up a connection, we should not forget about the base!
As you remember, in base, there should be everything common to all modules and remote procedures, e. g. baseUrl, authorization, sanitization, error handling, etc.
Therefore, click BASE tab and edit the code:
Awesome! You just learned how to add a new connection, attach it to an existing module, and map the connection data in base. Now, it is the right time to learn, how to make error handling, continue below.
Last updated