A clone of Truecaller API, built using Flask Framework.
To see the instructions on how to run this API, click here
Note: Authorization header required for all operations
- Register/Create Account
- Login
- Add contact
- Mark number as spam
- Search contact by name
- Search contact by phone number
Asks the user to register/login if not logged in, i.e., no valid Authorization Token was passed by the user while sending this request.
Notice the empty Key-Value pair in the Headers section.
- Takes details of the new user
- Creates new user
- Asks them to go to /login
Takes username and password to check for a valid user.
If valid, asks user to go to the endpoint to add contacts.
Also generates a unique Authorization Token which is shown to the user as it would be needed to be entered for further requests by the user to validate whether he is logged in or not(refer instructions.txt to see how to pass this auth_token).
Notice that both the users have different Authorization Tokens. Whichever Authorization Token is passed along with the request, the request would be by that specific user.
We have provided the Authorization Token for User 1 in the Headers section.
Our Body has the contacts of User 1 that are to be added
We have provided the Authorization Token for User 2 in the Headers section.
Our Body has the contacts of User 2 that are to be added
User 1 has 3 contacts and User 2 has 4 contacts
User 2 has same 3 phone numbers as User 1 but with different names and he also has the phone number of User 1
A user can search for a person by name in the global database. Search results display the name, phone number and spam likelihood for each result matching that name.
We have provided the Authorization Token for User 1. See the Key-Value pair inside Headers
A user can search for a person by phone number in the global database. If there is a registered user with that phone number, show only that result. Otherwise, show all results matching that phone number completely - note that there can be multiple names for a particular phone number in the global database, since contact books of multiple registered users may have different names for the same phone number.
We have provided the Authorization Token for User 2. See the Key-Value pair inside Headers.
A user should be able to mark a number as spam so that other users can identify spammers via the global database. Any registered user can change the spam status for any number in the global database.
Note : It isn't necessary that the number should belong to any registered user or contact - it could be any random number in our contact table.
We have provided the Authorization Token for User 2. See the Key-Value pair inside Headers
Notice that the number was saved by both our registered users, but with different names and even though User 2 changed the spam status, it has changed for both the registered users.
User 2 is logging out.
We have provided the Authorization Token for User 2. See the Key-Value pair inside Headers.
As soon as User 2 logged out, notice that the database column having the Authorization Token for User 2 is set to null, which indicates he is not in session anymore.
Now, even if we pass the earlier Authorization Token for our requests, it would ask to sign in first. Would do the same if we don’t pass any Authorization Token.