Consuming data products through APIs
Activate API endpoints to query, filter, and consume your data across tools and ecosystems. Once the endpoints are activated, you can access your data through OData-compliant APIs.
Activating the API endpoints
- From the Data products menu, click the data product for which you want to activate API endpoints.
- From the Overview tab, click Edit > API endpoints.
The Edit data product window opens.
- Select the datasets for which you want to activate API endpoints.
- Click Save.
You are back to the Overview tab and the API endpoints option is available in the Actions menu in the top-right corner.
The API endpoints are created and you can configure them.
When the data product is activated on the marketplace, the API endpoints are also activated in the active version on the marketplace.
Configuring the API endpoints
After you activated the API endpoints, you can configure the connection that must be used to consume the datasets.
File-based endpoints are consumed in the same storage as for the dataset.
- From the Overview tab, click
> Consume in > API endpoints.
The API endpoints window is open.
- If necessary, select another connection.
Your changes are automatically saved.
Using the APIs
Once the API endpoints are activated, you can use queries to consume your data in other tools.
The OData protocol is used. For more information, see the Microsoft documentation.
The format of a query in Power Query or PowerBI is:= OData.Feed("url-of-the-dataset", null, [Headers = [Authorization = "Bearer your-api-key"]])
You need to adapt the following to your usage:
url-of-the-dataset
. Replace this part by the URL from the API endpoints window.your-api-key
. Replace this part by your API key.
- Activate the API endpoints. See the procedure above.
- Generate an API key if you do not have one already. For more information, see Generating and managing API keys.
- Open the tool of your choice to fetch the data. In this example, PowerBI is used.
- Click Get Data > Blank query.
- Enter the query.
Here is an example of a query that you can adapt and use in Power Query or PowerBI to retrieve data from one dataset.
= OData.Feed("https://qcs.us.qlikcloud.com/api/data-governance/data-access/data-products/687e50d58d4773120e843007/datasets/687e508ee636a966d6a6f9e4/connections/9d0d8a52-33a8-4d46-be28-068b4fd06282", null, [Headers = [Authorization = "Bearer your-api-key"]])
- If you want to retrieve data from other datasets, create a query per dataset.
- Click Close & Apply to apply your queries.
- When the data is imported, define the relationships between the tables.
- Click Manage relationships > New relationship.
- Select the tables and save.
- Create as many relationships as needed.
When the relationships are configured, you can view your data in charts.