Back Home

API Reference - Version 1.2

This section details the available endpoints for managing user data within the system.

User Endpoints

Get All Users

Retrieves a list of all users. Supports pagination and filtering.

GET /api/v1.2/users

Query Parameters

Name Type Required Description
page integer No Page number for pagination. Defaults to 1.
limit integer No Number of items per page. Defaults to 20.
status string No Filter users by status (e.g., 'active', 'inactive').

Response Example (200 OK)

[
  {
    "id": "usr_abc123",
    "username": "alice_wonder",
    "email": "alice@example.com",
    "status": "active",
    "created_at": "2023-10-27T10:00:00Z"
  },
  {
    "id": "usr_def456",
    "username": "bob_builder",
    "email": "bob@example.com",
    "status": "inactive",
    "created_at": "2023-10-26T14:30:00Z"
  }
]
                

Create New User

Registers a new user in the system.

POST /api/v1.2/users

Request Body

Requires a JSON object with user details.

Name Type Required Description
username string Yes Unique username for the new user.
email string Yes User's email address.
password string Yes User's chosen password.

Response Example (201 Created)

{
  "id": "usr_ghi789",
  "username": "charlie_chap",
  "email": "charlie@example.com",
  "status": "pending",
  "created_at": "2023-10-27T11:15:00Z"
}
                

Get Specific User

Retrieves details for a single user by their ID.

GET /api/v1.2/users/{userId}

Path Parameters

Name Type Required Description
userId string Yes The unique identifier of the user to retrieve.

Response Example (200 OK)

{
  "id": "usr_abc123",
  "username": "alice_wonder",
  "email": "alice@example.com",
  "status": "active",
  "created_at": "2023-10-27T10:00:00Z",
  "last_login": "2023-10-27T12:05:00Z"
}
                

Response Example (404 Not Found)

{
  "error": "User not found",
  "message": "The user with ID 'usr_nonexistent' could not be found."
}
                

Update User Information

Modifies existing user details. Only provided fields will be updated.

PUT /api/v1.2/users/{userId}

Path Parameters

Name Type Required Description
userId string Yes The unique identifier of the user to update.

Request Body

A JSON object containing the fields to update.

Name Type Required Description
email string No New email address.
status string No New status ('active', 'inactive').

Response Example (200 OK)

{
  "id": "usr_abc123",
  "username": "alice_wonder",
  "email": "alice.updated@example.com",
  "status": "active",
  "created_at": "2023-10-27T10:00:00Z",
  "updated_at": "2023-10-27T13:00:00Z"
}
                

Delete User

Removes a user from the system. This action is irreversible.

DELETE /api/v1.2/users/{userId}

Path Parameters

Name Type Required Description
userId string Yes The unique identifier of the user to delete.

Response Example (204 No Content)

A successful deletion returns no content.

Response Example (404 Not Found)

{
  "error": "User not found",
  "message": "The user with ID 'usr_nonexistent' could not be found."
}
                
Read the User Guide on Reporting Issues