Getting started
Quickstart
Three requests that cover most of what you will do with Mock APIs: read a list, create a record, and log in.
1. Read a list
List endpoints return an array named after the resource plus pagination metadata. Ask for two products with limit=2:
curl 'https://test.naimulhassan.me/api/v1/products?limit=2'The response looks like this (trimmed to two records):
{
"products": [
{
"id": 1,
"title": "Lumio Nova X5 Smartphone",
"description": "The Lumio Nova X5 Smartphone features all-day battery life and water and dust resistance. A dependable choice from Lumio.",
"category": "smartphones",
"brand": "Lumio",
"price": 1190.99,
"discountPercentage": 21.56,
"rating": 2.9,
"stock": 50,
"sku": "SMA-LUM-0001",
"tags": [
"mobile",
"5g",
"electronics"
],
"availabilityStatus": "In Stock",
"thumbnail": "https://test.naimulhassan.me/api/v1/images/products/1"
},
{
"id": 2,
"title": "Lumio Nova X5 Pro Smartphone",
"description": "The Lumio Nova X5 Pro Smartphone features water and dust resistance and a dual-lens camera system. A dependable choice from Lumio.",
"category": "smartphones",
"brand": "Lumio",
"price": 306.99,
"discountPercentage": 9.03,
"rating": 4.4,
"stock": 146,
"sku": "SMA-LUM-0002",
"tags": [
"mobile",
"5g"
],
"availabilityStatus": "In Stock",
"thumbnail": "https://test.naimulhassan.me/api/v1/images/products/2"
}
],
"total": 100,
"skip": 0,
"limit": 2
}2. Create a record
Send JSON with a Content-Type: application/json header. The API validates the body and answers 201 Created with the new record and the next available ID. Writes are simulated: the response is realistic, but the shared dataset does not change.
curl -X POST 'https://test.naimulhassan.me/api/v1/posts' \
-H 'Content-Type: application/json' \
-d '{
"title": "My first API request",
"body": "Today I sent my first request to Mock APIs.",
"userId": 5
}'3. Log in with a demo account
Exchange the public demo credentials for an access token, then send it as Authorization: Bearer <token> to protected endpoints such as /auth/me.
curl -X POST 'https://test.naimulhassan.me/api/v1/auth/login' \
-H 'Content-Type: application/json' \
-d '{
"username": "emilyc",
"password": "emilycpass",
"expiresInMins": 30
}'Use the token
curl 'https://test.naimulhassan.me/api/v1/auth/me' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'Demo authentication is for practice only. Never reuse these patterns or credentials to secure a real application.
What next?
- Learn the shared conventions in Getting started.
- Explore filters and sorting in Pagination & query params.
- Try any endpoint interactively in the Playground.