← QCE Digital Solutions Unit 4

Data interface

The agreed point where one system gives data to, or takes data from, another. It sets the format and rules of the exchange, such as a file or an API.

Understanding Data interface in QCE Digital Solutions Unit 4

What it does: This JSON shows an agreed output format with named fields, so the receiving system can read each value predictably. An authorisation header with a token is a rule of the interface that limits access to approved systems only. A data interface is the meeting point between systems. It defines the format and rules for how data is handed over or received. The app makes requests to the service and gets structured responses back. This is an API-based interface.

Common mistakes: A JSON object becomes a Python dictionary, so a field is read with square brackets. It should be print(data["name"]). This file is an output interface, so the program must write to it. The file must be opened in write mode "w", not read mode "r".

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 127–333) and word search (Modules 127–401).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which best describes a data interface?
A screen that only shows data to the userThe agreed point where one system gives data to, or takes data from, another
Matches
Sender saves marks.csv with columns Name, Mark, Year. Receiver expects Year, Name, Mark.
↓
The two systems have not agreed on the interface format. The column order differs, so the receiver will read the wrong data into each field.
Applying
Meanings
Term
data interface
Meaning
The agreed point where one system gives data to, or takes data from, another. It sets the format and rules of the exchange, such as a file or an API.
Practice
// API interface: agreed JSON format
Testing
Gaps
rows = list(.reader(f))
Check Answer
Spots
3data = json.loads(text)
4print(data.name)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Giraffe' badge — High Perspective, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which best describes a data interface?
A. The agreed point where one system gives data to, or takes data from, another ✓
B. A screen that only shows data to the user
A data interface is the meeting point between systems. It defines the format and rules for how data is handed over or received.
2. A school system saves attendance as a CSV file that the payroll system then imports. What type of interface is this?
A. API-based interface
B. File-based interface ✓
The two systems exchange data through a file that one writes and the other reads, so it is a file-based interface.
3. A weather app sends a request to a web service and receives JSON in reply. What type of interface is this?
A. File-based interface
B. API-based interface ✓
The app makes requests to the service and gets structured responses back. This is an API-based interface.
4. Which statement about the format of a data interface is correct?
A. Both systems must agree on the input and output format, such as CSV or JSON ✓
B. Each system can choose its own format without telling the other
An interface only works if the sender and receiver agree on the format. If the formats do not match, the data cannot be read correctly.
5. A receiving system expects dates as 2026-03-14 but the sending system outputs 14/03/26. What is the problem?
A. The output format does not match the format the interface expects ✓
B. The interface has too many users
The interface defines the rules for the exchange, including date format. A mismatch means the receiving system may reject or misread the data.

Match the Pairs

GET https://api.school.edu.au/students/101 → A request to an API-based data interface that asks the school system to hand back the record for one student
students_export.csv → A file-based data interface where one system saves data in an agreed format for another system to read
An interface defines the output format, so the receiving system knows exactly how the data will be structured → {"studentId": 101, "name": "Ava", "yearLevel": 12}
An interface controls who can use it, so a system must prove who it is before it can take data → Authorization: Bearer abc123token
Sender saves marks.csv with columns Name, Mark, Year. Receiver expects Year, Name, Mark. → The two systems have not agreed on the interface format. The column order differs, so the receiver will read the wrong data into each field.
A public API returns every student's address and health notes to any system that asks, with no login. → The interface has no rule about who can use it. Anyone can take sensitive data, so access should be limited to approved, authenticated systems.

Key Term

data interface
The agreed point where one system gives data to, or takes data from, another. It sets the format and rules of the exchange, such as a file or an API.

Fill in the Blanks

1. with open("orders.csv") as f: rows = list(csv.reader(f))
Hint: Type the name of the Python module that reads comma-separated files, a common file-based interface.
2. url = "https://api.school.au/marks" reply = requests.get(url)
Hint: Type the requests function that asks an API to send data back, named after the HTTP method.
3. record = {"id": 7, "mark": 88} output = json.dumps(record)
Hint: Type the json function that turns a dictionary into JSON text so another system can read the output.
4. with open("export.csv", "w") as f: f.write("id,mark\n")
Hint: Type the single-letter file mode that lets the program write an export file for another system.
5. headers = {"Authorization": "Bearer " + key} reply = requests.get(url, headers=headers)
Hint: Type the keyword argument name that carries the credentials, so only permitted users can use the API.

Spot the Error

Question 1
A import json
B text = '{"name": "Ava"}'
C data = json.loads(text)
D print(data.name)
Line D — A JSON object becomes a Python dictionary, so a field is read with square brackets. It should be print(data["name"]).
Question 2
A import csv
B f = open("out.csv", "r")
C w = csv.writer(f)
D w.writerow(["id", "mark"])
Line B — This file is an output interface, so the program must write to it. The file must be opened in write mode "w", not read mode "r".
Question 3
A import requests
B h = {"x-api-key", key}
C r = requests.get(u, headers=h)
D print(r.status_code)
Line B — Headers must be a dictionary of name: value pairs. A comma instead of a colon makes a set, so the API key is not sent properly. It should be {"x-api-key": key}.
Question 4
A import json
B student = {"id": 7, "name": "Zoe"}
C out = json.loads(student)
D print(out)
Line C — To send a dictionary in the agreed JSON output format, it must be turned into text with json.dumps(). json.loads() does the opposite and parses JSON text.
Question 5
A import csv
B total = 0
C with open("sales.csv") as f:
D rows = csv.reader(f)
E for r in rows:
F total += int(r["amt"])
Line D — csv.reader gives each row as a list, so r["amt"] fails. The column name only works with csv.DictReader(f), which matches the file's header names.

Student with a class code? Join your class →