Skip to content

RESTful API

annypanny edited this page Nov 29, 2016 · 78 revisions

http://www.django-rest-framework.org/topics/documenting-your-api/


socialnets404.herokuapp.com/

  • The heroku host our project in cloud.
  • use the RESTful API url followed by this link to do all the web services.

restful API documentation

Posts

  1. list of all posts public on the server (/posts)
  2. list of an single user's post public to you (/author/[author_id]/posts)
  3. list of an single post (/posts/[post_id])
  4. create a post (/posts/create)
  5. Edit a post (/posts/[post_id]/update)
  6. delete a post (/posts/[post_id]/destroy)
  7. list of all posts that are visible to the currently authenticated user (/author/posts)

Comments

  1. access to the comments in a post and could also create comment (/posts/[post_id]/comments)
  2. delete a comment (/comments/[comment_id]/destroy)
  3. info of a comment (/comments/[commnet_id])

Friends

  1. list of all friend for you with detail info (/author/[author_id]/network)
  2. list of friend requests of yours (/author/friends/friend_requests)
  3. [a single friend's all post (/author/[author_id]/posts)] (https://github.com/CMPUT404F16T06/CMPUT404Project/wiki/RESTful-API-F3)
  4. to unfriend (/author/friends/unfriend/[author_id])
  5. send local friend request (/author/friend_request/[author_id])
  6. accept friend request (/author/friend_request/accept/[author_id])
  7. reject friend request (/author/friend_request/reject/[author_id])
  8. a reponse if friends or not (/friends/[author_id])
  9. check if 2 authors are friends (/friends/[author_id1]/[author_id2])
  10. send and receive remote friend request to other nodes (/friendrequest)

Authors

  1. [list of authors (/author)] (https://github.com/CMPUT404F16T06/CMPUT404Project/wiki/RESTful-API-A1)
  2. get author info (/author/[author_id])
  3. create an author (/author/create)
  4. update author info (/author/[author_id]/update)

node

  1. [list of nodes (/nodes)] (https://github.com/CMPUT404F16T06/CMPUT404Project/wiki/RESTful-API-N1)
  2. [create a node (/nodes/create)] (https://github.com/CMPUT404F16T06/CMPUT404Project/wiki/RESTful-API-N2)
  3. [delete a node (/nodes/destroy/[node_id])] (https://github.com/CMPUT404F16T06/CMPUT404Project/wiki/RESTful-API-N3)

Authentication

Django admin page


###Joshua's example for doc:

/posts/<post_id>

used to get the contents of post <post_id> is the id number of the post, and it's required. It returns a JSON. The JSON has x,y,z

Here's an example.

GET /posts/18 HTTP/1.1 Header: Value

200 OK...

JSON

Clone this wiki locally