-
Notifications
You must be signed in to change notification settings - Fork 2
RESTful API P2
/author/[author_id]/posts
-
It used to get the content of all the posts of a single user that are public to the current authenticate author.
-
It returned a JSON.
-
JSON file contains:
- "count"
- "next"
- "previous"
- "results"
and in each "results" it contains:
- "id"
- "published"
- "title"
- "description"
- "content_type"
- "content"
- "source"
- "origin"
- "author"
- "comments"
- "visibility"
- "image"
and in each "author" it contains:
- "displayName"
- "id"
- "host"
- "url"
- "github"
Optional parameter:
-
?page={integer}
The page you want to see now and it's less than or equal to the total number of pages the server has.
example url: http://127.0.0.1:8000/author/c974a1fd-fa8c-4d99-97d6-6006e0ee0a5f/posts?page=1 (shows page 1)
-
?page={integer}&size={integer}
The page you want to see now, and each page shows exactly the number of post you request in the size.
example url: http://127.0.0.1:8000/author/c974a1fd-fa8c-4d99-97d6-6006e0ee0a5f/posts?page=1&size=5 (shows page 1, and each page has 5 posts)
Method:
GET
Example:
GET /author/c974a1fd-fa8c-4d99-97d6-6006e0ee0a5f/posts
HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": "20d4a6fb-da69-4359-90a6-44497ae533cc",
"published": "2016-11-27T23:30:44.598751Z",
"title": "I love dogs",
"description": "Dogs are nice",
"contentType": "text/plain",
"content": "I like them",
"source": "http://socialnets404.herokuapp.com/posts/20d4a6fb-da69-4359-90a6-44497ae533cc/",
"origin": "http://socialnets404.herokuapp.com/posts/20d4a6fb-da69-4359-90a6-44497ae533cc/",
"author": {
"displayName": "Administrator",
"id": "c974a1fd-fa8c-4d99-97d6-6006e0ee0a5f",
"host": "http://socialnets404.herokuapp.com/",
"url": "http://socialnets404.herokuapp.com/author/c974a1fd-fa8c-4d99-97d6-6006e0ee0a5f",
"github": "jiafengwu0301"
},
"comments": [],
"visibility": "PUBLIC",
"image": ""
},
{
"id": "44ad3256-4486-42b9-8e07-9d195e802985",
"published": "2016-11-28T00:16:41.358555Z",
"title": "I will travel to Japan",
"description": "Japan travel",
"contentType": "text/plain",
"content": "It must be a nice place",
"source": "http://socialnets404.herokuapp.com/posts/44ad3256-4486-42b9-8e07-9d195e802985",
"origin": "http://socialnets404.herokuapp.com/posts/44ad3256-4486-42b9-8e07-9d195e802985",
"author": {
"displayName": "Administrator",
"id": "c974a1fd-fa8c-4d99-97d6-6006e0ee0a5f",
"host": "http://socialnets404.herokuapp.com/",
"url": "http://socialnets404.herokuapp.com/author/c974a1fd-fa8c-4d99-97d6-6006e0ee0a5f",
"github": "jiafengwu0301"
},
"comments": [],
"visibility": "FRIENDS",
"image": ""
}
]
}