Learn Everything

Paths/Backend Engineer/HTTP & Networking / Request Lifecycle

Guided Taskbeginnerubuntu:24.04Ask AI

Choose Methods That Are Safe to Retry

A client will retry what it is not sure about, so the method you choose decides whether a retry duplicates an order. Write the contract.

Validator

⏱ 0:00

IDLE — checks run live as you type commands; submit when done

01Requirements

live checks
  • Directory ~/http exists○
  • File ~/http/api-contract.yaml exists○
  • The file lists the methods and what each one does○
  • The file marks which methods are idempotent○

02Walkthrough

3 steps
  1. 01

    Create the http directory

    The wire contract is a document, not a memory.

    mkdir -p ~/http
  2. 02

    Write the method contract

    GET reads, POST creates, PUT replaces, PATCH changes part of it, DELETE removes. The verbs carry the retry semantics.

    echo 'methods:\n - method: GET\n purpose: read a resource\n idempotent: true\n - method: POST\n purpose: create a resource\n idempotent: false\n - method: PUT\n purpose: replace a resource\n idempotent: true' > ~/http/api-contract.yaml
  3. 03

    Verify and submit

    cat the contract, then submit for validation.

    cat ~/http/api-contract.yaml

03Stuck?

0 of 3 revealed

Take a hint without losing the lab — each one points at the thing to look at, not at the answer.

04AI Tutor

guides, never solves

Tell me what you're stuck on — I'll nudge, not solve. Which requirement are you looking at?

04Notebook

saved locally in this browser

learner@lab — ubuntu:24.04

↑/↓ recalls commands · Ctrl+Enter submits · type help for the command list