Skip to content

RESTful API P2

annypanny edited this page Nov 29, 2016 · 13 revisions

/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:

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": ""
	    }
	]
}
Clone this wiki locally