[Endpoints] Base URL: https://ttwebft20-use-my-tech-stuff.herokuapp.com/api
- This url will be the beginning of all endpoints. Add the following endpoints below to the base URL.
-
No token is required when registering
-
Example: https://ttwebft20-use-my-tech-stuff.herokuapp.com/api/auth/register
-
[POST] [Register] - Register a new user
- Endpoint: /auth/register
Fields:
"username" - string, unique (MUST not match any other registered username), REQUIRED
"first_name" - string, REQUIRED
"last_name" - string, REQUIRED
"email" - string, unique (MUST not match any other registered email), REQUIRED
"zipcode" - string, REQUIRED
"password" - string, REQUIRED
"role" - string, MUST be "owner" or "renter", REQUIREDSERVER PUTS IN THE FIELDS BELOW AUTOMATICALLY "created_at" - timestamp, no need on client-end
"updated_at" - timestamp, no need on client-end
-
-
Token required for login
-
Example: https://ttwebft20-use-my-tech-stuff.herokuapp.com/api/auth/login
-
[POST] [Login] - Login an already registered user to receive a token
- Endpoint: /auth/login
Fields:
"username" - string, MUST match a registered username, REQUIRED
"password" - string, MUST match a registered password with registered username, REQUIRED
-
-
Token required for seeing users
-
[GET] [FindAllUsers] - Finds all users (owners and renters)
- Endpoint: /users
- Example: https://ttwebft20-use-my-tech-stuff.herokuapp.com/api/users
-
[GET] [FindUserById] - Find a registered user by assigned user ID
- Endpoint: /users/:id
- Example: https://ttwebft20-use-my-tech-stuff.herokuapp.com/api/users/1
-
-
Token required to view tech items
-
[GET] [FindAllTechItems] - Find all tech items
- Endpoint: /tech_items
- Example: https://ttwebft20-use-my-tech-stuff.herokuapp.com/api/tech_items
-
[GET] [FindTechItemById] - Find tech item by assigned ID
- Endpoint: /tech_items/:id
- Example: https://ttwebft20-use-my-tech-stuff.herokuapp.com/api/tech_items/1
-
-
Token required to add tech items
-
Example: https://ttwebft20-use-my-tech-stuff.herokuapp.com/api/tech_items
-
[POST] [AddNewTechItem] - Add a new tech item
- Endpoint: /tech_items
Fields:
"img_url" - binary, up to 2000 characters
"item_name" - string, up to 50 characters, REQUIRED
"category" - string, REQUIRED
"description" - text, up to 500 characters, REQUIRED
"rented" - boolean, determines if available or rented, not required
"price" - integer, REQUIRED
"owner_username" - string, REQUIREDSERVER PUTS IN THE FIELDS BELOW AUTOMATICALLY "created_at" - timestamp, no need on client-end
"updated_at" - timestamp, no need on client-end
-
-
Token required to update tech item by ID
-
Example: https://ttwebft20-use-my-tech-stuff.herokuapp.com/api/tech_items/1
-
[PUT] [UpdateTechItem] - Edit a registered tech item
- Endpoint: /tech_items/:id
Fields:
"img_url" - binary, up to 2000 characters
"item_name" - string, up to 50 characters, REQUIRED
"category" - string, REQUIRED
"description" - text, up to 500 characters, REQUIRED
"rented" - boolean, determines if available or rented, not required
"price" - integer, REQUIRED
"owner_username" - string, REQUIREDSERVER PUTS IN THE FIELDS BELOW AUTOMATICALLY "created_at" - timestamp, no need on client-end
"updated_at" - timestamp, no need on client-end
-
-
Token required to remove tech item by ID
-
Example: https://ttwebft20-use-my-tech-stuff.herokuapp.com/api/tech_items/1
- [DELETE] [DeleteTechItem] - Delete a registered tech item
- Endpoint: /tech_items/:id
- [DELETE] [DeleteTechItem] - Delete a registered tech item