Intranets and Federated Search
Using Statista’s Discovery Advanced API to search for content
Statista does not allow for crawling systematically across our data. If you attempt to do so; we will disable your API key.
In the case where you want to show Statista content to your users based on a search query in a federated search system or intranet; this guide is for you.
This guide will use the Discovery Advanced API and requires an API Key.
Using Python, you’ll learn how to:
- Configure variables needed for HTTP client
- Execute an API query
- Render information returned back by the Statista API
1. Configure variables needed for HTTP client
You’ll connect to the API using a request header: x-api-key
. In order to fetch
content, you’ll need to decide which endpoint you want to request from;
/statistics
, /marketInsights
, /studies
or /infographics
. See API Reference.
For this example we’ll fetch content from /statistics
with
two parameters.
This is the basic setup you’ll need to get this example running on your machine - we don’t recommend using this code in production.
2. Execute an API query
Next, we can execute a request and get a response from the API.
3. Render information returned back by the Statista API
While you can do this in a multitude of ways; we’ll show an example for putting the received data into a pandas data frame - and show you what that looks like:
Which yields a structured table:
Index | ID | Title | Subject | Premium | Description | Link | Date | Sources | Chargers | Geolocations | Industries | Platform | Teaser Image URL | Image URL | XLS File | PDF File |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 910248 | South Korea: total WKBL basketball games attendance 2023 | Total number of spectators in the Women’s Korean Basketball League | True | In 2023 in South Korea, over 93 thousand people attended… | Link | 2024-08-26T12:00:00Z | Ministry of Culture, Sports and Tourism (MOT) | Ministry of Culture, Sports and Tourism (MOT) | Korea, South | Basketball | en | Image | Download | Download | Download |
1 | 910245 | South Korea: total KBL attendance 2023 | Total number of spectators in the Korean Basketball League | True | In 2023, around 690 thousand people attended… | Link | 2024-08-26T12:00:00Z | Ministry of Culture, Sports and Tourism (MOT) | Ministry of Culture, Sports and Tourism (MOT) | Korea, South | Basketball | en | Image | Download | Download | Download |
2 | 193467 | Total NBA league revenue 2024 | National Basketball Association total league revenue | True | During the 2023/24 season, the 30 franchise teams in the NBA generated… | Link | 2024-10-24T12:00:00Z | Forbes | Forbes | United States | Basketball | en | Image | Download | Download | Download |
3 | 910300 | South Korea: KBL games number 2023 | Number of matches in the Korean Basketball League | True | In South Korea in 2023, there were a total of 54 games in the… | Link | 2024-08-26T12:00:00Z | Ministry of Culture, Sports and Tourism (MOT) | Ministry of Culture, Sports and Tourism (MOT) | Korea, South | Basketball | en | Image | Download | Download | Download |
4 | 193503 | Average revenue of NBA teams 2024 | National Basketball Association average revenue by team | True | During the 2023/24 season, the average revenue for NBA teams reached approximately… | Link | 2024-10-24T12:00:00Z | Statista | Forbes, Statista | United States | Basketball | en | Image | Download | Download | Download |
(See API Reference for more info on what data is available)