Field | Type | Notes |
---|---|---|
id | integer | primary key and autoincrements |
string | required and unique | |
password | string | required |
username | string | required |
role | string | required |
Field | Type | Notes |
---|---|---|
id | integer | primary key and autoincrements |
name | string | required; name of the strain |
image_URL | string | product image |
type | text | type of strain: Indica, Sativa, Hybrid |
description | text | required; description of the cannabis strains, background, etc. |
taste | text | flavor of the product |
effects | text | different effects obtained |
rating | string | rating from 1 to 5 stars |
BASE URL: https://mc-7-be.herokuapp.com
test account:
{
"email": "tester@email.com",
"password": "test",
"username": "test123",
"role": "patient"
}
Type | Path | Notes | Example |
---|---|---|---|
POST | /api/auth/register |
register a new user | link |
POST | /api/auth/login |
login an user | link |
GET | /api/user/:user_id |
get user info; requires authorization | link |
PUT | /api/user/:user_id |
update user info; requires authorization | link |
DELETE | /api/user/:user_id |
delete a user account; requires authorization | link |
GET | /api/strains |
get strains | link |
POST | /api/strains |
create a new product post; requires name and description |
link |
GET | /api/strains/:strain_id |
get a strain | link |
PUT | /api/strains/:strain_id |
update a strain; change liked key to like or unlike a submitted product; requires authorization; |
link |
DELETE | /api/strains/:strain_id |
delete a product; requires authorization; | link |
request data:
{
"email": "username@email.com",
"password": "password",
"username": "Name",
"role": "provider"
}
response data:
{
"user": {
"id": 1,
"email": "username@email.com",
"username": "Name"
},
"authorization": "really.long.token"
}
request data:
{
"username": "test123",
"password": "test"
}
response data:
{
"user": {
"id": 1,
"email": "username@email.com",
"username": "Name"
},
"authorization": "really.long.token"
}
response data
{
"id": 1,
"email": "username@email.com",
"username": "Name",
"role": "provider"
}
request data
{
"email": "username@email.com",
"username": "Name"
}
response data
{
"id": 1,
"email": "username@email.com",
"username": "Name"
}
response data
no content
response data
{
"id": 1,
"name": "Name of strain",
"image_URL": "image.com",
"type": "Type of strain",
"description": "About the product text",
"taste": "Taste of smoke",
"effects": "Different effects obtained",
"rating": 1
}
request data
{
"name": "Name of strain",
"image_URL": "image.com",
"type": "Type of strain",
"description": "About the strain text",
"taste": "Taste of smoke",
"effects": "Different effects obtained",
"rating": 1
}
response data
{
"id": 1,
"name": "Name of strain",
"image_URL": "image.com",
"type": "Type of strain",
"description": "About the strain text",
"taste": "Taste of smoke",
"effects": "Different effects obtained",
"rating": 1
}
response data
no content
response data
[
{
"id": 1,
"name": "Name of strain",
"image_URL": "image.com",
"type": "Type of strain",
"description": "About the strain text",
"taste": "Taste of smoke",
"effects": "Different effects obtained",
"rating": 1
},
{
"id": 2,
"name": "Name of strain",
"image_URL": "image.com",
"type": "Type of strain",
"description": "About the strain text",
"taste": "Taste of banana",
"effects": "Different effects obtained",
"rating": 2
}
]
request data
{
"name": "Name of strain",
"image_URL": "image.com",
"type": "Type of strain",
"description": "About the strain text",
"taste": "Taste of smoke",
"effects": "Different effects obtained",
"rating": 3
}
response data
{
"id": 1,
"name": "Name",
"image_URL": "image.com",
"type": "Type of strain",
"description": "About the strain text",
"taste": "Taste of smoke",
"effects": "Different effects obtained",
"rating": 1
}
response data
{
"id": 1,
"name": "Name",
"image_URL": "image.com",
"type": "Type of strain",
"description": "About the strain text",
"taste": "Taste of smoke",
"effects": "Different effects obtained",
"rating": 1
}