This repository has been archived by the owner on Mar 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Phase II: A Simple HTTPS Server
Kumin In edited this page Oct 21, 2016
·
23 revisions
GET /api/v1/login
POST /api/v1/login
GET /api/v1/user/id/:id
Retrieves the user information based on the Facebook ID.
Name | Type | Description |
---|---|---|
access_token | String | User's facebook access token |
id | String | A User's facebook ID |
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 /api/v1/user/email/:email
Retrieves the user information based on the Email.
Name | Type | Description |
---|---|---|
access_token | String | User's facebook access token |
String | A User's email address |
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 /api/v1/user/id/:id/publicKey
PUT /api/v1/user/id/:id/publicKey
PUT /api/v1/user/friend/accept
PUT /api/v1/user/friend/decline
PUT /api/v1/user/friend/add
GET /api/1/conversation
Retrieves All of the User's conversation.
Name | Type | Description |
---|---|---|
access_token | String | User's facebook access token |
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"
}
],
"memberNames": [
"Kumin In",
"Aaron Turner"
],
"memberIDs": [
"AaronID",
"KuminID"
]
}
]
PUT /api/v1/conversation
Updates a conversation with a new message from a user.
Name | Type | Description |
---|---|---|
access_token | String | User's facebook access token |
message | String | The message being sent |
conversationID | String | ID for the conversation |
Response: 201
{
"_id": "AaronID_KuminID",
"date": "2016-10-21T01:55:32.882Z",
"__v": 3,
"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"
},
{
"message": "THIS IS REALLY SICK!!!!!",
"from": "Kumin In",
"date": "2016-10-21T01:55:32.882Z",
"_id": "58097594289e316c9aafbb7c"
}
],
"memberNames": [
"Kumin In",
"Aaron Turner"
],
"memberIDs": [
"AaronID",
"KuminID"
]
}
Create a new conversation for the users provided. Message Object is sent as a JSON Object in the body.
POST /api/v1/conversation
Name | Type | Description |
---|---|---|
access_token | String | User's facebook access token |
message | Object | The message being sent |
message Object:
{
"access_token": "UserAccessToken",
"message": "hey man how are you doing?",
"names": ["Kumin In"],
"members": ["KuminID"]
}
Response 200
{
"_id": "AaronID_KuminID",
"date": "2016-10-21T02:24:03.247Z",
"__v": 0,
"message": [
{
"message": "hey man how are you doing?",
"from": "Aaron Turner",
"date": "2016-10-21T02:24:03.247Z",
"_id": "58097c43143bbf72c60805ff"
}
],
"memberNames": [
"Kumin In",
"Aaron Turner"
],
"memberIDs": [
"AaronID",
"KuminID"
]
}
Kumin In, Aaron Turner. CECS 478. 2016