- 
                Notifications
    
You must be signed in to change notification settings  - Fork 0
 
API Doc: Posts by Author Access
        Carson McLean edited this page Nov 30, 2016 
        ·
        8 revisions
      
    With HTTP GET it is used to get the contents of all posts created by given {AUTHOR_ID} that are visible to the currently authenticated user. {AUTHOR_ID} is the [UUID]
All posts will be sent except posts marked as SERVERONLY.
(http://en.wikipedia.org/wiki/Universally_unique_identifier) of the author whom you want to get all their posts from, which is required.
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 that contains 2 posts by example user Lara Croft (UUID: de305d54-75b4-431b-adb2-eb6b9e546013):
GET /api/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":"NOPE this ain't a public post. But only to friends of friends.",
			"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":"FOAF"
		}, {
			"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":"This is all can see, Þublic 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"
		}
	]
}