This repository was archived by the owner on Apr 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Endpoints Documentation
hyeonyu1 edited this page Mar 13, 2020
·
18 revisions
http://service/str:author_id/ retrieve author's profile
- request method: GET
- url parameter: author_id: UUID
- example response:
{
"id":"http://service/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
"host":"http://127.0.0.1:5454/",
"displayName":"Lara",
"url":"http://127.0.0.1:5454/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
"friends": [
{
"id":"http://127.0.0.1:5454/author/8d919f29c12e8f97bcbbd34cc908f19ab9496989",
"host":"http://127.0.0.1:5454/",
"displayName":"Greg",
"url": "http://127.0.0.1:5454/author/8d919f29c12e8f97bcbbd34cc908f19ab9496989"
}
],
# Optional attributes
"github": "http://github.com/lara",
"firstName": "Lara",
"lastName": "Smith",
"email": "lara@lara.com",
"bio": "Hi, I'm Lara"
}
- response status code:
- 404: author not found
- 405: request methods not allowed
- 200: success retrieval of author information
http://service/author/str:author1_id/friends/path:author2_id/ Ask if 2 authors are friends
- request method: GET
- url parameter: author1_id: UUID author2_id: full url of author (w/o protocol)
- example response:
{ "query":"friends",
# Array of Author UUIDs
"authors":[
"http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013",
"http://127.0.0.1:5454/author/ae345d54-75b4-431b-adb2-fb6b9e547891"
],
# boolean true or false
"friends": true
}
- response status code:
- 405: request methods not allowed
- 200: succesfully retrieval of friendship information
http://service/str:author_id/addfriend/ view a list of available authors to befriend
- request method: GET
- url parameter: author1_id: UUID
- example response:
{
"available_authors_to_befriend": [
"localhost:8000/author/198238a04a1a409cbb4b52ef373fbd27",
"127.0.0.1:8000/author/b5154eb3b16740eda96857233b165678",
"localhost:8000/author/d747a675e1054e5b9fe32c5d1a5d277c",
"localhost:8000/author/99baa477e25b406696f0f61655716197"
]
}
- response status code: 405: request methods not allowed 404: author record not found 200: succesfully retrieval of available friends information
http://service/author/unfriend unfriend two authors given in request body
- request method: POST
- example request body:
{
"author_id" : "127.0.0.1:8000/author/9d411951f13246728c2a1d00c081e680",
"friend_id" : "localhost:8000/author/99baa477e25b406696f0f61655716197"
}
- response status code:
- 422: request body missing field
- 405: request methods not allowed
- 404: trying to remove friendship that does not exist
- 200: successfully removal of friendship
http://service/author/path:author_id/friends/
- url parameter: author_id: full url of author
- request method: POST ask a service if anyone in the list is a friend
- example request body:
{
"query":"friends",
"author":"<full url of author>",
# Array of Author ids
"authors": [
"http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013",
"http://127.0.0.1:5454/author/ae345d54-75b4-431b-adb2-fb6b9e547891",
"...",
"...",
"..."
]
}
- example response:
{
"query":"friends",
"author":"<authorid>", # where <authorid> is the full URL of the author in question
# Array of Author ids who are friends
"authors": [
"http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013",
"http://127.0.0.1:5454/author/ae345d54-75b4-431b-adb2-fb6b9e547891",
"..."
]
}
- request method: GET retrieve a list of friends of current user
- example response:
{
"query":"friends",
# Array of Author UUIDs
"authors":[
"http://host3/author/de305d54-75b4-431b-adb2-eb6b9e546013",
"http://host2/author/ae345d54-75b4-431b-adb2-fb6b9e547891"
]
}
- response status code:
- 200: successful retrieval of information
- 405: request methods not allowed
- 422: post body missing entries
http://service/friendrequest to make a friend request
- request method: POST
- example request body:
{
"query":"friendrequest",
"author": {
"id":"http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013",
"host":"http://127.0.0.1:5454/",
"displayName":"Greg Johnson"
"url":"http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013",
},
"friend": {
"id":"http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e637281",
"host":"http://127.0.0.1:5454/",
"displayName":"Lara Croft",
"url":"http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013",
}
}
- response status code:
- 422: post body missing entires
- 200: firendrequest successfully sent
- 405: request methods not allowed
- 409: send friend request when two users already friended or already in a follow relationship
- request method: POST to accept a friend request
- example request body:
{
"query":"friendrequest",
"author": {
"id":"localhost:8000/author/c730cf54a83d4d0982ec13a578692793",
"host":"http://localhost:8000/",
"displayName":"Greg Johnson",
"url":"http://localhost:8000/author/de305d54-75b4-431b-adb2-eb6b9e546013"
},
"friend": {
"id":"localhost:8000/author/ba6cf5db6a164c00a85bd717ec6ada60",
"host":"http://localhost:8000/",
"displayName":"Lara Croft",
"url":"http://localhost:8000/author/de305d54-75b4-431b-adb2-eb6b9e546013"
}
}
- request method: DELETE to reject a friend request
- example request body:
{
"query":"friendrequest",
"author": {
"id":"localhost:8000/author/c730cf54a83d4d0982ec13a578692793",
"host":"http://localhost:8000/",
"displayName":"Greg Johnson",
"url":"http://localhost:8000/author/de305d54-75b4-431b-adb2-eb6b9e546013"
},
"friend": {
"id":"localhost:8000/author/ba6cf5db6a164c00a85bd717ec6ada60",
"host":"http://localhost:8000/",
"displayName":"Lara Croft",
"url":"http://localhost:8000/author/de305d54-75b4-431b-adb2-eb6b9e546013"
}
}
- response status code:
- 405: request methods not allowed
- 422: request body missing entries
- 404: handle a friend request that doesn't exist
- 200: friend request successfully handled
http://service/friendrequest/str:author_id to retrieve pending requests of author
- request method: GET
- example response:
{
"query": "retrieve_friend_requests",
"author": "127.0.0.1:8000/author/c730cf54a83d4d0982ec13a578692793",
"request": [
"http://host3/author/de305d54-75b4-431b-adb2-eb6b9e546013",
"http://host2/author/ae345d54-75b4-431b-adb2-fb6b9e547891"
]
}
- response status code:
- 405: request method not allowed
- 200: successful retrieval of information
http://service/user/login display user login page
- request method: GET
http://service/user/signup display user signup page
- request method: POST
http://service/user/logout display user logout page
- request method: GET
http://service/author/posts retrieve posts that are visible to the currently authenticated user
- request method: GET
- If a page is provided, it retreives the posts in that page else returns page 0
- If a size is provided, retrieves pages as the size, up to the maximum set on the server (50). If no size is provided retrieves the default page size (10)
- example response:
{
"query": "posts",
"count": 11,
"size": 10,
"previous": "http://127.0.0.1:8000/author/posts?page=1",
# Array of posts
"posts": [
{
"id": "2d5e7bd7-4c0f-4da2-8d10-5731028b8e3d",
"title": "public Post by Test",
"source": "http://lastplaceigotthisfrom.com/posts/yyyyy",
"origin": "http://whereitcamefrom.com/posts/zzzzz",
"description": "post to test visibility = Public",
"contentType": "text/markdown",
"content": "This is a public post by test",
"author": {
"id": "127.0.0.1:8000/author/42cc076ae73a46c58d0defa51be6751b",
"email": "test@test.com",
"bio": "",
"host": "127.0.0.1:8000",
"firstName": "test",
"lastName": "testln",
"displayName": "",
"url": "127.0.0.1:8000/author/42cc076ae73a46c58d0defa51be6751b",
"github": ""
},
"categories": [
"public post"
],
"count": 3,
"size": 10,
"next": "http://127.0.0.1:8000/posts/2d5e7bd7-4c0f-4da2-8d10-5731028b8e3d/comments",
# Array of comments on the post
"comments": [
{
"id": "9a48eeac-2827-4c77-b729-d8f588414df5",
"contentType": "text/markdown",
"comment": "comment 6",
"published": "2020-03-10T18:09:58.373Z",
"author": {
"id": "127.0.0.1:8000/author/66e6c59143a948e5b7b7072b6c2d5229",
"email": "lara@lara.com",
"bio": "Hi, I am lara",
"host": "127.0.0.1:8000",
"firstName": "Lara",
"lastName": "Smith",
"displayName": "Greg Johnson",
"url": "127.0.0.1:8000/author/66e6c59143a948e5b7b7072b6c2d5229",
"github": "http://github.com/gjohnson"
}
},
{
"id": "33ddf889-752f-4cad-be38-258b2332e0de",
"contentType": "text/markdown",
"comment": "comment 5",
"published": "2020-03-10T18:09:49.414Z",
"author": {
"id": "127.0.0.1:8000/author/42cc076ae73a46c58d0defa51be6751b",
"email": "test@test.com",
"bio": "",
"host": "127.0.0.1:8000",
"firstName": "test",
"lastName": "testln",
"displayName": "",
"url": "127.0.0.1:8000/author/42cc076ae73a46c58d0defa51be6751b",
"github": ""
}
},
{
"id": "1d566374-b9aa-45a0-b2f1-e5975f26c09a",
"contentType": "text/markdown",
"comment": "comment 2",
"published": "2020-03-10T18:09:27.703Z",
"author": {
"id": "127.0.0.1:8000/author/42cc076ae73a46c58d0defa51be6751b",
"email": "test@test.com",
"bio": "",
"host": "127.0.0.1:8000",
"firstName": "test",
"lastName": "testln",
"displayName": "",
"url": "127.0.0.1:8000/author/42cc076ae73a46c58d0defa51be6751b",
"github": ""
}
}
],
"published": "2020-03-10T16:16:17.092Z",
"visibility": "PUBLIC",
"visibleTo": [],
"unlisted": false
}
]
}
- response status code:
- 404: author not found
- 403: You must be logged in to access this Endpoint
- 200: success retrieval of visible posts
http://service/author/{author_id}/posts retrieves all posts made by {AUTHOR_ID} visible to the currently authenticated user
- request method: GET
- url parameter: author_id: UUID
- If a page is provided, it retreives the posts in that page else returns page 0
- If a size is provided, retrieves pages as the size, up to the maximum set on the server (50). If no size is provided retrieves the default page size (10)
- example response:
{
"query": "posts",
"count": 1,
"size": 10,
"posts": [
{
"id": "e0f2ff2d-2103-4e30-93bb-01c18112a235",
"title": "server Post by Mary",
"source": "http://lastplaceigotthisfrom.com/posts/yyyyy",
"origin": "http://whereitcamefrom.com/posts/zzzzz",
"description": "testing stream",
"contentType": "text/markdown",
"content": "this is a server post by mary",
"author": {
"id": "127.0.0.1:8000/author/ee1172c76b0d4b4193bc8209249ed01e",
"email": "mary@mary.com",
"bio": "",
"host": "127.0.0.1:8000",
"firstName": "mary",
"lastName": "M",
"displayName": "",
"url": "127.0.0.1:8000/author/ee1172c76b0d4b4193bc8209249ed01e",
"github": ""
},
"categories": [
"server post"
],
"count": 0,
"size": 10,
"next": "127.0.0.1:8000/posts/e0f2ff2d-2103-4e30-93bb-01c18112a235/comments",
"comments": [],
"published": "2020-03-10T16:27:34.072Z",
"visibility": "SERVERONLY",
"visibleTo": [],
"unlisted": false
}
]
}
- response status code:
- 404: author not found, User does not exist
- 403: You must be logged in to access this Endpoint
- 200: success retrieval of visible posts