registerApi - n1lby73/industrial-IOT GitHub Wiki
The Registration API endpoint enables user registration by accepting their email, username, and password. Upon successful registration, an email containing a one-time password (OTP) for verification is sent to the provided email address.
-
URL:
https://industrialiot.onrender.com/api/register
-
Method:
POST
-
Headers:
-
Content-Type:
application/json
-
Content-Type:
Parameter | Type | Description |
---|---|---|
email |
String | User's email (required). |
username |
String | User's desired username (required). |
password |
String | User's password (required). |
Note: for the register route, it is required of the frontend dev to validate that user is inputing the right password by using the password and confirm password method
-
Success Response:
- Status Code: 200 OK
-
Response Body:
{ "success": "new user created and otp sent to mail" "email": "<users registered email>" }
- Description: Indicates successful user registration and OTP sent to the provided email.
-
Error Responses:
-
Status Code: 400 Bad Request
-
Response Body:
{ "error": "username is already taken" }
- Description: Indicates that the provided username already exists.
-
Response Body:
-
Status Code: 400 Bad Request
-
Response Body:
{ "error": "email already exist" }
- Description: Indicates that the provided email is already registered.
-
Response Body:
-
Status Code: 400 Bad Request
-
Response Body:
{ "error": "invalid email format" }
- Description: Indicates that the provided email is not in a correct format.
-
Response Body:
-
Status Code: 500 Internal Server Error
-
Response Body:
{ "error": "failed to create user", "details": "<ERROR_DETAILS>" }
- Description: Indicates a server error occurred during user creation.
-
Response Body:
-
-
Request Method:
POST
-
Endpoint URL:
https://industrialiot.onrender.com/api/register
-
Header:
Content-Type: application/json
-
Request Body: Users data.
{ "email": "[email protected]", "username": "user123", "password": "user_password" }
The registerApi endpoint facilitates user registration with email and username uniqueness constraints. It triggers an email containing an OTP for verification upon successful user creation.