Live Backend URL: https://backend-art.herokuapp.com/
method url: /api/register
http method: [POST]
| name | type | required | description |
|---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
| name | type | required | description |
|---|---|---|---|
username |
String | Yes | Must be unique |
fullName |
String | Yes | |
password |
String | Yes | |
email |
String | No | |
userImgUrl |
String | No |
{
"username": "brooks",
"password": "1234",
"fullName": "Brooks Poltl",
"email": "[email protected]",
"userImgUrl": "something.jpg"
}
{
"id": 1
"username": "brooks",
"password": "1234",
"fullName": "Brooks Poltl",
"email": "[email protected]",
"userImgUrl": "something.jpg"
}
{
"errorMessage": "missing ${itemMissing}"
}
method url: /api/login
http method: [POST]
| name | type | required | description |
|---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
| name | type | required | description |
|---|---|---|---|
username |
String | Yes | must be registered user |
password |
String | Yes |
{
"username": "brooks",
"password": "1234",
}
no issues logging in
{
"id":3,
"username":"brooks",
"fullName":"Brooks Poltl",
"email":null,
"userImgUrl":null,
"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2Vybmk"
}
{
errorMessage: 'missing ${itemMissing}'
}
{
errorMessage: "passwords don't match"
}
method url: /api/users
http method: [GET]
[
{
"id": 1,
"username": "brooks3",
"password": "$2a$12$UzYfINUnqfZh2n180pBswORvPCIrwHKp3d/MEZ69DaRxoLTYj26UG",
"fullName": "Brooks Poltl",
"email": null,
"userImgUrl": null
},
{
"id": 2,
"username": "Bob",
"password": "$2a$12$5.flIIREO8kVSwAGdL2iWO1IUKaaN7VgKN9zEX/Z7XXygBupMSQ0W",
"fullName": "McBobbers",
"email": "[email protected]",
"userImgUrl": ""
},
{
"id": 3,
"username": "spencer",
"password": "$2a$12$5F3zLBEigPgcTQxzQFT23.hW3A15PDyelLAFU.ENtym5Jdn17ypjW",
"fullName": "Spencer Curtis",
"email": null,
"userImgUrl": null
},
]
method url: /api/users/:id
http method: [GET]
[
{
"id": 1,
"username": "brooks3",
"password": "$2a$12$UzYfINUnqfZh2n180pBswORvPCIrwHKp3d/MEZ69DaRxoLTYj26UG",
"fullName": "Brooks Poltl",
"email": null,
"userImgUrl": null
}
]
method url: /api/users/posts/:id (id meaning id of the user)
http method: [GET]
[
{
"id": 6,
"username": "brooks12345",
"password": "$2a$12$xEMuC6KExFMmz95p6jIAoe4CYT1oDPGBPHpxjR4FjIMmUGO09iR.m",
"fullName": "hasdjhkha",
"email": null,
"userImgUrl": null,
"posts": [
{
"id": 11,
"imageUrl": "insertedImgurl",
"upvotes": 0,
"userId": 6,
"description": "a painting :)",
"postName": "mona lisa"
},
{
"id": 12,
"imageUrl": "insertedImgurl",
"upvotes": 0,
"userId": 6,
"description": "a painting :)"
"postName": "mona lisa"
},
{
"id": 13,
"imageUrl": "insertedImgurl",
"upvotes": 0,
"userId": 6,
"description": "a painting :)",
"postName": "mona lisa"
},
{
"id": 14,
"imageUrl": "insertedImgurl",
"upvotes": 0,
"userId": 6,
"description": "a painting :)",
"postName": "starry night"
}
]
}
]
method url: /api/users/:id
http method: [PUT]
| name | type | required | description |
|---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
authorization |
String | Yes | token to Authorize user |
| name | type | required | description |
|---|---|---|---|
username |
String | No | Must be unique |
fullName |
String | No | |
password |
String | No | |
email |
String | No | |
userImgUrl |
String | No |
{
"username": "brookspoltl",
"password": "hunter2",
"fullName": "Brooks Poltl",
}
{
"message":"your account has been edited"
}
{
"errorMessage": "you are not authorized to edit this account"
}
{
"message": "invalid token"
}
method url: /api/users/:id
http method: [DELETE]
| name | type | required | description |
|---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
authorization |
String | Yes | token to Authorize user |
{
"message":"your account has been deleted"
}
{
"errorMessage": "you are not authorized to delete this account"
}
{
"message": "invalid token"
}
method url: /api/posts
http method: [POST]
| name | type | required | description |
|---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
authorization |
String | Yes | token to Authorize user |
| name | type | required | description |
|---|---|---|---|
postName |
String | Yes | |
imageUrl |
String | Yes | |
description |
String | No |
{
"postName": "Mona Lisa",
"imageUrl": "monaLisa.jpg",
"description": "cool painting i made",
}
{
"id": 1,
"postName": "Mona Lisa",
"imageUrl": "monaLisa.jpg",
"description": "cool painting i made",
"upvotes": 0,
"userId": 3
}
{
"message": "no token"
}
{
"message": "invalid token"
}
method url: /api/posts
http method: [GET]
[
{
"id": 12,
"imageUrl": "insertedImgurl",
"upvotes": 0,
"userId": 6,
"description": "a painting :)",
"postName": "mona lisa"
},
{
"id": 13,
"imageUrl": "insertedImgurl",
"upvotes": 0,
"userId": 6,
"description": "a painting :)",
"postName": "mona lisa"
},
{
"id": 14,
"imageUrl": "insertedImgurl",
"upvotes": 0,
"userId": 6,
"description": "a painting :)",
"postName": "starry night"
}
]
method url: /api/posts/:id (as in id of the post)
http method: [GET]
{
"id": 14,
"imageUrl": "insertedImgurl",
"upvotes": 0,
"userId": 6,
"description": "a painting :)",
"postName": "starry night"
}
method url: /api/posts/users/:id (id meaning id of the user)
http method: [GET]
[
{
"id": 11,
"imageUrl": "insertedImgurl",
"upvotes": 0,
"userId": 6,
"description": "a painting :)",
"postName": "mona lisa"
},
{
"id": 12,
"imageUrl": "insertedImgurl",
"upvotes": 0,
"userId": 6,
"description": "a painting :)",
"postName": "mona lisa"
},
{
"id": 13,
"imageUrl": "insertedImgurl",
"upvotes": 0,
"userId": 6,
"description": "a painting :)",
"postName": "mona lisa"
},
{
"id": 14,
"imageUrl": "insertedImgurl",
"upvotes": 0,
"userId": 6,
"description": "a painting :)",
"postName": "starry night"
}
]
method url: /api/posts/upvote/:id (id of the post)
http method: [PUT]
{
"upvotes": 6
}
method url: /api/posts/:id
http method: [PUT]
| name | type | required | description |
|---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
authorization |
String | Yes | token to Authorize user |
| name | type | required | description |
|---|---|---|---|
postName |
String | No | |
imageUrl |
String | No | |
description |
String | No |
{
"postName": "my masterpiece",
"imageUrl": "hunter2.jpg",
}
{
"message":"your post has been edited"
}
{
"errorMessage": "not authorized to edit this post"
}
{
"message": "invalid token"
}
method url: /api/posts/:id (id of the post)
http method: [DELETE]
| name | type | required | description |
|---|---|---|---|
Content-Type |
String | Yes | Must be application/json |
authorization |
String | Yes | token to Authorize user |
{
"message":"post successfully deleted"
}
{
"errorMessage": "you are not authorized to delete this post"
}
{
"message": "invalid token"
}