Skip to content

Latest commit

 

History

History
149 lines (125 loc) · 2.48 KB

readme.md

File metadata and controls

149 lines (125 loc) · 2.48 KB
# User Management API Documentation

## Introduction
This API allows you to manage users in your application. You can perform CRUD operations (Create, Read, Update, Delete) on user data stored in a JSON file.

## Base URL

https://rest-api-ten-kappa.vercel.app/


## Endpoints

### Get All Users

GET /users GET /api/users

Returns a list of all users.

#### Example Response
```json
[
    {
        "id": 1,
        "first_name": "John",
        "last_name": "Doe",
        "email": "[email protected]"
    },
    {
        "id": 2,
        "first_name": "Jane",
        "last_name": "Smith",
        "email": "[email protected]"
    },
    ...
]

Get User by ID

GET /api/users/:id

Returns the user with the specified ID.

Parameters

  • id: The ID of the user to retrieve.

Example Response

{
    "id": 1,
    "first_name": "John",
    "last_name": "Doe",
    "email": "[email protected]"
}

Create a New User

POST /api/users

Creates a new user.

Request Body

{
    "first_name": "Alice",
    "last_name": "Johnson",
    "email": "[email protected]"
}

Example Response

{
    "status": "success",
    "id": 101
}

Update User by ID

PATCH /api/users/:id

Updates the user with the specified ID.

Parameters

  • id: The ID of the user to update.

Request Body

{
    "first_name": "Alice",
    "last_name": "Brown"
}

Example Response

{
    "status": "success",
    "updatedUser": {
        "id": 101,
        "first_name": "Alice",
        "last_name": "Brown",
        "email": "[email protected]"
    }
}

Delete User by ID

DELETE /api/users/:id

Deletes the user with the specified ID.

Parameters

  • id: The ID of the user to delete.

Example Response

{
    "status": "success",
    "deletedUser": {
        "id": 101,
        "first_name": "Alice",
        "last_name": "Brown",
        "email": "[email protected]"
    }
}

Error Handling

  • 404 Not Found: If the requested resource is not found.
  • 500 Internal Server Error: If there's a server-side issue.

Rate Limiting

There's currently no rate limiting implemented on this API.

Authentication

This API does not require authentication for now.

Contact

For any inquiries, please contact [email protected].


Feel free to customize this documentation according to your specific requirements or add more details if needed.