https://gen-endpoint.com
, an endpoint path for this API, such as /api/users
, would be accessible at https://gen-endpoint.com/api/users
. You can use the "Try it out" section for each endpoint or use tools like curl
, Postman, or your browser's address bar (for GET requests) to interact with them./api/users
Retrieves a list of users. Supports an optional `limit` query parameter (e.g., `?limit=5`) to control the number of users returned. If no limit is provided, all users are returned (up to the total of 25 mock users).
Show Static Examples
Example Request Parameters:
Path: /api/users?limit=5
Example Response:
[
{
"id": "usr_1",
"name": "Alice Wonderland",
"email": "alice@example.com",
"role": "admin",
"createdAt": "2024-01-10T10:00:00Z",
"profile": {
"bio": "Curiouser and curiouser!",
"avatarUrl": "https://placehold.co/100x100.png"
}
},
{
"id": "usr_2",
"name": "Bob The Builder",
"email": "bob@example.com",
"role": "editor",
"createdAt": "2024-01-11T11:00:00Z",
"profile": {
"bio": "Can we fix it?",
"avatarUrl": "https://placehold.co/100x100.png"
}
},
{
"id": "usr_3",
"name": "Charlie Chaplin",
"email": "charlie@example.com",
"role": "viewer",
"createdAt": "2024-01-12T12:00:00Z",
"profile": {
"bio": "A day without laughter is a day wasted.",
"avatarUrl": "https://placehold.co/100x100.png"
}
},
{
"id": "usr_4",
"name": "Diana Prince",
"email": "diana@example.com",
"role": "admin",
"createdAt": "2024-01-13T13:00:00Z",
"profile": {
"bio": "Wonder Woman",
"avatarUrl": "https://placehold.co/100x100.png"
}
},
{
"id": "usr_5",
"name": "Edward Scissorhands",
"email": "edward@example.com",
"role": "viewer",
"createdAt": "2024-01-14T14:00:00Z",
"profile": {
"bio": "I am not complete.",
"avatarUrl": "https://placehold.co/100x100.png"
}
}
]
You can add or change query parameters in the path above (e.g., ?name=User).
/api/users/{userId}
Retrieves a specific user by their ID. Replace {userId} with an actual ID like `usr_1`.
Show Static Examples
Example Request Parameters:
?userId=usr_1 (Path parameter example: /api/users/usr_1)
Example Response:
{
"id": "usr_1",
"name": "Alice Wonderland",
"email": "alice@example.com",
"role": "admin",
"createdAt": "2024-01-10T10:00:00Z",
"profile": {
"bio": "Curiouser and curiouser!",
"avatarUrl": "https://placehold.co/100x100.png"
}
}
Replace placeholders (e.g., {userId}) with actual values in the path above. You can also add/edit query parameters (e.g., ?key=value).
/api/users
Creates a new user.
Show Static Examples
Example Request Body:
{
"name": "Charlie Brown",
"email": "charlie@example.com",
"password": "supersecretpassword",
"role": "viewer"
}
Example Response:
{
"id": "usr_new",
"name": "Charlie Brown",
"email": "charlie@example.com",
"role": "viewer",
"createdAt": "2024-08-16T14:30:00Z"
}
/api/users/{userId}
Updates an existing user by ID. Replace {userId} with an actual ID like `usr_1`.
Show Static Examples
Example Request Body:
{
"name": "Alice Wonderland",
"email": "alice.wonderland@example.com",
"role": "lead_admin"
}
Example Response:
{
"id": "usr_1",
"name": "Alice Wonderland",
"email": "alice.wonderland@example.com",
"role": "lead_admin",
"updatedAt": "2024-08-16T15:00:00Z"
}
Replace placeholders (e.g., {userId}) with actual values in the path above.
/api/users/{userId}
Deletes a user by ID. Replace {userId} with an actual ID like `usr_2`.
Show Static Examples
Example Response:
{
"message": "User usr_2 deleted successfully.",
"timestamp": "2024-08-16T15:30:00Z"
}
Replace placeholders (e.g., {userId}) with actual values in the path above.