v2.0 — RESTful — JSON
https://api.example.com/v2
Returns a paginated list of all users. Supports filtering by status and sorting.
Was:
GET /getUsers
— verb in URL, resource not pluralised.
| Name | Type | Description |
|---|---|---|
| pageoptional | integer | Page number, default 1 |
| limitoptional | integer | Results per page, default 20, max 100 |
| statusoptional | string | Filter by status: active | inactive |
| sortoptional | string | Sort field, e.g. name, -createdAt |
Creates a new user. Returns the created resource with its assigned id.
Was:
GET /createUser?name=Jo
— GET must never mutate state. Verb in URL. Sensitive/structured data must not go in query strings; it belongs in the request body.
| Field | Type | Description |
|---|---|---|
| namerequired | string | Full name, min 1 char |
| emailrequired | string | Valid unique email address |
| roleoptional | string | user | admin, default user |
Partially updates multiple users in a single request.
Was:
PUT /updateAllUsers
— verb in URL. PUT semantics mean full replacement of a known single resource with a required ID; that's wrong for a bulk partial update. PATCH on the collection is the correct choice. A PUT here would require sending every field of every user or risk data loss.
| Field | Type | Description |
|---|---|---|
| idrequired | integer | ID of user to update |
| nameoptional | string | New name |
| emailoptional | string | New email |
| statusoptional | string | active | inactive |
Returns a single user by their unique ID.
| Name | Type | Description |
|---|---|---|
| idrequired | integer | User's unique identifier |
Fully replaces a user resource. All fields must be supplied. Missing fields will be set to their defaults or null — this is the correct semantic for PUT.
Use PATCH /users/{id} if you only want to update specific fields.
| Field | Type | Description |
|---|---|---|
| namerequired | string | Full name |
| emailrequired | string | Email address |
| rolerequired | string | user | admin |
| statusrequired | string | active | inactive |
Updates only the supplied fields of a user. Omitted fields are left unchanged.
| Field | Type | Description |
|---|---|---|
| nameoptional | string | New name |
| emailoptional | string | New email |
| roleoptional | string | user | admin |
| statusoptional | string | active | inactive |
Permanently deletes a user by ID.
Was:
POST /user/delete/5
— POST is for creation. Deletion semantics belong to the DELETE method. Embedding the action delete in the path is redundant once you use the right verb. Resource name must also be plural.
| Name | Type | Description |
|---|---|---|
| idrequired | integer | ID of user to delete |