-
Notifications
You must be signed in to change notification settings - Fork 1
API Documentation
David L edited this page Dec 19, 2022
·
37 revisions
-
Require Authentication: True
-
Request
- Method: GET
- URL:
- Headers: *Content-Type: application/json
- Body: None
-
Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"id": 1,
"firstName": "John",
"lastName": "Smith",
"profileImage": "profilepic.url",
"bio": "about me"
}
-
Require Authentication: True
-
Request
- Method: PUT
- URL:
- Headers: *Content-Type: application/json
- Body: None
-
Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"id": 1,
"firstName": "John",
"lastName": "Smith",
"profileImage": "profilepic.url",
"bio": "about me"
}
-
Require Authentication: True
-
Request
- Method: DELETE
- URL:
- Headers: *Content-Type: application/json
- Body: None
-
Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"message" : "Successfully Deleted",
"statusCode" : 200
}
-
Require Authentication: False
-
Request
- Method: GET
- URL: /api/stories
- 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",
"updatedAt": "mm/dd/yyyy"
},
"User": {
"id": 1,
"firstName": "John",
"lastName": "Doe"
}
}
]
}
-
Require Authentication: True
-
Request
- Method: GET
- URL: /api/stories/:userId
- Headers: *Content-Type: application/json
- Method: GET
-
Body: None
-
Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"User": {
"id": 1,
"firstName": "John",
"lastName": "Doe",
"stories": [{
"id": 2
"story": "Story Body Goes Here",
"tag": "Education",
"title": "Story Title goes here",
"image": "url",
"createdAt": "mm/dd/yyyy",
"updatedAt": "mm/dd/yyyy"
}]
}
}
-
Require Authentication: True
-
Request
- Method: GET
- URL: /api/stories/:userId/following
- Headers:
- Content-Type: application/json
-
Body: None
-
Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"Stories": [
{
"Story": {
"UserId": 2,
"Story": "Story Body Goes Here",
"Tag": "Education",
"Title": "Story Title goes here",
"Image": "url",
"createdAt": "mm/dd/yyyy",
"updatedAt": "mm/dd/yyyy"
},
"User": {
"id": 1,
"firstName": "John",
"lastName": "Doe"
}
}
]
}
-
Require Authentication: False
-
Request
- Method: GET
- URL: /api/stories/:tag
- Headers:
- Content-Type: application/json
-
Body: None
-
Successful Response
- Status Code: 200
- 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",
"updatedAt": "mm/dd/yyyy"
},
"User": {
"id": 1,
"firstName": "John",
"lastName": "Doe"
}
}
]
}
-
Require Authentication: False
-
Request
- Method: GET
- URL: /api/stories/:storyId
- Headers:
- Content-Type: application/json
-
Body: None
-
Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"Story": {
"UserId": 1,
"Story": "Story Body Goes Here",
"Tag": "Education",
"Title": "Story Title goes here",
"Image": "url",
"createdAt": "mm/dd/yyyy",
"updatedAt": "mm/dd/yyyy"
},
"Responses": {
"totalResponses": 10
},
"Claps": {
"totalClaps": 10
},
"User": {
"id": 1,
"firstName": "John",
"lastName": "Doe"
}
}
- Require Authentication: True
- Request
- Method: POST
- URL: /api/stories/new
- Headers:
- Content-Type: application/json
- Body:
{
"title": "title",
"story": "story",
"image" : "url",
"tag" : "tag"
}
- Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"id" : 1,
"userId": 1,
"title": "title",
"story": "story",
"image" : "url",
"createdAt" : "mm/dd/yyyy"
"updatedAt": "mm/dd/yyyy"
}
- Require Authentication: True
- Request
- Method: PUT
- URL: /api/stories/:storyId
- Headers:
- Content-Type: application/json
- Body:
{
"title": "title",
"story": "story",
"image" : "url",
"tag" : "tag"
}
- Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"id" : 1,
"userId": 1,
"title": "title",
"story": "story",
"image" : "url",
"createdAt" : "mm/dd/yyyy"
"updatedAt": "mm/dd/yyyy"
}
-
Require Authentication: True
-
Request
- Method: DELETE
- URL: /api/stories/:storyId
- Headers:
- Content-Type: application/json
- Body: None
-
Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"message": "Successfully Deleted",
"statusCode" : 200
}
- Require Authentication: True
- Request
- Method: POST
- URL: /api/responses/:storyId
- Headers:
- Content-Type: application/json
- Body:
{
"body" : "body"
}
- Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"id": 1,
"body": "body",
"userId" : "userId",
"storyId" : "storyId",
"createdAt" : "mm/dd/yyyy",
"updatedAt" : "mm/dd/yyyy"
}
- Require Authentication: True
- Request
- Method: PUT
- URL: /api/responses/:responseId
- Headers:
- Content-Type: application/json
- Body:
{
"body": "body",
}
- Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"id": 1,
"body": "body",
"userId" : "userId",
"storyId" : "storyId",
"createdAt" : "mm/dd/yyyy",
"updatedAt" : "mm/dd/yyyy"
}
-
Require Authentication: 200
-
Request
- Method: DELETE
- URL: /api/responses/:responseId
- Headers:
- Content-Type: application/json
- Body: None
-
Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"messsage" : "Successfully deleted",
"statusCode" : 200
}
- Require Authentication: True
- Request
- Method: POST
- URL: /api/:userId/following
- Headers:
- Content-Type: application/json
- Body:
{
"followedId" : 10
}
- Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"message": "Successfully followed",
"statusCode": 200
}
- Require Authentication: True
- Request
- Method: DELETE
- URL: /api/:userId/following
- Body:
{
"followedId" : 10
}
- Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"message" : "User unfollowed",
"statusCode": 200
}
-
Require Authentication: True
-
Request
- Method: POST
- URL: /api/:storyId/claps
- Body: none
-
Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"message" : "Successful Clap",
"statusCode" : 200
}
- Require Authentication: True
- Request
- Method: POST
- URL: /api/claps/:responseId
- Body:
{
"userId" : 2,
"responseId" : 1
}
- Successful Response
- Status Code: 200
- Headers:
- Content-Type: application/json
- Body:
{
"id": 10,
"responseId" : 1,
"userId" : 2,
"createdAt" : "mm/dd/yyyy",
"updatedAt" : "mm/dd/yyyy"
}