Python v2.7
The app is hosted at http://contactapp.pythonanywhere.com/, feel free to take it out for a ride on this base path.
Please use an API interaction tool like postman to communicate with the APIs. All endpoints are protected except the user registration and login endpoints.
Note: All request parameters are to be sent as form data unless otherwise stated.
This route registers a new user for the contact application. Reminder, please post with form data. usernames are unique.
Method : Post
Sample Request:
username : sample_user
password : sample_password
Sample Response:
{
"msg": "user created successfully",
"status": "ok"
}
This route logs-in a registered user
Method : Post
Sample Request:
username : registered_user
password : registered_user_pass
Sample Response:
{
"msg": "logged-in successfully",
"status": "ok"
}
This route creates a new contact. email and contact_number are unique.
Method : Post
contact number format : <country-code><valid-contact-number>
Sample Request:
name : Chandler
contact_number : +919887889877
email : [email protected]
Sample Response:
{
"msg": "contact created",
"status": "ok"
}
This route edits an existing contact.
Method:PUT
Sample Request:
contact_id : 3242
name : chandler
email = [email protected]
contact_number = +917887667655
Sample Response:
{
"msg": "updated successfully",
"status": "ok"
}
This routes deletes an existing contact.
Method:DELETE
contact_id = 23432
Sample Response:
{
"code": 200,
"message": "deleted successfully",
"status": "ok"
}
Method:GET
This route supports three modes of searches, and takes input parameters as part of url. Following are the three modes:
-
Contact can be searched by only name :
http://contactapp.pythonanywhere.com/search?name=chandler
-
Contact can be searched by only email :
http://contactapp.pythonanywhere.com/[email protected]
-
Contact can be searched by both, name and email :
http://contactapp.pythonanywhere.com/search?name=chandler&[email protected]
The endpoint is paginated and if per_page parameter is not provided, defaults to 10 contacts per request.
Sample request url for paginated request:
http://contactapp.pythonanywhere.com/[email protected]&page=1&per_page=5
Sample Response:
{
"msg": "found",
"result": [
{
"id":234,
"contact_number": "+919881880422",
"email": "[email protected]",
"name": "chandler",
}
],
"status": "ok"
}