forked from abramhindle/CMPUT404-project-socialdistribution
-
Notifications
You must be signed in to change notification settings - Fork 1
Posts API
Fraser Redford edited this page Apr 1, 2021
·
20 revisions
This will return all posts written by a given author.
No body required
[
{
"type": "post",
"title": "This is the best post of all time",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/ef2347c8cb4a47879c95442f0ee2a514",
"source": "https://team6-project-socialdistrib.herokuapp.com/",
"origin": "https://team6-project-socialdistrib.herokuapp.com/",
"description": "this is a text post",
"contentType": "text/plain",
"content": "This is some text that goes in the post body",
"categories": [
"Test",
" this",
" with",
" tags"
],
"count": 0,
"size": 50,
"commentLink": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/ef2347c8cb4a47879c95442f0ee2a514/comments",
"comments": [],
"published": "2021-04-01T19:07:34.802718Z",
"visibility": "PUBLIC",
"unlisted": false,
"author": {
"type": "author",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"host": "https://team6-project-socialdistrib.herokuapp.com/",
"displayName": "fraser",
"url": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"github": "github.com/fredford"
}
},
{
"type": "post",
"title": "This is the second best post of all time",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/ad123c8cb4a47879c95442f0ee2a514",
"source": "https://team6-project-socialdistrib.herokuapp.com/",
"origin": "https://team6-project-socialdistrib.herokuapp.com/",
"description": "this post that contains a little bit of text in it",
"contentType": "text/plain",
"content": "This is some text that goes in the post body",
"categories": [
"Other",
"post",
"with",
"tags"
],
"count": 0,
"size": 50,
"commentLink": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/ad123c8cb4a47879c95442f0ee2a514/comments",
"comments": [],
"published": "2021-04-01T19:07:34.802718Z",
"visibility": "PUBLIC",
"unlisted": false,
"author": {
"type": "author",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"host": "https://team6-project-socialdistrib.herokuapp.com/",
"displayName": "fraser",
"url": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"github": "github.com/fredford"
}
}
]
-
200 OKupon a successful retrieval of a posts list -
403 FORBIDDENif a user is not authenticated -
400 BAD REQUESTif bad information is passed in the request
This will create a new post for a given author.
| Field | Required/Optional | Description |
|---|---|---|
| title | Required | The headline for the post |
| source | Optional | The host url that sent this post |
| origin | Optional | The host url that created the post |
| description | Required | A description of the post |
| contentType | Required | The format of content sent (text/markdown, text/plain, application/base64, image/png, image/jpeg) |
| content | Required | The information being posted |
| categories | Required | Comma separated tags to describe a post |
| visibility | Required | Sets who can view the post ("PUBLIC", "PRIVATE", "FRIENDS") |
| unlisted | Required | Sets if the post is listed in timelines |
| author | Required | Author object JSON to describe the post writer |
{
"type": "post",
"title": "This is the third best post of all time",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514",
"source": "https://team6-project-socialdistrib.herokuapp.com/",
"origin": "https://team6-project-socialdistrib.herokuapp.com/",
"description": "this is a text post",
"contentType": "text/plain",
"content": "This is some text that goes in the post body",
"categories": [
"Test",
"post",
"author"
],
"count": 0,
"size": 50,
"commentLink": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514/comments",
"comments": [],
"published": "2021-04-01T19:07:34.802718Z",
"visibility": "PUBLIC",
"unlisted": false,
"author": {
"type": "author",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"host": "https://team6-project-socialdistrib.herokuapp.com/",
"displayName": "fraser",
"url": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"github": "github.com/fredford"
}
},
{
"type": "post",
"title": "This is the third best post of all time",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514",
"source": "https://team6-project-socialdistrib.herokuapp.com/",
"origin": "https://team6-project-socialdistrib.herokuapp.com/",
"description": "this is a text post",
"contentType": "text/plain",
"content": "This is some text that goes in the post body",
"categories": [
"Test",
"post",
"author"
],
"count": 0,
"size": 50,
"commentLink": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514/comments",
"comments": [],
"published": "2021-04-01T19:07:34.802718Z",
"visibility": "PUBLIC",
"unlisted": false,
"author": {
"type": "author",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"host": "https://team6-project-socialdistrib.herokuapp.com/",
"displayName": "fraser",
"url": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"github": "github.com/fredford"
}
}
-
201 CREATEDupon a successful creation of a post -
403 FORBIDDENif a user is not authenticated -
400 BAD REQUESTif bad information is passed in the request
This will retrieve the specific post given a post ID for a given author.
No body requirements
No request required
{
"type": "post",
"title": "This is the third best post of all time",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514",
"source": "https://team6-project-socialdistrib.herokuapp.com/",
"origin": "https://team6-project-socialdistrib.herokuapp.com/",
"description": "this is a text post",
"contentType": "text/plain",
"content": "This is some text that goes in the post body",
"categories": [
"Test",
"post",
"author"
],
"count": 0,
"size": 50,
"commentLink": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514/comments",
"comments": [],
"published": "2021-04-01T19:07:34.802718Z",
"visibility": "PUBLIC",
"unlisted": false,
"author": {
"type": "author",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"host": "https://team6-project-socialdistrib.herokuapp.com/",
"displayName": "fraser",
"url": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"github": "github.com/fredford"
}
}
-
200 OKupon a successful retrieval of a post -
403 FORBIDDENif a user is not authenticated -
400 BAD REQUESTif bad information is passed in the request
This will allow for an update to be performed on the specific post's data given.
| Field | Required/Optional | Description |
|---|---|---|
| title | Required | The headline for the post |
| source | Optional | The host url that sent this post |
| origin | Optional | The host url that created the post |
| description | Required | A description of the post |
| contentType | Required | The format of content sent (text/markdown, text/plain, application/base64, image/png, image/jpeg) |
| content | Required | The information being posted |
| categories | Required | Comma separated tags to describe a post |
| visibility | Required | Sets who can view the post ("PUBLIC", "PRIVATE", "FRIENDS") |
| unlisted | Required | Sets if the post is listed in timelines |
| author | Required | Author object JSON to describe the post writer |
{
"type": "post",
"title": "This is the third best post of all time",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514",
"source": "https://team6-project-socialdistrib.herokuapp.com/",
"origin": "https://team6-project-socialdistrib.herokuapp.com/",
"description": "this is a text post",
"contentType": "text/plain",
"content": "This is some text that goes in the post body",
"categories": [
"Test",
"post",
"author"
],
"count": 0,
"size": 50,
"commentLink": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514/comments",
"comments": [],
"published": "2021-04-01T19:07:34.802718Z",
"visibility": "PUBLIC",
"unlisted": false,
"author": {
"type": "author",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"host": "https://team6-project-socialdistrib.herokuapp.com/",
"displayName": "fraser",
"url": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"github": "github.com/fredford"
}
},
{
"type": "post",
"title": "This is the third best post of all time",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514",
"source": "https://team6-project-socialdistrib.herokuapp.com/",
"origin": "https://team6-project-socialdistrib.herokuapp.com/",
"description": "this is a text post",
"contentType": "text/plain",
"content": "This is some text that goes in the post body",
"categories": [
"Test",
"post",
"author"
],
"count": 0,
"size": 50,
"commentLink": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514/comments",
"comments": [],
"published": "2021-04-01T19:07:34.802718Z",
"visibility": "PUBLIC",
"unlisted": false,
"author": {
"type": "author",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"host": "https://team6-project-socialdistrib.herokuapp.com/",
"displayName": "fraser",
"url": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"github": "github.com/fredford"
}
}
-
200 OKupon a successful update of a post -
403 FORBIDDENif a user is not authenticated -
400 BAD REQUESTif bad information is passed in the request
This will allow the deletion of a specific post by author of the post.
No body required
No request required
No body response sent
-
200 OKupon a successful deletion of a post -
403 FORBIDDENif a user is not authenticated -
400 BAD REQUESTif bad information is passed in the request
This will create a post given the specific author ID and post ID.
| Field | Required/Optional | Description |
|---|---|---|
| title | Required | The headline for the post |
| source | Optional | The host url that sent this post |
| origin | Optional | The host url that created the post |
| description | Required | A description of the post |
| contentType | Required | The format of content sent (text/markdown, text/plain, application/base64, image/png, image/jpeg) |
| content | Required | The information being posted |
| categories | Required | Comma separated tags to describe a post |
| visibility | Required | Sets who can view the post ("PUBLIC", "PRIVATE", "FRIENDS") |
| unlisted | Required | Sets if the post is listed in timelines |
| author | Required | Author object JSON to describe the post writer |
{
"type": "post",
"title": "This is the third best post of all time",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514",
"source": "https://team6-project-socialdistrib.herokuapp.com/",
"origin": "https://team6-project-socialdistrib.herokuapp.com/",
"description": "this is a text post",
"contentType": "text/plain",
"content": "This is some text that goes in the post body",
"categories": [
"Test",
"post",
"author"
],
"count": 0,
"size": 50,
"commentLink": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514/comments",
"comments": [],
"published": "2021-04-01T19:07:34.802718Z",
"visibility": "PUBLIC",
"unlisted": false,
"author": {
"type": "author",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"host": "https://team6-project-socialdistrib.herokuapp.com/",
"displayName": "fraser",
"url": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"github": "github.com/fredford"
}
},
{
"type": "post",
"title": "This is the third best post of all time",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514",
"source": "https://team6-project-socialdistrib.herokuapp.com/",
"origin": "https://team6-project-socialdistrib.herokuapp.com/",
"description": "this is a text post",
"contentType": "text/plain",
"content": "This is some text that goes in the post body",
"categories": [
"Test",
"post",
"author"
],
"count": 0,
"size": 50,
"commentLink": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514/comments",
"comments": [],
"published": "2021-04-01T19:07:34.802718Z",
"visibility": "PUBLIC",
"unlisted": false,
"author": {
"type": "author",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"host": "https://team6-project-socialdistrib.herokuapp.com/",
"displayName": "fraser",
"url": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"github": "github.com/fredford"
}
}
-
200 OKupon a successful update of a post -
403 FORBIDDENif a user is not authenticated -
400 BAD REQUESTif bad information is passed in the request
This will create a post for a specific author, intended for use with friends-only or private posts.
| Field | Required/Optional | Description |
|---|---|---|
| title | Required | The headline for the post |
| source | Optional | The host url that sent this post |
| origin | Optional | The host url that created the post |
| description | Required | A description of the post |
| contentType | Required | The format of content sent (text/markdown, text/plain, application/base64, image/png, image/jpeg) |
| content | Required | The information being posted |
| categories | Required | Comma separated tags to describe a post |
| visibility | Required | Sets who can view the post ("PUBLIC", "PRIVATE", "FRIENDS") |
| unlisted | Required | Sets if the post is listed in timelines |
| author | Required | Author object JSON to describe the post writer |
{
"type": "post",
"title": "This is the third best post of all time",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514",
"source": "https://team6-project-socialdistrib.herokuapp.com/",
"origin": "https://team6-project-socialdistrib.herokuapp.com/",
"description": "this is a text post",
"contentType": "text/plain",
"content": "This is some text that goes in the post body",
"categories": [
"Test",
"post",
"author"
],
"count": 0,
"size": 50,
"commentLink": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514/comments",
"comments": [],
"published": "2021-04-01T19:07:34.802718Z",
"visibility": "PRIVATE",
"unlisted": false,
"author": {
"type": "author",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"host": "https://team6-project-socialdistrib.herokuapp.com/",
"displayName": "fraser",
"url": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"github": "github.com/fredford"
}
},
{
"type": "post",
"title": "This is the third best post of all time",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514",
"source": "https://team6-project-socialdistrib.herokuapp.com/",
"origin": "https://team6-project-socialdistrib.herokuapp.com/",
"description": "this is a text post",
"contentType": "text/plain",
"content": "This is some text that goes in the post body",
"categories": [
"Test",
"post",
"author"
],
"count": 0,
"size": 50,
"commentLink": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47/posts/abcdefc8cb4a47879c95442f0ee2a514/comments",
"comments": [],
"published": "2021-04-01T19:07:34.802718Z",
"visibility": "PUBLIC",
"unlisted": false,
"author": {
"type": "author",
"id": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"host": "https://team6-project-socialdistrib.herokuapp.com/",
"displayName": "fraser",
"url": "https://team6-project-socialdistrib.herokuapp.com/author/a3b412cdef384862ad5fb8a5366e0e47",
"github": "github.com/fredford"
}
}
-
200 OKupon a successful update of a post -
403 FORBIDDENif a user is not authenticated -
400 BAD REQUESTif bad information is passed in the request