Get Users API
Returns a list of 10 sample users, or a single user when an id is passed. No authentication required.
| Property | Value |
|---|---|
| Method | GET |
| Base URL | https://labs.lowcademy.com/apis/ |
| File | users.php |
| Authentication | None |
| Request Body | Not required |
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | Integer | Optional | Return a single user by ID (1–10). Omit to return all users. |
Get all users
curl https://labs.lowcademy.com/apis/usersGet a single user by ID
curl https://labs.lowcademy.com/apis/users?id=3JavaScript (fetch)
const res = await fetch('https://labs.lowcademy.com/apis/users'); const data = await res.json(); console.log(data.count); // 10 console.log(data.data[0]); // first user object
| Field | Type | Description |
|---|---|---|
| success | Boolean | Always true on success |
| count | Integer | Total number of users returned |
| data | Array | Array of user objects |
| data[].id | Integer | User ID (1–10) |
| data[].name | String | Full name |
| data[].email | String | Email address |
| data[].role | String | Admin, Manager, or User |
| data[].city | String | City |
| data[].joined | String | Date joined. Format: YYYY-MM-DD |
{
"success": true,
"count" : 10,
"data" : [
{
"id" : 1,
"name" : "Ankit Gangrade",
"email" : "ankit@example.com",
"role" : "Admin",
"city" : "Mumbai",
"joined": "2024-01-15"
},
// ... 9 more users
]
}{"success":false,"error":"User not found."}