Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **Note: These are only sample API.**
- ----
- **Authenticating The User**
- ----
- Returns status of the authentication. If successfull, token will be attached to the response.
- * **URL**
- /users/login
- * **Method:**
- `POST`
- * **URL Params**
- None
- * **Data Params**
- **Required:**
- `username=[string]` <br />
- `password=[string]`
- * **Success Response:**
- * **Code:** 200 <br />
- **Content:** `{ status: success, token: 'sdasacgsgd' }`
- * **Error Response:**
- * **Code:** 404 NOT FOUND <br />
- **Content:** `{ error : "User doesn't exist" }`
- OR
- * **Code:** 401 UNAUTHORIZED <br />
- **Content:** `{ error : "User validation failed." }`
- ----
- **GET User**
- ----
- Returns JSON object for user.
- * **URL**
- /users/:id
- * **Method:**
- `GET`
- * **URL Params**
- **Required:**
- `username=[string]`
- * **Data Params**
- None
- * **Success Response:**
- * **Code:** 200 <br />
- **Content:**
- `{` <br />
- `'first_name': 'abc',` <br />
- `'middle_name': 'abc',` <br />
- `'last_name': 'abc',` <br />
- `'email_id': 'abc@example.com',` <br /> `'contact_number': 123456789` <br />
- `}`
- * **Error Response:**
- * **Code:** 404 NOT FOUND <br />
- **Content:** `{ error : "User doesn't exist" }`
- OR
- * **Code:** 401 UNAUTHORIZED <br />
- **Content:** `{ error : "You are unauthorized to make this request.." }`
- ----
- **Create User**
- ----
- Returns status.
- * **URL**
- /users/
- * **Method:**
- `POST`
- * **URL Params**
- None
- * **Data Params**
- **Required:**
- `{` <br />
- `'username': 'abc'` <br />
- `'first_name': 'abc',` <br />
- `'middle_name': 'abc',` <br />
- `'last_name': 'abc',` <br />
- `'password': 123456789` <br />
- `'email_id': 'abc@example.com',` <br /> `'contact_number': 123456789` <br />
- `}`
- * **Success Response:**
- * **Code:** 200 <br />
- **Content:** `{ 'status': 'success'}`
- * **Error Response:**
- * **Code:** 500 INTERNAL SERVER ERROR <br />
- **Content:** `{ error : "error creating new user" }`
- ----
- **Update User**
- ----
- Returns JSON object for user.
- * **URL**
- /users/:id
- * **Method:**
- `PUT`
- * **URL Params**
- **Required:**
- `username=[string]`
- * **Data Params**
- **Required:**
- `email_id=[string]` <br />
- `contact_number=[string]`
- * **Success Response:**
- * **Code:** 200 <br />
- **Content:** `{ 'status': 'success'}`
- * **Error Response:**
- * **Code:** 404 NOT FOUND <br />
- **Content:** `{ error : "User doesn't exist" }`
- OR
- * **Code:** 401 UNAUTHORIZED <br />
- **Content:** `{ error : "You are unauthorized to make this request.." }`
- ----
- **Delete User**
- ----
- Returns JSON object for user.
- * **URL**
- /users/:id
- * **Method:**
- `DELETE`
- * **URL Params**
- **Required:**
- `username=[string]`
- * **Data Params**
- None
- * **Success Response:**
- * **Code:** 200 <br />
- **Content:** `{ 'status': 'success'}`
- * **Error Response:**
- * **Code:** 404 NOT FOUND <br />
- **Content:** `{ error : "User doesn't exist" }`
- OR
- * **Code:** 401 UNAUTHORIZED <br />
- **Content:** `{ error : "You are unauthorized to make this request.." }`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement