Skip to content

API Doc: Public Posts Access

Ryan Satyabrata edited this page Nov 4, 2016 · 6 revisions

GET /posts/

(not yet implemented)
With HTTP GET it is used to get the contents of all posts that are marked as public on the server.
One can add pagination query strings

It returns a JSON object that contains the query, the amount of posts, the page size, the next or previous page URL if exists, and of course the list of posts.

Here is an example of a response that contains 2 posts:
GET /posts/ HTTP/1.1
Header: Value

200 Ok ...

{
	"query": "posts",
	# GET to http://service/posts
	# number of posts
	"count": 1023,
	# Page size
	"size": 50,
	# Do not return next if last page
	"next": "http://service/author/posts?page=5",
	# Do not return previous if page is 0.
	"previous": "http://service/author/posts?page=3",
	# should be sorted newest(first) to oldest(last) 
	"posts":[ {
			"title":"A post title",
			"source":"http://lastplaceigotthisfrom.com/post/92c4cbd3-2e36-4b53-a66b-01bff793e62d",
			"origin":"http://whereitcamefrom.com/post/92c4cbd3-2e36-4b53-a66b-01bff793e62d",
			"description":"This post discusses stuff -- brief",
			"contentType":"text/plain",
			"content":"This post is ° ☾ ☆ ¸. ¸  ★  :.  . • ○ ° ★  .♬~♪ VROOOOM ♩♬~♪ . 
				♩♬~♪ VROOOOM ♩♬~♪ ° ☾ ☆ ¸. ¸  ★  :.  . • ○ ° ★  . Yes sir!",
			"author":{
				"id":"de305d54-75b4-431b-adb2-eb6b9e546013",
				"host":"http://127.0.0.1:5454/",
				"displayName":"Lara Croft",
				"url":"http://127.0.0.1:5454/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
				"github": "http://github.com/laracroft"
			},
			"categories":["web","tutorial"],
			"count": 1023,
			"size": 50,
			"next": "http://service/posts/{post_id}/comments",
			"comments":[
				{
					"author":{
						"id":"de305d54-75b4-431b-adb2-eb6b9e546013",
						"host":"http://127.0.0.1:5454/",
						"displayName":"Greg Johnson",
						"url":"http://127.0.0.1:5454/author
							/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
						"github": "http://github.com/gjohnson"
					},
					"comment":"Sick Olde English",
					"contentType":"text/x-markdown",
					"published":"2015-03-09T13:07:04+00:00",
					"id":"de305d54-75b4-431b-adb2-eb6b9e546013"
				}
			]
			"published":"2015-03-09T13:07:04+00:00",
			"id":"92c4cbd3-2e36-4b53-a66b-01bff793e62d",
			"visibility":"PUBLIC"
		}, {
			"title":"A post title about a post about web dev2",
			"source":"http://lastplaceigotthisfrom.com/post/yyyyy",
			"origin":"http://whereitcamefrom.com/post/zzzzz",
			"description":"This post discusses stuff -- brief",
			"contentType":"text/plain",
			"content":"Þā wæs on burgum Bēow geþolode, sē þe in þȳstrum bād, þæt hē dōgora gehwām drēam gehȳrde hlūdne in healle; þǣr wæs hearpan swēg, swutol sang scopes. Sægde sē þe cūðe frum-sceaft fīra feorran reccan",
			"author":{
				"id":"de305d54-75b4-431b-adb2-eb6b9e546013",
				"host":"http://127.0.0.1:5454/",
				"displayName":"Lara Croft",
				"url":"http://127.0.0.1:5454/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
				"github": "http://github.com/laracroft"
			},
			"categories":["web","tutorial"],
			"count": 1023,
			"size": 50,
			"next": "http://service/posts/{post_id}/comments",
			"comments":[
				{
					"author":{
						"id":"de305d54-75b4-431b-adb2-eb6b9e546013",
						"host":"http://127.0.0.1:5454/",
						"displayName":"Greg Johnson",
						"url":"http://127.0.0.1:5454/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
						"github": "http://github.com/gjohnson"
					},
					"comment":"Sick Olde English",
					"contentType":"text/x-markdown",
					"published":"2015-03-09T13:07:04+00:00",
					"id":"de305d54-75b4-431b-adb2-eb6b9e546013"
				}
			]
			"published":"2015-03-09T13:07:04+00:00",
			"id":"de305d54-75b4-431b-adb2-eb6b9e546013",
			"visibility":"PUBLIC"
		}
	]
}

Clone this wiki locally