API Reference

User Management

GET /users

GET
Retrieves a list of all users in the system. This endpoint is typically used for administrative purposes.

Query Parameters:

Name Type Required Description
limit Integer No Maximum number of users to return. Defaults to 50.
offset Integer No Number of users to skip before starting to collect the result set. Defaults to 0.

Example Request:

GET /users?limit=20&offset=10

Example Response (200 OK):

{ "users": [ { "userId": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "username": "john.doe", "email": "john.doe@example.com", "createdAt": "2023-10-27T10:30:00Z" }, { "userId": "f0e1d2c3-b4a5-6789-0123-456789abcdef", "username": "jane.smith", "email": "jane.smith@example.com", "createdAt": "2023-10-27T11:00:00Z" } ], "total": 150, "limit": 20, "offset": 10 }

POST /users

POST
Creates a new user in the system.

Request Body:

Name Type Required Description
username String Yes The desired username for the new user. Must be unique.
email String Yes The email address of the new user. Must be a valid email format and unique.
password String Yes The password for the new user. Minimum 8 characters.

Example Request:

POST /users Content-Type: application/json { "username": "new.user", "email": "new.user@example.com", "password": "securepassword123" }

Example Response (201 Created):

{ "userId": "1a2b3c4d-5e6f-7890-1234-567890abcdef", "username": "new.user", "email": "new.user@example.com", "createdAt": "2023-10-27T12:00:00Z" }

GET /users/{userId}

GET
Retrieves details for a specific user by their ID.

Path Parameters:

Name Type Required Description
userId String (UUID) Yes The unique identifier of the user to retrieve.

Example Request:

GET /users/a1b2c3d4-e5f6-7890-1234-567890abcdef

Example Response (200 OK):

{ "userId": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "username": "john.doe", "email": "john.doe@example.com", "createdAt": "2023-10-27T10:30:00Z", "updatedAt": "2023-10-27T10:35:00Z", "isActive": true }

PUT /users/{userId}

PUT
Updates an existing user's information.

Path Parameters:

Name Type Required Description
userId String (UUID) Yes The unique identifier of the user to update.

Request Body:

Name Type Required Description
email String No The new email address for the user.
isActive Boolean No Sets the active status of the user.

Example Request:

PUT /users/a1b2c3d4-e5f6-7890-1234-567890abcdef Content-Type: application/json { "email": "john.doe.updated@example.com", "isActive": false }

Example Response (200 OK):

{ "userId": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "username": "john.doe", "email": "john.doe.updated@example.com", "createdAt": "2023-10-27T10:30:00Z", "updatedAt": "2023-10-27T13:00:00Z", "isActive": false }

DELETE /users/{userId}

DELETE
Deletes a user from the system.

Path Parameters:

Name Type Required Description
userId String (UUID) Yes The unique identifier of the user to delete.

Example Request:

DELETE /users/a1b2c3d4-e5f6-7890-1234-567890abcdef

Example Response (204 No Content):

(No response body)

Data Storage

POST /data/{key}

POST
Stores a JSON object associated with a unique key. If the key already exists, it will be overwritten.

Path Parameters:

Name Type Required Description
key String Yes The unique key to associate with the data.

Request Body:

{ "some": "data", "number": 123, "nested": { "value": true } }

Example Request:

POST /data/user-settings/john.doe Content-Type: application/json { "theme": "dark", "notifications": { "email": true, "sms": false } }

Example Response (201 Created):

{ "message": "Data stored successfully.", "key": "/data/user-settings/john.doe", "storedAt": "2023-10-27T14:00:00Z" }

GET /data/{key}

GET
Retrieves the JSON object associated with a given key.

Path Parameters:

Name Type Required Description
key String Yes The key of the data to retrieve.

Example Request:

GET /data/user-settings/john.doe

Example Response (200 OK):

{ "theme": "dark", "notifications": { "email": true, "sms": false } }

DELETE /data/{key}

DELETE
Deletes the data associated with a given key.

Path Parameters:

Name Type Required Description
key String Yes The key of the data to delete.

Example Request:

DELETE /data/user-settings/john.doe

Example Response (204 No Content):

(No response body)