-
Notifications
You must be signed in to change notification settings - Fork 0
API Documentation
The GoodTrees API is organized around REST. Our API has predictable resource oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes and verbs.
API routes are not user-facing and should only be used by developers.
Endpoints for the ForestConnection resource:
-
Create ForestConnection: POST
/api/forestConnections -
Update ForestConnection: PUT/PATCH
/api/forestConnections/ - Stretch: Delete ForestConnection: DELETE
/api/forestConnections/
Mark tree as "climbed" or "want to climb", creates a ForestConnection between logged in user (userId) and tree they chose (treeId).
| Parameter | Type | Description | Notes |
|---|---|---|---|
| userId | int | id of user creating ForestConnection | required, FK points to User.id |
| treeId | int | id of tree in new ForestConnection | required, FK points to Tree.id |
| climbStatus | boolean | true - climbed, false - want to climb | required |
Returns the created ForestConnection object if successful, and returns an error otherwise.
Update a ForestConnection to toggle status of "climbed" or "want to climb" (use "where" to indicate userId and treeId)
| Parameter | Type | Description | Notes |
|---|---|---|---|
| userId | int | id of user creating ForestConnection | required, FK points to User.id |
| treeId | int | id of tree in new ForestConnection | required, FK points to Tree.id |
| climbStatus | boolean | true - climbed, false - want to climb | required |
Returns the updated ForestConnection object if successful, and returns an error otherwise.
Delete a forest connection to remove that tree from users forest (use "where" to indicate userId and treeId)