API Docs
Users
Activate/Deactivate a User
5min
This endpoint allows you to manage the status of a user in the system by sending a POST request. It is typically used for administrative purposes to update user statuses, such as activating or deactivating a user.
POST
https://admin.<your-site>.com/api/users/manage-status
- accept: application/json Specifies that the request expects a JSON response.
- accept-language: en-US,en;q=0.9 Sets the preferred language for the response.
- authorization: Bearer <JWT Token> A JSON Web Token (JWT) that authenticates the request. Replace <JWT Token> with a valid token.
- content-type: application/json Specifies the format of the request body, which is JSON.
The request body should be in JSON format, containing the following fields:
- id: string The ID of the user whose status is being managed.
- token: string A valid authentication token (JWT) that provides permission for this operation.
JSON
{
"id": "634441cecbb5901d133039f8",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
POST: Sends a request to update the user's status.
fetch("https://admin.<your-site>.com/api/users/manage-status", {
"headers": {
"accept": "application/json",
"accept-language": "en-US,en;q=0.9",
"authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"content-type": "application/json"
},
"body": "{\"id\":\"634441cecbb5901d133039f8\",\"token\":\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"}",
"method": "POST"
});
The API will return a JSON response indicating the success or failure of the operation.
[Success] 200
{
"message": "User status updated successfully",
"status": "success"
}
[Failure] 401
{
"message": "Invalid token or user ID",
"status": "error"
}
This API requires a valid JWT token for authentication. Ensure that the token is included in the authorization header as Bearer <JWT Token>.
- Ensure that the id in the request body matches the user whose status you want to manage.
- The request must include a valid JWT token for authentication. Without it, the request will be rejected with a 401 Unauthorized error.
Updated 09 Oct 2024
Did this page help you?