API Documentation
Goal: Implement API Routes for Profile, Cities, and Insights.
To make a REST API request you may combine a URL with an HTTP method GET
, POST
, PUT
, or DELETE
. Logged in users may only POST
, PUT
, DELETE
owned Profile, Cities, and Insights, which are dynamically rendered AJAX requests. Any verification will be validated with session authentication.
Resources |
---|
1. Profile |
2. Cities |
3. Insights |
4. Tags |
Path | HTTP Verb | Description |
---|---|---|
/api/users |
GET |
request all profile collections |
/api/users/:id |
GET |
request a specific profile |
A logged in user can POST
, PUT
, or DELETE
only follower owned by the same user:
Path | HTTP Verb | Description |
---|---|---|
/api/users/:id |
PUT |
change user bio |
/api/users/:id |
DELETE |
IN PROGRESS |
A logged in user can GET
any Cities available in the database:
Path | HTTP Verb | Description |
---|---|---|
/api/cities |
GET |
request all city collections |
/api/cities/users/:id |
GET |
request all city collections owned by a specific user |
/api/cities/:id |
GET |
request a single city by the id number |
A logged in user can POST
, PUT
, or DELETE
only Cities owned by the same user:
Path | HTTP Verb | Description |
---|---|---|
/api/cities |
POST |
create a new city |
/api/cities/:id |
PUT |
edit the city with the id |
/api/cities/:id |
DELETE |
delete the city with the id |
A logged in user can GET
any insights available in the database:
Path | HTTP Verb | Description |
---|---|---|
/api/insights |
GET |
request all insights |
/api/insights/:id/ |
GET |
request a single insight by id |
/api/insights/cities/:id/ |
GET |
request all insights from a single city based on id |
/api/insights/users/:id/ |
GET |
request all insight collections owned by a specific user |
A logged in user can POST
, PUT
, or DELETE
only insights owned by the same user:
Path | HTTP Verb | Description |
---|---|---|
/api/cities/:id/insights |
POST |
create an insight to a city |
/api/insights/:id |
PUT |
update your insight |
/api/insights/:id |
DELETE |
delete the insight by id |
A logged in user can GET
any tags available in the database:
Path | HTTP Verb | Description |
---|---|---|
/api/tags |
GET |
request all tag collections |
/api/tags/cities/:id |
GET |
request all tags in a city |
/api/tags/users/:id |
GET |
request all tag collections labeled by a specific user |
/api/tags/:id/cities |
GET |
request all cities by a tag id |
A logged in user can POST
, PUT
, or DELETE
only tags owned by the same user:
Path | HTTP Verb | Description |
---|---|---|
/api/tags |
POST |
create a new tag |
/api/cities/:id/tags |
POST |
create a new tag belonging to a city |
/api/tags/:id |
PUT |
edit the tag by the id |
/api/tags/:id |
DELETE |
delete the tag by the id |