You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If user is logged in, returns an array of all plants (theirs and those of other users)
GET
/api/plants/:id
If user is logged in, returns the plant with the specified ID
POST
/api/plants
Adds a plant to currently logged in user
PUT
/api/plants/:id
Edits plant with specified ID
DELETE
/api/plants/:id
Deletes plant with specified ID
Overall Shape of Plant (JSON):
{
"nickname": "Rose",
"species": "Rosidopidus", <-- NOT A REQUIRED FIELD
"h2o_frequency": "Once Daily",
"user_id": 1 <-- AUTOMATICALLY GIVEN TO PLANT BASED ON THE CURRENTLY LOGGED IN USER, SO NO NEED TO ADD THIS AS AN INPUT OF ANY KIND
}
After performing a put request upon a user editing their information (username, password) an object with their id, username and is returned:
{
"id": 1,
"username": "hellerworld"
}
/api/users/:id: DELETE
{
"message": "User has been successfully removed"
}
Server responds with the full plant object:
{
"id": 5,
"nickname": "MisterPlantigus",
"species": "MysteriousPlantious",
"h2o_frequency": "Thrice Weekly",
"user_id": 37
}
/api/plants/:id: PUT
After performing a put request upon a user editing a plant's info (nickname, species or h2o_frequency) an object with the edited plant's id, nickname, species, h2o_frequency and user_id is returned:
{
"id": 5,
"nickname": "MisterPlantigusEdited",
"species": "MysteriousPlantious",
"h2o_frequency": "Thrice Weekly",
"user_id": 37
}
/api/plants/:id: DELETE
{
"message": "Plant has been successfully removed"
}
About
Backend for Water my Plants. Frontend Repo found at link