API Documentation - TeamNotFound-group-cmput404-project/project GitHub Wiki

{
        "post_id": "91e0c0a1-f563-45a2-81c5-8e0a8b223cc1",
        "id": "https://iconicity-part2.herokuapp.com/author/4d6c1e57-d977-4fed-91fb-691b87a7ccb5/posts/91e0c0a1-f563-45a2-81c5-8e0a8b223cc1",
        "title": "12312",
        "type": "post",
        "source": "https://iconicity-part2.herokuapp.com/author/4d6c1e57-d977-4fed-91fb-691b87a7ccb5/posts/91e0c0a1-f563-45a2-81c5-8e0a8b223cc1",
        "origin": "https://iconicity-part2.herokuapp.com/author/4d6c1e57-d977-4fed-91fb-691b87a7ccb5/posts/91e0c0a1-f563-45a2-81c5-8e0a8b223cc1",
        "description": "123123",
        "contentType": "text/plain",
        "author": {
            "type": "author",
            "id": "https://iconicity-part2.herokuapp.com/author/4d6c1e57-d977-4fed-91fb-691b87a7ccb5",
            "url": "https://iconicity-part2.herokuapp.com/author/4d6c1e57-d977-4fed-91fb-691b87a7ccb5",
            "host": "iconicity-part2.herokuapp.com",
            "displayName": "MichaelQi",
            "github": "https://github.com/MichaelQi11"
        },
        "content": "123123",
        "visibility": "PUBLIC",
        "categories": {},
        "unlisted": false,
        "image": "/media/images/G_z2AGWa.jpg",
        "like": [],
        "external_likes": {},
        "count": 0,
        "size": 0,
        "published": "2021-04-01T01:43:37.964271Z",
        "host": "",
        "like_count": 0,
        "comments": [],
        "author_display_name": "MichaelQi"
    }
}

  • Inbox

    • URL:/author/{AUTHOR_ID}/inbox
    • GET: if authenticated get a list of posts sent to {AUTHOR_ID}
    • POST: send a comment, like or follow to the author
    • if the type is “comment” then add that comment to the author’s inbox Ex. requests.post(full_postinbox_url, data={"obj":json.dumps(comment_object_serialized)}, auth=HTTPBasicAuth(auth_user, auth_pass))
    • if the type is “follow” then add that follow is added to the author’s inbox to approve later Ex. requests.post(full_followee_url, data={"obj":json.dumps(frd_request_objectr_serialized)}, auth=HTTPBasicAuth(auth_user, auth_pass))
    • if the type is “like” then add that like to the author’s inbox Ex. requests.post(full_postinbox_url, data={"obj":json.dumps(like_object_serialized)}, auth=HTTPBasicAuth(auth_user, auth_pass)) The detailed structure of each project can be found in the following specific sections.
    • Example: GET https://iconicity-part2.herokuapp.com/author/4d6c1e57-d977-4fed-91fb-691b87a7ccb5/inbox
{    "items": [],
    "author": "https://iconicity-part2.herokuapp.com/author/4d6c1e57-d977-4fed-91fb-691b87a7ccb5",
    "type": "inbox"
    }

    {"type": "author",
    "id": "https://iconicity-part2.herokuapp.com/author/4d6c1e57-d977-4fed-91fb-691b87a7ccb5",
    "url": "https://iconicity-part2.herokuapp.com/author/4d6c1e57-d977-4fed-91fb-691b87a7ccb5",
    "host": "iconicity-part2.herokuapp.com",
    "displayName": "MichaelQi",
    "github": "https://github.com/MichaelQi11"
     }

  • Followers

    • URL:/author/{AUTHOR_ID}/followers
    • GET: get a list of authors who are their followers
    • URL:/author/{AUTHOR_ID}/followers/{FOREIGN_AUTHOR_ID}
    • GET check if follower
    • Example: GET:/author/{AUTHOR_ID}/followers
      {
          "type": "followers",      
          "items":[
              {
                  "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"
              },
              {
                  "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"
              }
          ]
      }

  • FriendRequest

    • This allows someone to follow you, so you can send them your posts.
    • Sent to inbox
    • Example format:
      {
          "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"
          }
      }
      

  • Comments

    • URL:/author/{author_id}/posts/{post_id}/comments
      • GET get comments of the post
      • POST if you post an object of "type":"comment", it will add your comment to the post
      • Comment id is the auto generated UUID of the comment
    • example comment:
      {
          "type":"comment",
      	  "author":{
              "type":"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":"f6255bb01c648fe967714d52a89e8e9c",
      }
      

  • Likes

    • You can like posts and comments
    • Send them to the inbox
    • URL:/author/{author_id}/inbox/
      • POST: send a like object to {author_id}
    • URL:/author/{author_id}/post/{post_id}/likes
      • GET a list of likes from other authors on author_id's post post_id
    • Example like object:
      {
          "@context": "https://www.w3.org/ns/activitystreams",
          "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"
      
    }