Open endpoints require no Authentication.
Used to create a new user.
URL : '/api/auth/register' Method : [POST]
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| username | String | Yes | Must be unique |
| password | String | Yes | |
| String | Yes | ||
| age_verified | Boolean | Yes | defaults to false |
| reason_for_use | String | Yes | |
| medical_condition | String | Yes | |
| desired_effect | String | Yes |
Example
{
username: "Banana",
password: "testing",
email: "mail@testmail.com",
age_verified: true,
reason_for_use: "medicinal",
medical_condition: "anxiety",
desired_effect: "relaxed"
}Response
- If a user is successfully registered, the endpoint will return an HTTP response with status code 201, and the registered user object
- If registration information is invalid or incomplete, the endpoint will return an HTTP response with a status code of 400.
- If there is a server or database error, the endpoint will return an HTTP response with a status code of 500.
Used to log in and authenticate user.
URL : '/api/auth/login' Method : [POST]
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| username | String | Yes | Must match username in database. |
| password | String | Yes | Must match password corresponding to username in database. |
Example
{
username: "Banana",
password: "testing"
}Response
- If you successfully log in, the endpoint will return an HTTP response with a status code of 200, a welcome message and a JWT for the logged in user.
- If you provide invalid credentials, the endpoint will return an HTTP response with a status code of 401.
- If there is a server or database error, the endpoint will return an HTTP response with a status code of 500.
Endpoints requre authentication for logged in users.
###Get Recommendations
Used to get a list of recommended strains.
URL : '/api/recommendations/' Method : [GET]
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Content-type | String | Yes | Must be application/JSON |
| Authorization | String | Yes | JSON web token |
Response
- If recommendations are found, the endpoint will return an HTTP response with a status code of 200.
- If recommendations are not found, the endpoint will return an HTTP response with a status code of 404.
- If there is a server or database error, the endpoint will return an HTTP response with a status code of 500.
URL : '/api/recommendations/:id' Method : [GET]
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Content-type | String | Yes | Must be application/JSON |
| Authorization | String | Yes | JSON web token |
Response
- If recommendation with specified ID is found, the endpoint will return an HTTP response with a status code of 200.
- If recommendation with specified ID is not found, the endpoint will return an HTTP response with a status code of 404.
- If there is a server or database error, the endpoint will return an HTTP response with a status code of 500.
Creates a new recommendation.
URL : '/api/recommendations/add' Method : [POST]
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Content-type | String | Yes | Must be application/JSON |
| Authorization | String | Yes | JSON web token |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| Name | String | Yes | |
| Description | String | No | |
| Tags | String | No | |
| User ID | Integer | Yes | Links to Users table |
Example
{
name: "Harlequin",
description: "4-7% THC, 8-16% CBD",
tags: "pain, stress, depression, inflamation and headache",
user_id: 7
}Response
- If recommendation is successfully created, the endpoint will return an HTTP response with a status code of 201.
- If recommendation data is invalid, the endpoint will return an HTTP response with a status code of 400.
- If there is a server or database error, the endpoint will return an HTTP response with a status code of 500.
Makes changes to an existing recommendation.
URL : '/api/recommendations/:id' Method : [PUT]
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Content-type | String | Yes | Must be application/JSON |
| Authorization | String | Yes | JSON web token |
Request Body
| Name | Type | Required | Description |
|---|---|---|---|
| Name | String | Yes | |
| Description | String | No | |
| Tags | String | No | |
| User ID | Integer | Yes | Links to Users table |
Example
{
name: "Harlequin",
description: "4-7% THC, 8-16% CBD",
tags: "pain, stress, depression, inflamation and headache",
user_id: 7
}Response
- If recommendation is successfully updated, the endpoint will return an HTTP response with a status code of 200.
- If recommendation with specified ID is not found and updated, the endpoint will return an HTTP response with a status code of 404.
- If user does not have access, the endpoint will return an HTTP response with status code of 401.
- If there is a server or database error, the endpoint will return an HTTP response with a status code of 500.
Makes changes to an existing recommendation.
URL : '/api/recommendations/:id' Method : [DELETE]
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Content-type | String | Yes | Must be application/JSON |
| Authorization | String | Yes | JSON web token |
Response
- If recommendation is found and deleted, the endpoint will return an HTTP response with a status code of 200.
- If recommendation with specified ID is not found and deleted, the endpoint will return an HTTP response with a status code of 404.
- If user does not have access, the endpoint will return an HTTP response with status code of 401.
- If there is a server or database error, the endpoint will return an HTTP response with a status code of 500.