Before writing code against an API, you probe it. The client below talks to the Harbour Market API (the same code as the server in project/server/); its reference is in api.html. Write the requests yourself: method, path, headers, body. Answer the eight questions from what the server sends back.
Reading a response. The first line is the status. Then the headers, one per line. After the blank line, the body. The right-hand panel shows the same request written as fetch() and as curl.
How many stalls does the market have?
Two ways: count the array, or find the header that says it.What status code does GET /api/stalls/pizza answer?
What is Mezcal Moon's average rating? Its id is mezcal.
Which food stall is the cheapest? Let the server filter and sort.
The query parameters are in api.html.POST a valid review for Taco Bike. Which status comes back?
Valid: an author, a rating from 1 to 5, a text of 10–280 characters.Which response header holds the URL of the review you just created?
Send the same POST without the Content-Type header. Which status?
Which methods does /api/stalls allow? Ask it with a method it doesn't support, and read the headers.
PUT, PATCH.