Skip to content
This repository has been archived by the owner on Mar 26, 2022. It is now read-only.

Phase II: A Simple HTTPS Server

Kumin In edited this page Oct 21, 2016 · 23 revisions

API Endpoints

Check if user is logged in

GET /api/v1/login


Login user

POST /api/v1/login


Get user information

GET /api/v1/user/id/:id

GET /api/v1/user/email/:email

Retrieves the user information based on the Facebook ID or Email provided depending on the route API endpoint.

Parameters

Name Type Description
id String A User's facebook ID
email String A User's email address

Response

Response: 200
{
  "_id": "5807f1f75e22d052a7fd7994",
  "name": "Kumin In",
  "email": "[email protected]",
  "profilePhotoURL": "graph.facebook.com/example_id/picture",
  "__v": 0,
  "pendingFriends": [],
  "friends": [],
  "facebook": {
    "id": "example_id"
  }
}

Get public key for a user.

GET /api/v1/user/id/:id/publicKey


Update existing public key for the user.

PUT /api/v1/user/id/:id/publicKey


Accept pending friend request

PUT /api/v1/user/friend/accept


Decline pending friend request

PUT /api/v1/user/friend/decline


Create new friend request

PUT /api/v1/user/friend/add


Get all conversation for a user

GET /api/1/conversation

Retrieves All of the User's conversation.

Parameters:

Name Type Description

Response:

Response: 200
[
  {
    "_id": "Aaron_IDKumin_ID",
    "date": "2016-10-19T23:26:15.234Z",
    "__v": 2,
    "message": [
      {
        "message": "hey man how are you doing?",
        "from": "Aaron Turner",
        "date": "2016-10-19T22:58:13.564Z",
        "_id": "5807fa85df31ad5bde8b2582"
      },
      {
        "message": "I'm doing fine. We're wrecking this project.",
        "from": "Kumin In",
        "date": "2016-10-19T23:13:20.497Z",
        "_id": "5807fe10bd56f65f33e8c85f"
      },
      {
        "message": "Hermdad was here!",
        "from": "Kumin In",
        "date": "2016-10-19T23:26:15.234Z",
        "_id": "58080117a6e859636442b90c"
      }
    ],
    "members": [
      "Aaron_ID",
      "Kumin_ID"
    ]
  }
]

Update a conversation for a user.

PUT /api/v1/conversation


Create a new conversation for a user.

POST /api/v1/conversation

Clone this wiki locally