Skip to content

Backend API Inbox

fujishig2 edited this page Mar 30, 2021 · 11 revisions

Inbox

/service/author/{AUTHOR_ID}/inbox/ For calls to Author's inbox through AUTHOR_ID

To send a Friend Request to an author's inbox:

  • Request method: POST
  • expected body:
{
    "type": "Follow",      
    "summary":"Greg wants to follow Lara",
    "actor":{
        "type":"author",
        "id":"http://127.0.0.1:5454/author/1d698d25ff008f7538453c120f581471",
        "url":"http://127.0.0.1:5454/author/1d698d25ff008f7538453c120f581471",
        "host":"http://127.0.0.1:5454/",
        "displayName":"Greg Johnson",
        "github": "http://github.com/gjohnson"
    },
    "object":{
        "type":"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"
    }
}
  • response status code:
    • 200: Success
    • 304: actor id is already a follower
    • 405: method not allowed

To send a Post that's been shared with the author:

  • Request method: POST
  • expected body:
{
    "type":"post",
            "title":"A Friendly post title about a post about web dev",
            "id":"http://127.0.0.1:5454/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e/posts/764efa883dda1e11db47671c4a3bbd9e"
            "source":"http://lastplaceigotthisfrom.com/posts/yyyyy",
            "origin":"http://whereitcamefrom.com/posts/zzzzz",
            "description":"This post discusses stuff -- brief",
            "contentType":"text/plain",
            "content":"Are you even reading my posts Arjun?",
            "author":{
                  "type":"author",
            	"id":"http://127.0.0.1:5454/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
            	"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"],
            "comments":"http://127.0.0.1:5454/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e/posts/de305d54-75b4-431b-adb2-eb6b9e546013/comments"
            "published":"2015-03-09T13:07:04+00:00",
            "visibility":"FRIENDS",
            "unlisted":false
}
  • response status code:
    • 200: Success
    • 400: author not found
    • 405: method not allowed

To send a like to that authors inbox:

  • Request method: POST
  • expected body:
{
     "@context": "https://www.citrusnetwork.herokuapp.com/service/author/<author_id>/view-post/<post_id>/",
     "summary": "Lara Croft Likes your post",         
     "type": "Like",
     "author":{
         "type":"author",
         "id":"http://127.0.0.1:5454/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
         "host":"http://127.0.0.1:5454/",
         "displayName":"Lara Croft",
         "url":"http://127.0.0.1:5454/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e",
         "github":"http://github.com/laracroft"
     },
     "object":"http://127.0.0.1:5454/author/9de17f29c12e8f97bcbbd34cc908f1baba40658e/posts/764efa883dda1e11db47671c4a3bbd9e"
}
   
  • response status code:
    • 200: Success
    • 400: author not found
    • 405: method not allowed

Clone this wiki locally