Skip to content

API Documentation

Ykk2 edited this page Dec 7, 2022 · 37 revisions

USER

Get current User

  • Require Authentication:

  • Request

    • Method: GET

    • URL:

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Log in a User

  • Require Authentication:

  • Request

    • Method: POST

    • URL:

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Sign in a User

  • Require Authentication:

  • Request

    • Method: POST

    • URL:

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Update user

  • Require Authentication:

  • Request

    • Method: PUT

    • URL:

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Delete user

  • Require Authentication:

  • Request

    • Method: DELETE

    • URL:

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

STORY

Get all stories

  • Require Authentication:

  • Request

    • Method: GET
    • URL: /api/stories/all
    • Headers:
      • Content-Type: application/json
  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

{ "Stories": [ { "Story" : { "UserId" : 1, "Story": "Story Body Goes Here", "Tag": "Education", "Title": "Story Title goes here", "Image": "url", "createdAt": "mm/dd/yyyy", }, "User": { "userId": 1, "firstName": "John", "lastName": "Doe", "profileImage": "url" } } ] }

```

Get all stories by current user

  • Require Authentication:

  • Request

    • Method: GET

    • URL: /api/stories/:username

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Get all stories by authors the user is following

  • Require Authentication:

  • Request

    • Method: GET

    • URL: /api/stories/:userId/following

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Get all stories by tag

  • Require Authentication:

  • Request

    • Method: GET

    • URL: /api/stories/:tag

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Get story by id

  • Require Authentication:

  • Request

    • Method: GET

    • URL: /api/stories/:storyId

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Get top 6 stories by number of claps

  • Require Authentication:

  • Request

    • Method: GET

    • URL: /api/stories/trending

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Create a new story

  • Require Authentication:

  • Request

    • Method: POST

    • URL: /api/stories/new

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Update story by story id

  • Require Authentication:

  • Request

    • Method: PUT

    • URL: /api/stories/:storyId

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Delete story

  • Require Authentication:

  • Request

    • Method: DELETE

    • URL: /api/stories/:storyId

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

RESPONSES

Get all responses by story id

  • Require Authentication:

  • Request

    • Method: GET

    • URL: /api/responses/:storyId

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Get all responses by user id

  • Require Authentication:

  • Request

    • Method: GET

    • URL: /api/responses/:userId

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Create a response by story id

  • Require Authentication:

  • Request

    • Method: POST

    • URL: /api/responses/:storyId

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Update a response by response id

  • Require Authentication:

  • Request

    • Method: PUT

    • URL: /api/responses/:responseId

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Delete response

  • Require Authentication:

  • Request

    • Method: DELETE

    • URL: /api/responses/:storyId

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Follows

Add new follows by user id

  • Require Authentication:

  • Request

    • Method: POST

    • URL: /api/:userId/following

    • Headers:

      • Content-Type: application/json
    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Update follows by user id

  • Require Authentication:

  • Request

    • Method: PUT

    • URL: /api/:userId/following

    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Claps

Add claps by story id and user id

  • Require Authentication:

  • Request

    • Method: POST

    • URL: /api/claps/:storyId

    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Add claps by response id and user id

  • Require Authentication:

  • Request

    • Method: POST

    • URL: /api/claps/:responseId

    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Delete claps by story id and user id

  • Require Authentication:

  • Request

    • Method: PUT

    • URL: /api/claps/:storyId

    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Delete claps by response id and user id

  • Require Authentication:

  • Request

    • Method: PUT

    • URL: /api/claps/:userId

    • Body:

  • Successful Response

    • Status Code:

    • Headers:

      • Content-Type: application/json
    • Body:

Clone this wiki locally