deleteApi - n1lby73/industrial-IOT GitHub Wiki
The Delete API endpoint removes a user from the database based on their email. It requires authorization through a valid JSON Web Token (JWT) with the role of "owner".
-
URL:
https://industrialiot.onrender.com/api/delete
-
Method:
DELETE
-
Headers:
-
Authorization:
Bearer <ACCESS_TOKEN>
-
Content-Type:
application/json
-
Authorization:
- Body Parameters:
Parameter | Type | Description |
---|---|---|
email |
String | User's email (required). |
-
Success Response:
- Status Code: 200 OK
-
Response Body:
{ "success": "<USER_EMAIL> has been deleted from the database" }
- Description: Indicates successful deletion of the user from the database.
-
Error Responses:
-
Status Code: 401 Unauthorized
-
Response Body:
{ "msg": "not authorized" }
- Description: Indicates unauthorized access for users without the "owner" role.
-
Response Body:
-
Status Code: 401 Unauthorized
-
Response Body:
{ "msg": "owner cannot be deleted" }
- Description: Indicates the attempt to delete the "owner" user, which is not permitted.
-
Response Body:
-
Status Code: 404 Not Found
-
Response Body:
{ "Error": "Invalid Email" }
- Description: Indicates that the specified user email does not exist in the database.
-
Response Body:
-
Status Code: 500 Internal Server Error
-
Response Body:
{ "Error": "Failed to delete user", "Details": "<ERROR_DETAILS>" }
- Description: Indicates a server error occurred during the user deletion process.
-
Response Body:
-
-
Request Method:
DELETE
-
Endpoint URL:
https://industrialiot.onrender.com/api/delete
-
Header:
{ Authorization: Bearer <ACCESS_TOKEN> Content-Type: application/json }
-
Request Body: Users login credentials.
{ "email": "[email protected]", }