1. Generate sample data
Describe a schema and get JSON records you can use in tests and demos.
Learning hub
Never heard of a REST API? Start here. This guide teaches the ideas, the vocabulary, and the patterns you need — then shows how to practise them in AOTG.
An API (Application Programming Interface) is a contract that lets one program talk to another in a predictable way. Instead of opening a website in a browser, your app sends a structured request and gets a structured response back.
Think of a restaurant: you don’t walk into the kitchen. You use a menu (the API) to ask for what you want, and the kitchen returns a dish (the response).
REST (Representational State Transfer) is a popular style for designing web APIs. A REST API usually:
You will often hear “REST API”, “RESTful API”, or simply “HTTP API”. In day-to-day work they refer to the same idea: call a URL with a method and get JSON back.
The method tells the server what kind of action you want. Memorise these five:
| Method | Meaning | Example |
|---|---|---|
GET |
Read data. Safe — should not change anything. | Fetch a list of users |
POST |
Create something new. | Create an order |
PUT |
Replace a whole resource. | Overwrite a profile |
PATCH |
Update part of a resource. | Change only the email |
DELETE |
Remove a resource. | Delete a cart item |
GET /users → list users
GET /users/42 → one user
POST /users → create user
PATCH /users/42 → update user
DELETE /users/42 → delete user
A REST URL points at a resource — a thing your API manages, such as
/products, /orders, or /users/42.
/products — many items/products/17 — one item by id/users/42/orders — orders belonging to a userQuery parameters refine a request without changing the resource identity:
GET /products?count=20&category=shoes
Good REST URLs use nouns (resources), not verbs. Prefer POST /orders over
/createOrder.
Every response includes a three-digit status code. Learn the families:
| Range | Meaning | Common codes |
|---|---|---|
2xx |
Success | 200 OK, 201 Created, 204 No Content |
4xx |
Client error (your request) | 400 Bad Request, 401 Unauthorized, 404 Not Found |
5xx |
Server error | 500 Internal Server Error, 503 Unavailable |
404 with a helpful
JSON message is still a failure.
JSON (JavaScript Object Notation) is the most common data format for REST APIs. It looks like this:
{
"id": 42,
"name": "Ava Nkosi",
"email": "ava@example.com",
"active": true
}
On POST / PUT / PATCH you usually send JSON in the
request body and set:
Content-Type: application/json
Arrays represent lists: [{...}, {...}]. Nested objects model related data.
Headers are metadata sent with every request or response. Important ones for beginners:
Content-Type — what format the body uses (often application/json)Accept — what format you want backAuthorization — credentials (for example a Bearer token)User-Agent — which client is callingGET /v1/me HTTP/1.1
Host: api.example.com
Accept: application/json
Authorization: Bearer eyJhbGciOi...
Public endpoints need no login. Protected endpoints require proof of identity:
Never put long-lived secrets in frontend source code that anyone can download. Prefer server-side storage or short-lived tokens.
GET, HEAD) should not change
server state.
PUT, DELETE) can be
repeated with the same end result.
POST is usually not idempotent — calling it twice may create two
records.
Reading alone is not enough. AOTG lets you generate realistic JSON and stand up temporary mock REST endpoints so you can call them from Postman, curl, or your frontend.
Describe a schema and get JSON records you can use in tests and demos.
Publish a temporary REST URL that returns schema-shaped responses.
Turn an OpenAPI document into a mock project with routes ready to call.
# Example: call a mock collection (replace BASE with your mock URL)
curl "$BASE/products?count=5"
# Create an item
curl -X POST "$BASE/orders" \
-H "Content-Type: application/json" \
-d '{"total":42,"status":"pending"}'
Open the app Mock recipes AOTG OpenAPI Create a free account
GET /users.