This tutorial walks through the steps required to connect to a public endpoint using Assette Interface Data Blocks to make an API Call. For the purposes of this tutorial, we will be using the REST Countries API. Additional documentation of the REST Countries API can be found on the official REST Countries website.
About Public APIs #
Public APIs may also be called external or open APIs. These APIs are available for anyone to use with little to no restriction. In general, the primary purpose of a public API is to make information available to the public. For the purposes of this tutorial, we will be using the REST Countries API. Additional documentation of the REST Countries API can be found on the official REST Countries website.
Connecting to a Public Endpoint #
Prerequisites
- Access to an Assette
- User has “Data Block Viewer” and “Data Block Editor” roles assigned
- Basic understanding of APIs
- Basic understanding of Assette Data Blocks
Firstly, navigate to the Data Block Editor, which is found in the Developer Center. If you are unfamiliar with the Developer Center or Data Blocks, it is highly recommended to first read through the relevant sections on the Data Block Editor.

In the Data Block Editor, click on the “Create New” button on the upper right-hand side of the screen.

On the General Info screen, give a name to the new Data Block, and assign the fields as shown below. A more detailed explanation of each field can be found in the respective sections of the Data Block Editor Overview and Creating & Editing Data Blocks articles.
Field | Value |
---|---|
Name* | Use any letters (upper/lowercase), numbers, hyphens or underscores |
Block Category* | Interface |
Block Type* | API Call |
Output Type* | None or Data Table |
Data Category | Select any, or leave blank |
Description | Use any letters (upper/lowercase), numbers, hyphens or underscores |

Once the General Info section has been filled out, click on the “Definition” tab. On the definition tab, enter the following code block.
# This API request sends a GET request to the REST Countries API and retrieves data for all countries. The "jsonpath_for_data" parameter is set to retrieve the data for the first country in the response.
{
"baseUrl": "https://restcountries.com/v3.1/all",
"method": "GET",
"jsonpath_for_data": "$[0]"
}

If you have elected to select “Data Table” as the Data Output type on the General Info tab, you can optionally select “Basic HTTP” from the template dropdown, though doing so override the current definition of the Data Block. This would normally be used when building a new Data Block API Interface and need a starting template. It is OK to leave this field as “None” or blank.

To preview of the Data Block, the Data Block must first be saved (you do not need to publish). Click the “Save” button in the upper right-hand side of the screen. The Metadata, Dependencies, and Versions tabs can be left as they are.

After clicking the “Save” button, click on the Preview tab, and select “Preview” in the upper right-hand corner to test the Data Block.
Troubleshooting #
Symptom | Resolution |
---|---|
Preview button is not enabled/Cannot Preview Data Block | Save the data block. Refresh the page |
Changes don’t seem to have effect | Save the data block. Always save after making a change to ensure the latest version is used |
Received error message when previewing | Ensure that the code block was copied correctly, including open/close curly brackets “{}” |
For additional documentation of the REST Countries public API, please consult the official REST Countries website.