This file specifies what posts look like: # This is not proper JSON, set editor to Spaces - 4 when editing this # The following are ways URIs that can be used for post retrieval # # http://service/author/posts (posts that are visible to the currently authenticated user) # or # http://service/posts (all posts marked as public on the server) # or # http://service/author/{AUTHOR_ID}/posts (all posts made by {AUTHOR_ID} visible to the currently authenticated user) # or # http://service/posts/{POST_ID} access to a single post with id = {POST_ID} # or # http://service/posts/{post_id}/comments access to the comments in a post # # All of the previous URIs will get a list of posts like this: # If a page is provided, return the results for that page, if no page is provided return page 0 # If a size is provided, return pages in this size up to the maximum set on the server. If no size is provided # return the default page size # Use same pagination style for all endpoints in this file # Example: # GET http://service/author/posts?page=4&size=50 # GET http://service/author/posts?page=4 { "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 of a post "title":"A post title about a post about web dev", # where did you get this post from? "source":"http://lastplaceigotthisfrom.com/posts/yyyyy", # where is it actually from "origin":"http://whereitcamefrom.com/posts/zzzzz", # a brief description of the post "description":"This post discusses stuff -- brief", # The content type of the post # assume either # text/markdown # text/plain # application/base64 # image/png;base64 # this is an embedded png -- images are POSTS. So you might have a user make 2 posts if a post includes an image! # image/jpeg;base64 # this is an embedded jpeg # for HTML you will want to strip tags before displaying "contentType":"text/plain", "content":"Þā wæs on burgum Bēowulf Scyldinga, lēof lēod-cyning, longe þrāge folcum gefrǣge (fæder ellor hwearf, aldor of earde), oð þæt him eft onwōc hēah Healfdene; hēold þenden lifde, gamol and gūð-rēow, glæde Scyldingas. Þǣm fēower bearn forð-gerīmed in worold wōcun, weoroda rǣswan, Heorogār and Hrōðgār and Hālga til; hȳrde ic, þat Elan cwēn Ongenþēowes wæs Heaðoscilfinges heals-gebedde. Þā wæs Hrōðgāre here-spēd gyfen, wīges weorð-mynd, þæt him his wine-māgas georne hȳrdon, oð þæt sēo geogoð gewēox, mago-driht micel. Him on mōd bearn, þæt heal-reced hātan wolde, medo-ærn micel men gewyrcean, þone yldo bearn ǣfre gefrūnon, and þǣr on innan eall gedǣlan geongum and ealdum, swylc him god sealde, būton folc-scare and feorum gumena. Þā ic wīde gefrægn weorc gebannan manigre mǣgðe geond þisne middan-geard, folc-stede frætwan. Him on fyrste gelomp ǣdre mid yldum, þæt hit wearð eal gearo, heal-ærna mǣst; scōp him Heort naman, sē þe his wordes geweald wīde hæfde. Hē bēot ne ālēh, bēagas dǣlde, sinc æt symle. Sele hlīfade hēah and horn-gēap: heaðo-wylma bād, lāðan līges; ne wæs hit lenge þā gēn þæt se ecg-hete āðum-swerian 85 æfter wæl-nīðe wæcnan scolde. Þā se ellen-gǣst earfoðlīce þrāge 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", # the author has an ID where by authors can be disambiguated "author":{ # ID of the Author "id":"http://127.0.0.1:5454/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e", # the home host of the author "host":"http://127.0.0.1:5454/", # the display name of the author "displayName":"Lara Croft", # url to the authors profile "url":"http://127.0.0.1:5454/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e", # HATEOS url for Github API "github": "http://github.com/laracroft" }, # categories this post fits into (a list of strings "categories":["web","tutorial"], # comments about the post # return a maximum number of comments # total number of comments for this post "count": 1023, # page size "size": 50, # the first page of comments "next": "http://service/posts/{post_id}/comments", # You should return ~ 5 comments per post. # should be sorted newest(first) to oldest(last) "comments":[ { "author":{ # ID of the Author (UUID) "id":"http://127.0.0.1:5454/author/1d698d25ff008f7538453c120f581471", # url to the authors information "url":"http://127.0.0.1:5454/author/1d698d25ff008f7538453c120f581471", "host":"http://127.0.0.1:5454/", "displayName":"Greg Johnson", # HATEOS url for Github API "github": "http://github.com/gjohnson" }, "comment":"Sick Olde English", "contentType":"text/markdown", # ISO 8601 TIMESTAMP "published":"2015-03-09T13:07:04+00:00", # ID of the Comment (UUID) "id":"de305d54-75b4-431b-adb2-eb6b9e546013" } ] # ISO 8601 TIMESTAMP "published":"2015-03-09T13:07:04+00:00", # ID of the Post (UUID) "id":"de305d54-75b4-431b-adb2-eb6b9e546013", # visibility ["PUBLIC","FOAF","FRIENDS","PRIVATE","SERVERONLY"] "visibility":"PUBLIC", "visibleTo":[], # list of author URIs who can read the PRIVATE message # for visibility PUBLIC means it is open to the wild web # FOAF means it is only visible to Friends of A Friend # If any of my friends are your friends I can see the post # FRIENDS means if we're direct friends I can see the post # PRIVATE means only you can see the post # SERVERONLY means only those on your server (your home server) can see the post # PRIVATE means only authors listed in "visibleTo" can see the post "unlisted":false # unlisted means it is public if you know the post name -- use this for images, it's so images don't show up in timelines } ] } # Example # http://service/posts/{post_id}/comments access to the comments in a post # http://service/posts/{post_id}/comments?page=4 # http://service/posts/{post_id}/comments?page=4&size=40 { "query": "comments", # comments about the post # return a maximum number of comments # A list of posts "count": 1023, "size": 50, # Do not return next if last page "next": "http://service/posts/{post_id}/comments?page=5", # Do not return previous if page is 0. "previous": "http://service/posts/{post_id}/comments?page=3", "comments":[{ "author":{ "id":"http://127.0.0.1:5454/8d919f29c12e8f97bcbbd34cc908f19ab9496989", "host":"http://127.0.0.1:5454/", "displayName":"Greg" }, "comment":"Sick Olde English", "contentType":"text/markdown", "published":"2015-03-09T13:07:04+00:00", "id":"5471fe89-7697-4625-a06e-b3ad18577b72" }] } # JSON post body of what you post to a posts' comemnts # POST to http://service/posts/{POST_ID}/comments { "query": "addComment", "post":"http://whereitcamefrom.com/posts/zzzzz", "comment":{ "author":{ # ID of the Author "id":"http://127.0.0.1:5454/author/1d698d25ff008f7538453c120f581471", "host":"http://127.0.0.1:5454/", "displayName":"Greg Johnson", # url to the authors information "url":"http://127.0.0.1:5454/author/1d698d25ff008f7538453c120f581471", # HATEOS url for Github API "github": "http://github.com/gjohnson" }, "comment":"Sick Olde English", "contentType":"text/markdown", # ISO 8601 TIMESTAMP "published":"2015-03-09T13:07:04+00:00", # ID of the Comment (UUID) "id":"de305d54-75b4-431b-adb2-eb6b9e546013" } } # Responds with # 200 OK { "query": "addComment", "success":true, "message":"Comment Added" } # or if they don't have the visibility # 403 Forbidden { "query": "addComment", "success":false, "message":"Comment not allowed" } # a reponse if friends or not # ask a service GET http://service/author//friends/ responds with: { "query":"friends", # Array of Author UUIDs "authors":[ "http://host3/author/de305d54-75b4-431b-adb2-eb6b9e546013", "http://host2/author/ae345d54-75b4-431b-adb2-fb6b9e547891" ] } # Ask if 2 authors are friends # GET http://service/author//friends/ # STRIP the http:// and https:// from the URI in the restful query # If you need a template (optional): GET http://service/author//friends//author/ # where authorid1 = de305d54-75b4-431b-adb2-eb6b9e546013 (actually author http://service/author/de305d54-75b4-431b-adb2-eb6b9e546013 ) # where authorid2 = # GET http://service/author/de305d54-75b4-431b-adb2-eb6b9e546013/friends/127.0.0.1%3A5454%2Fauthor%2Fae345d54-75b4-431b-adb2-fb6b9e547891 # Please escape / of IDs with %2F e.g. urllib.parse.quote( "http://service/author/whatever" , safe='~()*!.\'') # responds with: { "query":"friends", # Array of Author UUIDs "authors":[ "http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013", "http://127.0.0.1:5454/author/ae345d54-75b4-431b-adb2-fb6b9e547891" ], # boolean true or false "friends": true } # ask a service if anyone in the list is a friend # POST to http://service/author//friends { "query":"friends", "author":"", # Array of Author ids "authors": [ "http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013", "http://127.0.0.1:5454/author/ae345d54-75b4-431b-adb2-fb6b9e547891", "...", "...", "..." ] } # reponds with { "query":"friends", "author":"", # where is the full URL of the author in question # Array of Author ids who are friends "authors": [ "http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013", "http://127.0.0.1:5454/author/ae345d54-75b4-431b-adb2-fb6b9e547891", "..." ] } # This is needed for FOAF calls, it asks the other server to decide to send us a # post or not based on friends. # one of Greg's friends has to be be LARA's friend # Here GREG tries to get a post from LARA that's marked as FOAF visibility # the server will query greg's server to ensure that he is friends with 7de and 11c # then it will get the users from its own server and see if they are friends of Lara # Then it will go to at least 1 of these friend's servers and verify that they are friends of Greg # once it is verified via the 3 hosts that Greg is a friend, then greg will get the data for lara's post # POST to http://service/posts/{POST_ID} , sending the body { "query":"getPost", "postid":"{POST_ID}", "url":"http://service/posts/{POST_ID}", "author":{ # requestor # UUID "id":"http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013", "host":"http://127.0.0.1:5454/", "displayName":"Jerry Johnson", # url to the authors information "url":"http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013", # HATEOS "github": "http://github.com/jjohnson" }, # friends of author "friends":[ "http://127.0.0.1:5454/author/7deee0684811f22b384ccb5991b2ca7e78abacde", "http://127.0.0.1:5454/author/11c3783f15f7ade03430303573098f0d4d20797b", ] } # then this returns with the generic GET http://service/posts/{POST_ID} # to make a friend request, POST to http://service/friendrequest { "query":"friendrequest", "author": { "id":"http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013", "host":"http://127.0.0.1:5454/", "displayName":"Greg Johnson" "url":"http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013", }, "friend": { "id":"http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e637281", "host":"http://127.0.0.1:5454/", "displayName":"Lara Croft", "url":"http://127.0.0.1:5454/author/de305d54-75b4-431b-adb2-eb6b9e546013", } } # to unfriend simply do it locally # Profile API calls # GET http://service/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e # Enables viewing of foreign author's profiles # # Response { "id":"http://service/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e", "host":"http://127.0.0.1:5454/", "displayName":"Lara", "url":"http://127.0.0.1:5454/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e", "friends": [ { "id":"http://127.0.0.1:5454/author/8d919f29c12e8f97bcbbd34cc908f19ab9496989", "host":"http://127.0.0.1:5454/", "displayName":"Greg", "url": "http://127.0.0.1:5454/author/8d919f29c12e8f97bcbbd34cc908f19ab9496989" } ], # Optional attributes "github": "http://github.com/lara", "firstName": "Lara", "lastName": "Smith", "email": "lara@lara.com", "bio": "Hi, I'm Lara" }