Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 9.92 KB

README.md

File metadata and controls

45 lines (31 loc) · 9.92 KB

Rendezvous API Endpoints

This Wiki contains documentation for all Rendezvous REST API endpoints. All functioning endpoints are documented below. There is currently no limit on API calls per user.

Base URL: http://api.getrendezvous.co/

IMPORTANT:

  • Most API calls require a valid API key. Contact system administrator for more information. API keys must be passed through with the header 'key', unless otherwise specified.
  • All status codes are returned as a JSON object with a key 'status'

Note: For information about HTTP error codes, see the W3 guide here.

/user Endpoint

Endpoint Method Request Headers Response Codes Response Object Headers Security
/user/new/ POST
  • username Username of the new user. Must be unique
  • password Password of the new user
  • firstname First name of the new user
  • lastname Last name of the new user
  • facebook_id Facebook ID of the user (if logging in with Facebook) [optional]
  • picture URL to user picture. Can be blank, but the header is required
  • phone Phone number of the new user
  • 200 All OK. Returns new user object
  • 400 Invalid request
  • 409 Duplicates detected in conflicting fields. User not added
Response code 200 API key
/user/new/ PUT
  • username Username of the new user
  • code Confirmation code of the new user
  • 200 All OK. User object sent as response
  • 204 User object not found. This would occur if this step is attempted before initializing the new user
  • 400 Invalid request
  • 401 Unauthorized. Confirmation codes did not match
  • 409 Duplicate fields found. This occurs when another user has signed up before the current user has completed his/her authentication process
  • firstname First name of the user
  • lastname Last name of the user
  • facebook_id Facebook ID of the user (only appears if the user initially authenticated with Facebook)
  • password Hashed password (for local authentication)
  • username Username of the user
  • phone Phone number of the user
  • picture URL of the user picture
  • friends Friend's user object of the current user
  • current_status Current status of the user
API key
/user/picture/ GET
  • username Username who's picture is to be retrieved
  • 200 All OK. Returns correct object
  • 204 No user found corresponding to username. This could only occur if a search for a user picture is attempted before he/she registers
  • 400 Invalid request
  • username Username of the user who's picture is being returned
  • picture URL to the user's picture
API key
/user/exists/ GET
  • username Username to be checked for availability
  • 200 All OK. Request succcessful
  • 400 Invalid request
  • availability Boolean value. True if available, false if not
API key
/user/exists/fb/ GET
  • facebook_id Facebook ID of the person to be serached for in the database
  • 200 All OK. Returns the user object of the corresponding person (if it exists)
  • 204 No user found for the corresponding ID
  • 400 Invalid request
  • firstname First name of the user
  • lastname Last name of the user
  • facebook_id Facebook ID of the user (only appears if they registered with it)
  • password Hashed password (for local authentication)
  • username Username of the user
  • phone Phone number of the user
  • picture URL of the user picture
  • friends Friend's user object of the current user
  • current_status Current status of the user
API key
/user/login/ POST
  • username Username of the person to be logged on
  • password Password of the user
  • 200 All OK. Returns user object
  • 204 Username not found on server
  • 400 Invalid request
  • 401 Unauthorized. Valid username, invalid password
  • firstname First name of the user
  • lastname Last name of the user
  • facebook_id Facebook ID of the user (only appears if they registered with it)
  • password Hashed password (for local authentication)
  • username Username of the user
  • phone Phone number of the user
  • picture URL of the user picture
  • friends Friend's user object of the current user
  • current_status Current status of the user
API key
/user/login/encrypted/ POST
  • username Username of the user to be logged on
  • encrypted_password Encrypted password of the user to be logged on
  • 200 All OK. Returns user object
  • 204 No user found for the corresponding username
  • 400 Invalid request
  • 401 Unauthorized. Valid username, invalid password
  • firstname First name of the user
  • lastname Last name of the user
  • facebook_id Facebook ID of the user (only appears if the user initially authenticated with Facebook)
  • password Hashed password (for local authentication)
  • username Username of the user
  • phone Phone number of the user
  • picture URL of the user picture
  • friends Friend's user object of the current user
  • current_status Current status of the user
API key
/user/find_friends/ POST
  • number_list Array of phone numbers to be searched for in the database
  • username Current username of the user (for validation)
  • 200 All OK. Returns JSON array of user objects corresponding to list of phone numbers
  • 204 No user found that corresponds to the username. This would only be because the user has not yet registered with the application
  • 400 Invalid request
  • 500 Internal server error. Contact developer if this occurs
  • results Array of user objects
  • first_name First name of the user
  • last_name Last name of the user
  • username Username of the user
API key
/user/invite/ POST
  • username Username of the user making the request
  • target_phone Target phone number of the person to be invited to the application
  • 200 All OK. Request sent successfully
  • 204 No user corresponding to the username found on the server
  • 400 Invalid request
  • Response code 200
API key

/status Endpoint

Endpoint Method Request Headers Response Codes Response Object Headers Security
/status/new/ POST
  • username Username of the person whose status is to be set
  • type Type of status (i.e. Movie, Chill etc.)
  • location_lat Latitudinal location of the person at the time the post was made
  • location_lon Longitudinal location of the person at the time the post was made
  • expiration_time Expiration time of the post (OPTIONAL). If not set, this value falls back to the default. This must be sent in milliseconds
  • 200 All OK. Returns status object with the following fields
  • 400 Invalid request
  • 409 Duplicates detected. The current status must either be deleted with a DELETE request, or updated with a PUT request. See other endpoints
  • time Time the status object was created
  • type Type of the status (i.e. Movie, chill etc.)
  • ````location_lat Latitude of the user when the status was created</li><li>location_lon``` Longitude of the user when the statuswas created
  • ```expiration_time``` Expiration time of the status (JS date object)
API key
/status/friends/ POST
  • username Username of the user who's friends are to be retrieved
  • 200 All OK. Returns object correctly
  • 204 No user found for the given username
  • 400 Invalid request
  • statuses Array of objects containing current status details
  • username Username of the user who has a specific status
  • firstname First name of the user with a specific status
  • lastname Last name of the user who has a specific status
  • phone Phone number of the user who has a specific status
  • status_time Time that the status was set
  • status_type Type of the current status (i.e. Eat, Movie etc..)
  • status_expiration Expiration time of the status
API key

Common Workflows

Adding a new user

Due to the nature of the two step verification process of adding a new user, two seperate requests must be made. The following steps must be followed:

  • Send a POST request to the /user/new/ endpoint with the required headers. This will then send a verification text message to the user.
  • Prompt the user to enter the confirmation code sent via text, and send a PUT request to /user/new/ with the required headers. This process will authenticate the confirmation code and add the new user to the database.

Adding a new Status

  • Send a POST request to the /status/new endpoint. This will then return a new status object, that can be displayed to the user. The server will automatically delete the status object if it is expired.