Skip to content
Ameen Abozaid
BEG-053

API fundamentals

  • 6 Lessons
  • 61 min of reading
  • 2 h practice (estimate)
On this page 8 topics

Overview

Topics

  • REST concepts
  • endpoint design
  • Postman
  • request/response examples

Learn first

61 min of reading · 2 h of practice (estimate)

Learning outcomes

  1. Explain what an API is and the REST idea of resources.
  2. Read API documentation and make requests to a public API with Postman and curl.
  3. Sketch endpoint designs (URL + method + status) for a simple resource.

Lessons

  1. 01What an API is10 min read
  2. 02REST in plain language10 min read
  3. 03Postman tour10 min read
  4. 04curl from the terminal10 min read
  5. 05Sketching endpoints for a resource11 min read
  6. 06Demo: exploring a public API with Postman and curl10 min read

Lab and exercises

Lab

BEG-053-LAB1 · API explorer

Outcomes: 1–3 · Time: ~2 h Call a public API for a list, a single item, and a filtered query; save a Postman collection; then sketch the endpoints a Library API would need. Acceptance: collection exported; endpoint sketch reviewed.

Exercises (assessment: endpoint design exercise)

IDOutcomeTask
BEG-053-EX011Explain what an API is to a non-programmer in three sentences.
BEG-053-EX021Name the resources in a school system and write their URLs.
BEG-053-EX031Fix these URLs: /getBooks, /createMember, /book/delete/7.
BEG-053-EX042Call a public API with Postman and with curl; compare the responses.
BEG-053-EX052Read an API's docs and call one endpoint with a query parameter.
BEG-053-EX063Sketch endpoints (URL, method, status) for members.
BEG-053-EX073Sketch an endpoint for "loans of one member" and for "overdue loans".
Show solutions
  • EX01 An API is a menu of requests a program may make to another; the provider decides the rules and hides the inside.
  • EX02 /students, /teachers, /courses, /students/5/enrollments.
  • EX03 GET /books, POST /members, DELETE /books/7.
  • EX04 Same data; curl -i also shows status and headers.
  • EX05 For example GET /items?limit=5; check status 200.
  • EX06 GET /members 200; GET /members/{id} 200/404; POST /members 201/400; PUT /members/{id} 200/404; DELETE /members/{id} 204/404.
  • EX07 GET /members/{id}/loans; GET /loans?status=overdue.

Quiz

Outcomes: O1 API and REST resources · O2 Postman and curl · O3 endpoint design.

A self-check for you: nothing is graded, saved or sent anywhere. Choose an answer, then check it. You can try again as often as you like.

  1. 1An API is:O1
  2. 2In REST, URLs should be mainly:O1
  3. 3Which URL is best?O1
  4. 4In curl, -H is used for:O2
  5. 5curl -i shows:O2
  6. 6A Postman collection is:O2
  7. 7A 404 from a documented endpoint most likely means:O2
  8. 8Endpoint to create a book:O3
  9. 9Status for a successful create:O3
  10. 10Filtering by author is best done with:O3

Practical part

Endpoint design exercise: sketch the Library API endpoints (EX06–EX07) and export the Postman collection (lab). Pass: at least 8 of 10 quiz questions and a reviewed sketch with no verbs in URLs.

Common mistakes

Verbs in URLs (/getBooks).

Assessment

Endpoint design exercise.

Career relevance

The Junior capstone builds exactly such an API (JNR-018).

Type to search levels, phases, modules and lessons.