Thursday 11 January 2018

All about Stackle API endpoints

For someone who is new and don't know what Stackle is, here's a small introduction.
Stackle is a web communication portal aimed at providing Open Source organizations a platform to have discussions on their GitHub projects and their issues. It provides GitHub integration which allows the administrator of an organization to create a forum thread for the particular organization. Users signing in are able to view forums of the organizations they contribute to and engage in the forum discussions. (This description is taken from the original repo on github, here is the link)


The above image is the home page of Stackle, and the following images are the profile and dashboard pages.



Right now Stackle supports 14 APIs. Let me describe about each API.

1. /api/posts

GET - The above API is the GET method, which makes a REST call to get all the posts made under an organization. 

2. /api/user/post

POST - The above API makes a POST call to the given endpoint to send a post to the feed under the organization. Since it's a POST call, one should specify the body( the input which you want to post) to make a successful post in the feed.

We have to even mention the content type based on how we are going to pass the body, it can be a JSON or raw data. Following is a sample body.

title : "This is the title"
description : "Description about the post" "
org_name : "Orgname"
tags : [],
repository : "URL to the repository"
link_issue : "URL to the Issue"
user : "your user id",
date : "data to show when posted"
votes : 0,
comments : []

3. /api/post/:postid

GET - The above API makes a GET call to the above endpoint, where the query param will the post id, according to which the response will be the post feed of the given id.

DELETE -  We can hit the same endpoint with delete method, to delete a given post based on the ID

4. /api/posts/:userId

GET - The above endpoint gets posts by a particular user. The response will be a simple filter of posts made by a particular user. Here the query param will be the user id.

5. /api/posts/org/:orgname

GET - The above endpoint get posts related to specific organization by org name, here the query param is the organization name (not ID) 

6. /api/org/:orgname

GET - The above endpoint get details of a specific org, these details mainly represent the github organization details,  here the query param is the organization name (not ID) 

7. /api/comment/:postId

POST - This API endpoint posts a comment on a post, the query param is supposed to be a post ID and also the body is supposed to be the comment content. 

8. /api/orgs

GET - This API endpoint gets all the stacks/ organizations registered with the Stackle app.

9. /api/stack/create

POST - The above API endpoint creates a organization or Stack, mostly this requires some admin privileges. Following will be the body, obviously the header should contain the content type (if raw or json) 

name - Org_name
description - Small description about the organization
stackleUrl - Stackle URL (this will be generated by the app)
githubUrl - Github URL
created_user - userId

10. /api/delete/stack/:stackid

DELETE - The above api endpoint deletes the given organization. the query param will the stack id or organization id

11. /api/subscribe

POST - The above api endpoint helps in subscribing to an organization or stack for notifications. following is the body type, keys.

uid - userId
stack_name - Stack name

12 . /api/stack/subscribed/:userid

GET - this endpoint gets the subscribed stack of a user. 

13. /api/newuser


POST - Creates a user
  





No comments:

Post a Comment