Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Preview

How an API gives access to data

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

30 minutes

Where does the trip list live?

A phone app shows a list of school trips. The list does not live on the phone. It lives in a database (an organised store of data) on a server (a computer that shares data with other computers).

How does the app get it? It sends a request to an API (a door that lets one program ask another for data). In this lesson you see how that door works.

Key words

WordWhat it meansExample
DatabaseAn organised store of data in tables.A table of trips
APIA door that lets one program ask another program for data.The trips API
RequestA message sent to an API to ask for something.Give me all trips
ResponseThe answer an API sends back.A list of trips
EndpointThe web address of one kind of data on an API./trips
JSONA text format for data that programs read easily.{"place":"Zoo"}
PermissionA rule that says who may view data and who may change it.Only a teacher may change marks

The cells students fill in are left blank in this preview.

Quick check: the picture

Have a go

Quick check: the picture

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Request in, response out

A request asks for something at an address. The address is an endpoint, such as /trips.

The response is the answer. It is often written in JSON, a text format that programs read easily.

A request can ask to read data. It can also ask to change data.

One request and its response

PartExampleWhat it means
RequestGive me all tripsThe app asks for data
Endpoint/tripsThe address of the trips data
Response[{"place":"Zoo"},{"place":"Museum"}]The answer, written in JSON
Another requestAdd a trip called ParkThis changes data, so permission is checked

The cells students fill in are left blank in this preview.

Quick check: read the example

Have a go

Quick check: read the example

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

The lesson goes on

21 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.