← Back to Sample APIs

Get Users API

Returns a list of 10 sample users, or a single user when an id is passed. No authentication required.

01

Endpoint

GET https://labs.lowcademy.com/apis/users
PropertyValue
MethodGET
Base URLhttps://labs.lowcademy.com/apis/
Fileusers.php
AuthenticationNone
Request BodyNot required
02

Authentication

No authentication required — open endpoint.
03

Query Parameters

ParameterTypeRequiredDescription
id Integer Optional Return a single user by ID (1–10). Omit to return all users.
04

Sample Requests

Get all users

curl https://labs.lowcademy.com/apis/users

Get a single user by ID

curl https://labs.lowcademy.com/apis/users?id=3

JavaScript (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
05

Response — All Users (200 OK)

FieldTypeDescription
successBooleanAlways true on success
countIntegerTotal number of users returned
dataArrayArray of user objects
data[].idIntegerUser ID (1–10)
data[].nameStringFull name
data[].emailStringEmail address
data[].roleStringAdmin, Manager, or User
data[].cityStringCity
data[].joinedStringDate 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
  ]
}
06

Error Responses

200
OK — Users returned.
404
Not Found — No user found with the given ID.
{"success":false,"error":"User not found."}
405
Method Not Allowed — Request was not GET.