-
Notifications
You must be signed in to change notification settings - Fork 7
Phase II: A Simple HTTPS Server
POST /api/v1/login
Creates and login the user by using their facebook profile.
Name | Type | Description |
---|---|---|
access_token | String | User's facebook access token |
Response: 200
{
"Session": "True",
"user": {
"_id": "581bfe92ddb3b4fe8d6184c8",
"name": "Aaron Turner",
"email": "",
"profilePhotoURL": "graph.facebook.com/facebookId/picture",
"__v": 0,
"keywords": [
"aaron",
"turner"
],
"pendingFriends": [],
"friends": [],
"facebook": {
"id": "facebookId"
}
}
}
GET /api/v1/user/: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": "581bfe8dddb3b4fe8d6184c7",
"name": "Kumin In",
"email": "[email protected]",
"profilePhotoURL": "graph.facebook.com/facebookId/picture",
"__v": 0,
"keywords": [
"abc",
"@example",
"com",
"kumin"
],
"pendingFriends": [],
"friends": [],
"facebook": {
"id": "facebookId"
}
}
GET /api/v1/user/:id/publicKey
PUT /api/v1/user/publicKey
PUT /api/v1/user/friend/accept
Accepts a pending friend request for a given user.
Name | Type | Description |
---|---|---|
access_token | String | User's facebook access token |
otherUserID | String | other user's facebook Id |
Response: 201
{
"message": "Successfully added friends"
}
PUT /api/v1/user/friend/decline
Declines a pending friend request for a given user.
Name | Type | Description |
---|---|---|
access_token | String | User's facebook access token |
otherUserID | String | other user's facebook Id |
Response: 201
{
"message": "Successfully removed pending friend."
}
PUT /api/v1/user/friend/add
Creates a new pending friend request for the given user.
Name | Type | Description |
---|---|---|
access_token | String | User's facebook access token |
otherUserID | String | other user's facebook Id |
Response: 201
{
"message": "Successfully added to pending list"
}
PUT /api/v1/user/friend/delete
Remove a friend from the user's friend list.
Name | Type | Description |
---|---|---|
access_token | String | User's facebook access token |
otherUserID | String | other user's facebook Id |
Response: 201
{
"message": "Successfully deleted friend."
}
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": "581c030411270a049a33a051",
"conversationID": "581bfe8dddb3b4fe8d6184c7_581bfe92ddb3b4fe8d6184c8",
"date": "2016-11-04T05:40:28.773Z",
"__v": 2,
"message": [
{
"_id": "581c030411270a049a33a050",
"message": "Hey, I can send a message to the server :^)!!",
"from": "Aaron Turner",
"date": "2016-11-04T03:39:48.638Z",
"__v": 0
},
{
"_id": "581c1f49432e5e0928829cec",
"message": "This is a new message!",
"from": "Kumin In",
"date": "2016-11-04T05:40:25.465Z",
"__v": 0
}
],
"members": [
{
"_id": "581bfe8dddb3b4fe8d6184c7",
"name": "Kumin In",
"email": "[email protected]",
"profilePhotoURL": "graph.facebook.com/FacebookId/picture",
"__v": 2,
"keywords": [
"example",
"@example",
"com",
"kumin"
],
"pendingFriends": [],
"friends": [],
"facebook": {
"id": "FacebookId"
}
},
{
"_id": "581bfe92ddb3b4fe8d6184c8",
"name": "Aaron Turner",
"email": "",
"profilePhotoURL": "graph.facebook.com/FacebookId/picture",
"__v": 5,
"keywords": [
"aaron",
"turner"
],
"pendingFriends": [],
"friends": [],
"facebook": {
"id": "FacebookId"
}
}
]
}
]
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": "581c030411270a049a33a051",
"conversationID": "581bfe8dddb3b4fe8d6184c7_581bfe92ddb3b4fe8d6184c8",
"date": "2016-11-04T05:40:28.773Z",
"__v": 2,
"message": [
{
"_id": "581c030411270a049a33a050",
"message": "Hey, I can send a message to the server :^)!!",
"from": "Aaron Turner",
"date": "2016-11-04T03:39:48.638Z",
"__v": 0
},
{
"_id": "581c1f49432e5e0928829cec",
"message": "This is a new message!",
"from": "Kumin In",
"date": "2016-11-04T05:40:25.465Z",
"__v": 0
}
],
"members": [
{
"_id": "581bfe8dddb3b4fe8d6184c7",
"name": "Kumin In",
"email": "[email protected]",
"profilePhotoURL": "graph.facebook.com/FacebookId/picture",
"__v": 2,
"keywords": [
"example",
"@example",
"com",
"kumin"
],
"pendingFriends": [],
"friends": [],
"facebook": {
"id": "FacebookId"
}
},
{
"_id": "581bfe92ddb3b4fe8d6184c8",
"name": "Aaron Turner",
"email": "",
"profilePhotoURL": "graph.facebook.com/FacebookId/picture",
"__v": 5,
"keywords": [
"aaron",
"turner"
],
"pendingFriends": [],
"friends": [],
"facebook": {
"id": "FacebookId"
}
}
]
}
POST /api/v1/conversation
Create a new conversation for the users provided. Message Object is sent as a JSON Object in the body.
Name | Type | Description |
---|---|---|
access_token | String | User's facebook access token |
message | Object | The message being sent |
message Object:
{
"access_token": "UserAccessToken",
"message": "Hey, I can send a message to the server :^)!!",
"members": ["581bfe8dddb3b4fe8d6184c7"]
}
Response: 201
{
"_id": "581c030411270a049a33a051",
"conversationID": "581bfe8dddb3b4fe8d6184c7_581bfe92ddb3b4fe8d6184c8",
"date": "2016-11-04T03:39:48.638Z",
"__v": 0,
"message": [
{
"_id": "581c030411270a049a33a050",
"message": "Hey, I can send a message to the server :^)!!",
"from": "Aaron Turner",
"date": "2016-11-04T03:39:48.638Z",
"__v": 0
}
],
"members": [
{
"_id": "581bfe8dddb3b4fe8d6184c7",
"name": "Kumin In",
"email": "[email protected]",
"profilePhotoURL": "graph.facebook.com/FacebookId/picture",
"__v": 2,
"keywords": [
"example",
"@example",
"com",
"kumin"
],
"pendingFriends": [],
"friends": [],
"facebook": {
"id": "FacebookId"
}
},
{
"_id": "581bfe92ddb3b4fe8d6184c8",
"name": "Aaron Turner",
"email": "",
"profilePhotoURL": "graph.facebook.com/FacebookId/picture",
"__v": 5,
"keywords": [
"aaron",
"turner"
],
"pendingFriends": [],
"friends": [],
"facebook": {
"id": "FacebookId"
}
}
]
}
Kumin In, Aaron Turner. CECS 478. 2016