Skip to content
CodeKruPro

Send your first API request

2/32

01 · Read and understand requests

Recommended first: Understand an API before sending a request

Your goal: ask for users and understand the response

No code, installation or practice login token is needed. Follow these three steps on this page.

  1. 1Send the request
  2. 2Read and answer
  3. 3Submit answers

Start here: sign in to practise, then click Send request.

Jump to practice

What you are doing

An API lets one program ask another for data. Here, you will ask TestKru for a list of sample users, inspect its reply, and record three facts. Everything you need is on this page.

1. Send your request

Find Send your request. The method GET means “read data”; the URL is the address to contact. Both are already filled in. Leave them unchanged and click Send request. You do not need to open Optional request settings.

2. Read the response and answer

The API's reply appears below the button under Response from TestKru. Use it to fill in the three answer fields:

  1. Status code: copy the number labelled Status code. This API should return 200, meaning it handled the request successfully.
  2. First user's name: in Response body, find the first object's name field. Type only the name, without quotation marks. Square brackets [ ] surround the user list; braces { } surround each user object.
  3. Content-Type (media type): read Content-Type above the response body. It tells you the data format. Enter only the part before any semicolon. For example, from application/json; charset=utf-8, enter application/json.

Your first successful GET is selected automatically for checking. The selected request connects your answers to the response you inspected. If you retry and want to use a different response, open Choose a different recorded request.

3. Submit your answers

Click Submit Answers. The result appears below Submit Answers, with your score and a result for each check. If a check needs attention, correct that answer and submit again. When all checks pass, this assignment is complete and saved. Click Continue to the next lesson to move on.

What this teaches you

The status tells you how the request was handled; Content-Type describes the response format; the body contains the actual data. Check all three. A 200 status alone does not prove every field is correct.

Optional self-review

In your own words, what is the difference between the request URL, response status, and response body? If you received no reply at all, could you call that a 404? You do not need to submit a written self-review to continue.

The users are fictional. If you receive 429, wait a minute and try again; it means too many requests, not a successful user-list response.

Open API reference

Practise and save your evidence

The lesson is public. Sign in to send requests and save progress. You will return to this lesson.

Sign in to practiseCreate an account