Skip to content

RESTful API P3

annypanny edited this page Nov 29, 2016 · 10 revisions

/posts/[post_id]

  • It used to get a single posts by post id.
  • It returned a JSON.
  • JSON file 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:

Optional parameter:

Method:

GET

Example:

GET /posts/20d4a6fb-da69-4359-90a6-44497ae533cc


HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

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