-
Notifications
You must be signed in to change notification settings - Fork 3
Konnection API Endpoints
keanweng97 edited this page Mar 22, 2021
·
14 revisions
Last Updated: Feb 19, 2021
- Methods:
- POST: Create a new user
- Accepted payload:
{ "username":"abc", "password":"password" }
- Returned payload:
{"username":"abc",}
- Accepted payload:
- POST: Create a new user
- Methods:
- POST: Log in and get login token
- Accepted payload:
{ "username":"abc", "password":"password" }
- Returned payload:
{ "token":"dsfjosjfjsdlfnksanfk-noawenfon",}
- Accepted payload:
- POST: Log in and get login token
- Methods:
- GET: Get current user profile
- Accepted Header:
"Authorization: Token <ACCESS_TOKEN>"
- Returned payload:
{ "username": "testing12", "type": "UserType.author", "id": "xxxxxxxxxxx", "host": "", "displayName": "", "URL": "", "github": "" }
- Accepted Header:
- GET: Get current user profile
- Methods:
- PUT: Update author profile
- Accepted Header:
"Authorization: Token <ACCESS_TOKEN>"
- Returned payload:
{ "username": "testing12", "type": "UserType.author", "id": "xxxxxxxxxxx", "host": "", "displayName": "new display name", "URL": "", "github": "new GitHub account URL" }
- Accepted Header:
- PUT: Update author profile
- Methods:
- GET: get a list of posts made by the author (paginated)
- POST: create a new post
- Notes:
- Currently no pagination is implemented
- You can only get your own posts or another user's public posts
- Methods:
- GET: get the public post
- POST: update the post
- DELETE: remove the post
- PUT: create a post with that post_id
{
"title": "Title", # max 100 chars
"source": "http://example.com/source", # type: url
"origin": "http://example.com/origin", # type: url
"description": "A brief description", # max 250 chars
"contentType": "text/html", # max 18 chars
"content": "<h1>hello</h1>", # upper limit of 1GB
"visibility": "PUBLIC", # default: PUBLIC
"unlisted": False # default: False
}
{
"type": "post",
"title": "New Title",
"id": "http://127.0.0.1:8000/author/ce350c18-4c0e-447b-b829-27685a6c37b9/posts/9fdf860d-7f23-4c34-857e-11af1ad9e20c/",
"source": "",
"origin": "",
"description": "here is the description",
"contentType": "text/markdown",
"content": null,
"author": {
"type": "UserType.superuser",
"id": "http://127.0.0.1:8000/author/ce350c18-4c0e-447b-b829-27685a6c37b9",
"host": "http://127.0.0.1:8000",
"displayName": "",
"URL": "",
"github": ""
},
"count": 0,
"size": 0,
"published": "2021-02-18T07:21:52.915800Z",
"visibility": "PUBLIC",
"unlisted": false
}
- Accepted values:
- contentType: text/markdown, text/plain, text/html, application/base64, image/png;base64, image/jpeg;base64
- visibility: PUBLIC, FRIENDS
- Methods:
- GET: get a list of authors who are their followers
- Methods;
- DELETE: remove a follower
- PUT: Add a follower (must be authenticated)
- GET check if follower
{
"type": "followers",
"items": [
{
"username": "abc123",
"type": "Author",
"id": "63248785-c0b0-4e54-b2e9-4477ewfhiwefniwuen",
"host": "http://127.0.0.1:8000",
"displayName": "",
"url": "",
"github": ""
},
...
]
}
- GET: get a list of posts sent to {AUTHOR_ID}, only if you are authenticated as that Author
- POST: send a post (type: Post, Follow, Like) to the Author
- DELETE: empties the Inbox
No payload required but has to be authenticated.
- Can send public Posts and whatever Posts I can see to my friends
- Sent Posts cannot be modified even if the original Post is modified
Payload:
{
"type": "post",
"id": POST_ID # must be valid UUID
}
Payload:
{
"type": "like",
}
No payload required but has to be authenticated.
- Methods:
- POST: Author shares a Post with POST_ID to Author's friends
Payload:
{
"from": UUID, # UUID of Author that is sharing the post
"share_to": UUID # UUID of Author's friend that will be receiving the post
}