Trips
List Trips
GET /api/v1/trips
Get all the trips associated with the authenticated user
Parameters
Header
token string | The user access token |
Response Codes
Status code | Description |
---|---|
200 | OK |
401 | Unauthorized |
Code samples for "Get a user"
curl -L \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/trips
- Example response
- Response schema
status: 200
{
[
{
"uuid": "uyashd-afs981237-asiuf",
"name": "Graduation Trip",
"desc": "Graduation trip to LA and Vegas...",
"img": "http://localhost:3000/api/v1/trip/default/picture"
},
{
"uuid": "a97f-sf98h2kjhas9-198hfoa",
"name": "Graduation Trip",
"desc": "Graduation trip to LA and Vegas...",
"img": "http://localhost:3000/api/v1/trip/uyashd-afs981237-asiuf/picture"
}
]
}
{
[
{
"uuid": "string",
"name": "string",
"desc": "string",
"img": "string"
}
]
}
Get a user's trips
GET /api/v1/trips/:username
Get all the trips associated with a username.
If a authentication token is provided, then more trips will be displayed depending on the privacy settings.
Parameters
Header
token string | The user access token (optional) |
Path
username string | The handle for the Trek user account |
Response Codes
Status code | Description |
---|---|
200 | OK |
404 | Not found |
Code samples for "Get a user's trips"
curl -L \
http://localhost:3000/api/v1/trips/gregork
- Example response
- Response schema
status: 200
{
[
{
"uuid": "skdhjf9-23iuhfsd-0iuas",
"name": "Public Grad Trip",
"desc": "Grad trip for others to reference :)",
"img": "http://localhost:3000/api/v1/trip/skdhjf9-23iuhfsd-0iuas/picture"
}
]
}
{
[
{
"uuid": "string",
"name": "string",
"desc": "string",
"img": "string"
}
]
}
Get a trip
GET /api/v1/trip/:uuid
Get detailed trip information for the trip with the given UUID if the user is authorized.
Parameters
Header
token string | The user access token |
Path
uuid string | The UUID of the trip |
Response Codes
Status code | Description |
---|---|
200 | OK |
401 | Unauthorized |
404 | Not found |
Code samples for "Get a trip"
curl -L \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/trip/alsdkfj-9123jl-asldfkj
- Example response
- Response schema
status: 200
{
"uuid": "alsdkfj-9123jl-asldfkj",
"name": "Graduation trip",
"desc": "Graduation trip to LA and Vegas…",
"dest": ["LA", "Vegas"],
"budget": { "lo": 500, "hi": 2000 },
"expenditures": [
{ "expenditure": "hotel", "cost": 400 },
{ "expenditure": "flight", "cost": 400 }
],
"date": { "start": 1715640000, "end": 1717087200 },
"todo": [
"Stay at X hotel for 3 days",
"Visit Y memorial and check out the gift shop"
],
"img": "http://localhost:3000/api/v1/trip/alsdkfj-9123jl-asldfkj/picture",
"url": "http://localhost:5173/trip/alsdkfj-9123jl-asldfkj",
"owner": "gregork",
"members": ["gregork", "rtholmes", "rxg"],
"private": true
}
{
"uuid": "string",
"name": "string",
"desc": "string",
"dest": "Array<string>",
"budget": "{ lo: number, hi: number }",
"expenditures": "Array<{ expenditure: string, cost: number }>",
"date": "{ start: number, end: number }",
"todo": "Array<string>",
"notes": "string"
"img": "string",
"url": "string",
"owner": "string",
"members": "Array<string>",
"private": "boolean"
}
Get a trip's map
GET /api/v1/trip/:uuid/map
Get a trip's map information for the trip with the given UUID if the user is authorized.
Parameters
Header
token string | The user access token |
Path
uuid string | The UUID of the trip |
Response Codes
Status code | Description |
---|---|
200 | OK |
401 | Unauthorized |
404 | Not found |
Code samples for "Get a trip's map"
curl -L \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/trip/alsdkfj-9123jl-asldfkj/map
measurement | units |
---|---|
distance | kilometers |
time | minutes |
cost | TBD |
- Example response
- Response schema
status: 200
{
"notes": "<h3><p>This is where I go into detail about all the fun we are going to have, etc.</p></h3>",
"locations": [{
"title": "ICICS Building",
"address": "2366 Main Mall, Vancouver, BC V6T 1Z4",
"date": {"start": 1715640000, "end": 1715640000},
"transportation": {
"type": "bus",
"distance": 2,
"time": 5,
"cost": 10,
}
}
]
}
{
"notes": "string",
"locations": [{
"title": "string",
"address": "string",
"date": {"start": "number", "end": "number"},
"transportation": {
"type": "string",
"distance": "number",
"time": "number",
"cost": "number",
}
}
]
}
Get a trip's picture
GET /api/v1/trip/:uuid/picture
Get the picture of the given trip.
The authenticated user must have access permissions to the trip in order to see its picture.
Parameters
Header
token string | The user access token |
Max-Width number | maximum width of the image to return (required?) |
Max-Height number | maximum height of the image to return (required?) |
Path
uuid string | The UUID of the trip |
Response Codes
Status code | Description |
---|---|
200 | OK |
401 | Unauthorized |
403 | Not found |
Code samples for "Get a trip's picture"
curl -L \
-H "Max-Width: 400" \
-H "Max-Height: 400" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/trip/alsdkfj-9123jl-asldfkj/picture
- Responds with the picture with width and height equal or less than what was provided
Create a trip
POST /api/v1/trip
Create a new trip under the authenticated user’s name
Parameters
Header
token string | The user access token |
Body
name string | Required. The name of the trip |
desc string | The description of the trip |
budget { lo: number, hi: number } | The budget of the trip |
date { start: number, end: number } | The date of the trip |
private boolean | Privacy setting of the trip |
Response Codes
Status code | Description |
---|---|
200 | OK |
401 | Not authorized |
Code samples for "Create a trip"
curl -L \
-X POST \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/trip \
-d '{"name": "gregorks Trip", "desc": "tmp grad trip", "private":true}'
- Example response
- Response schema
status: 200
{
"uuid": "aksjfh9320-oaf90-12iuhfiuas",
"name": "gregorks Trip",
"desc": "tmp grad trip",
"dest": [],
"budget": { "lo": 0, "hi": 0 },
"expenditures": [],
"date": { "start": 1715640000, "end": 1715640000 },
"todo": [],
"img": "http://localhost:3000/api/v1/trip/default/picture",
"url": "http://localhost:5173/trip/aksjfh9320-oaf90-12iuhfiuas",
"owner": "gregork",
"members": ["gregork"],
"private": true
}
{
"uuid": "string",
"name": "string",
"desc": "string",
"dest": "Array<string>",
"budget": "{ lo: number, hi: number }",
"expenditures": "Array<{ expenditure: string, cost: number }>",
"date": "{ start: number, end: number }",
"todo": "Array<string>",
"notes": "string"
"img": "string",
"url": "string",
"owner": "string",
"members": "Array<string>",
"private": "boolean"
}
Update a trip
PUT /api/v1/trip/:uuid
Update a trip
Parameters
Header
token string | The user access token |
Path
uuid string | The UUID of the trip |
Body
name string | The new name of the trip |
desc string | The new description of the trip |
dest Array<string> | The new budget of the trip |
budget { lo: number, hi: number } | The new date of the trip |
expenditures Array<{ expenditure: string, cost: number }> | The new expenditures of the trip |
date { start: number, end: number } | The new date of the trip |
todo Array<string> | The new todo items of the trip |
img string | The new image url of the trip |
owner string | The username of the new owner of the trip |
members Array<string> | The updated members of the trip |
private boolean | The new privacy setting of the trip |
Response Codes
Status code | Description |
---|---|
200 | OK |
304 | Not modified |
401 | Unauthorized |
404 | Not found |
Code samples for "Update a trip"
curl -L \
-X PUT \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/trip/aksjfh9320-oaf90-12iuhfiuas \
-d '{"todo": ["visit the Vegas sphere"]}'
- Example response
- Response schema
status: 200
{
"uuid": "aksjfh9320-oaf90-12iuhfiuas",
"name": "gregorks Trip",
"desc": "tmp grad trip",
"dest": [],
"budget": { "lo": 0, "hi": 0 },
"expenditures": [],
"date": { "start": 1715640000, "end": 1715640000 },
"todo": ["visit the Vegas sphere"],
"img": "http://localhost:3000/api/v1/trip/default/picture",
"url": "http://localhost:5173/trip/aksjfh9320-oaf90-12iuhfiuas",
"owner": "gregork",
"members": ["gregork"],
"private": true
}
{
"uuid": "string",
"name": "string",
"desc": "string",
"dest": "Array<string>",
"budget": "{ lo: number, hi: number }",
"expenditures": "Array<{ expenditure: string, cost: number }>",
"date": "{ start: number, end: number }",
"todo": "Array<string>",
"notes": "string"
"img": "string",
"url": "string",
"owner": "string",
"members": "Array<string>",
"private": "boolean"
}
Update a trip's map
PUT /api/v1/trip/:uuid/map
Update a trip's map information
Parameters
Header
token string | The user access token |
Path
uuid string | The UUID of the trip |
Body
notes string | The new notes for the trip's map |
locations | The new locations of the trip |
{
"locations": [{
"title": "string",
"address": "string",
"date": {"start": "number", "end": "number"},
"transportation": {
"type": "string",
"distance": "number",
"time": "number",
"cost": "number",
}
}
]
}
Response Codes
Status code | Description |
---|---|
200 | OK |
304 | Not modified |
401 | Unauthorized |
404 | Not found |
Code samples for "Update a trip's map"
curl -L \
-X PUT \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/trip/aksjfh9320-oaf90-12iuhfiuas \
-d '{"locations": []}'
- Example response
- Response schema
status: 200
{
"notes": "<h3><p>This is where I go into detail about all the fun we are going to have, etc.</p></h3>",
"locations": []
}
{
"notes": "string",
"locations": [{
"title": "string",
"address": "string",
"date": {"start": "number", "end": "number"},
"transportation": {
"type": "string",
"distance": "number",
"time": "number",
"cost": "number",
}
}
]
}
Delete a trip
DELETE /api/v1/trip/:uuid
Delete a trip Protect against cross-site forgery? (Auth0)
Parameters
Header
token string | The user access token |
Path
uuid string | The UUID for the trip |
Response Codes
Status code | Description |
---|---|
204 | No Content |
401 | Unauthorized |
404 | Not found |
Code samples for "Delete a trip"
curl -L \
-X DELETE
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/trip/askdjh-eqfhu9823-iquwef
- No response body