How to use external APIs with the JSON connector?

First, select the JSON/CSV/XML connector in Dataslayer.

Next, find the API you want to use at this link (you can also use other public APIs if you have the link).

For this example, we will use the Coinbase API. Inside the Dataslayer, in the URL field, copy the "base endpoint" link, (in this case, https://api.coinbase.com/v2/).

Browser template (3)-3

Next, copy the "popular endpoints" link you are interested in, deleting the first slash, so that it does not appear duplicated when joining the previous link. (In this case, we add to the previous URL"/v2/exchange-rates", and the resulting URL would be https://api.coinbase.com/v2/exchange-rates.

Enter this link in the Dataslayer "URL" field. It is not necessary to fill in the rest of the fields to obtain the data. When you click on "generate table", the result will be displayed in Dataslayer.

Browser template (2)-4

Technical information: The JSON (or other type) call simulates a CURL (or Postman) call. If it is necessary to send arguments to it, they must be added to the URL. If it is a POST type, the parameters must be added in the request (besides adding in the header the format in which it is given) and if it is also necessary to use credentials, they must be added in the header.


If you make the call with Postman you can check what the code of the call would look like, because you have to put the same.

 

As always, please contact us via our live chat on our website or via email if you still have doubts or questions. We are happy to help!