In this lesson
The Big Idea
You do not always have to collect data yourself; many organisations publish useful data under terms that allow it to be reused. This is open data. You can download it in a browser, or your program can request it directly through an API (Application Programming Interface): the program sends a request to an endpoint, and the server replies with a response carrying the data, often in JSON format. But "open" does not mean "no rules": every dataset has terms of use to respect and a source to cite.
What Is Open Data?
Open data is data available for anyone to use under a clear licence or terms that allow access, reuse and redistribution. The Arabic edition stresses an important point: being public or free does not, on its own, make data open. A chart on a website, or a table you can view for free, is not necessarily something you are allowed to republish. What makes data open is a licence that explicitly allows it.
Who publishes open data? Government bodies, organisations, researchers and companies. But licences, quality and definitions vary from one dataset to another, even on the same website.
Four things to check before you use it
- Source and quality: who published it? When was it last updated? How was it collected?
- Access method: is it a direct download, an API, or other tools the source provides?
- Licence or terms of use: what are you allowed to do with it?
- Fit to the analysis question: are its definitions, years and categories what you actually need?
These steps support responsible use, but on their own they do not guarantee a good result; the quality of the result also depends on the quality of the data itself and the method you analyse it with.
Main Sources of Open Data
The book gives three examples of portals and platforms with useful data, reminding you that each dataset's terms still need checking, even from a well-known source:
| Provider | What does it offer? | Useful for | |---|---|---| | World Bank Open Data | Statistics on the economy, population, education and health for countries around the world | International comparisons, provided the definitions and time periods suit your question | | UN Data | International statistics published by the United Nations and its agencies | A range of international topics, after checking each indicator's source and definition | | Kaggle | A platform for data analysis competitions, where datasets in many fields are available to the public | Getting data to study and research machine learning, after evaluating each dataset's source and licence |
Notice how Kaggle is different: its datasets are uploaded by many different users and organisations, so the book insists on evaluating each dataset's source and licence separately.
Access methods also differ: a direct download of a file in the browser, an API, or other tools the source itself provides.
Getting Data Through APIs
An API (Application Programming Interface) is a set of rules that lets one program request data or functions from another program or service. Instead of opening a website, searching and clicking "download" yourself, your program can send the request directly to the API. This helps when you need to repeat requests (say, every day) and process the results automatically, within the limits the service sets.
The request–response sequence
- Request: the client, meaning your program, sends a request to an endpoint, a specific address or path in the API that accepts a certain kind of request.
- Response: the server processes the request and sends back a response that may contain data or an error message, in a format the service defines.
- Use: the program reads the response, then uses the data for analysis or an app, or handles the error, depending on what came back.
Example: a weather app
The weather app on your phone does not measure temperature itself; it sends a request to a weather service. Imagine the endpoint of an example service is:
https://api.example.org/weather?city=AswanThe server replies with a response like:
{
"city": "Aswan",
"date": "2026-11-27",
"temp_c": 31,
"condition": "sunny"
}The app reads the value linked to temp_c and shows it to you. If it asks for a city that does not exist, an error message may come back instead of data, such as:
{
"error": "city not found"
}Then the program has to handle the error, for example by showing the user a clear message instead of crashing or displaying an empty number.
What is JSON?
JSON (JavaScript Object Notation) is a common text format for representing structured data using objects (name–value pairs inside curly braces), arrays (lists inside square brackets) and various values such as text and numbers. Many languages and tools support it, but it is not the only format an API may use; the service decides the format.
Using Data and Citing the Source
Terms of use
Open data comes with a licence or terms that set out what is allowed when accessing, reusing and redistributing it. So read that dataset's own terms before using it: one dataset may allow republishing in a public report, while another sets different conditions.
Citing the source
Use the data according to the licence and attribute it to its source in the required way. An attribution or citation may include:
- The publisher.
- The dataset name.
- The version, update date or access date.
- The link to the source.
All of this follows the provider's requirements and the citation standard being used.
Does citing the source prove the data is reliable?
No. Citing the source does not by itself prove that the data is reliable. But it helps others find the data, evaluate it and review your analysis. The quality of the data and the method still need independent evaluation. Think of a chart shared online with no source: you have no idea where its numbers came from or how to check them. One source line turns it from a claim into something that can be checked.
Try It Yourself
Common Mistakes
"If data is free and online, it is open"
Being public or free is not enough. Data is open when there is a licence or clear terms that allow access, reuse and redistribution.
Look for the licence or terms of use before assuming data is open.
"Open data doesn't need its terms checked"
Every dataset has its own terms, and datasets on the same site can differ.
Read that dataset's own terms and use it according to its licence.
"Whatever comes through an API isn't covered by the terms of use"
An API is only a way of accessing data; it does not change your rights to use it.
API access does not cancel the licence; respect request limits and storage and publishing policies.
"Citing the source proves the data is correct"
According to the Arabic edition, citing the source does not prove reliability by itself.
A citation lets others find the data, evaluate it and review the analysis; the data and the method still need independent evaluation.
"An API always returns data in JSON"
JSON is common but not the only format, and a response may be an error message rather than data.
The service decides the format, and the program must be ready to handle errors.
Key Points
- Open data is available under a licence or terms that allow access, reuse and redistribution; being free does not make data open.
- Before using it, check: source and quality, access method, licence, and fit to the question.
- World Bank Open Data: country statistics (economy, population, education, health). UN Data: statistics from the UN and its agencies. Kaggle: a competition platform with varied datasets for studying machine learning.
- An API is a set of rules that lets a program request data or functions from another service directly, without a browser, making repeated requests and automatic processing easier.
- The sequence: the client sends a request to an endpoint, the server returns a response (data or an error message), and the program uses the data or handles the error.
- JSON is a common text format (objects, arrays, values), but not the only one.
- Citing the source: publisher, dataset name, version or update/access date, and link; it enables checking but does not prove reliability by itself.
FAQ
Is all data on the internet open data?
No. Data is open when its licence or terms explicitly allow access, reuse and redistribution. Being free or visible to everyone is not enough, so always look for the terms of use.
What is the difference between downloading data in a browser and using an API?
When downloading, you open the site and pick the file yourself. With an API, your program sends a request straight to the endpoint and receives the response automatically, which helps when repeating requests or handling lots of data. The same terms of use apply either way.
What should I write in a source line?
Whatever the provider and citation standard require: the publisher, the dataset name, the version or update or access date, and the link. The goal is that a reader can reach exactly the data you used.
Do I need to write a program to use open data?
No. Many sources offer a direct download in the browser. An API is an extra option that helps programs that need to fetch data automatically or repeatedly.