Skip to main content

Trips

List Trips

GET /api/v1/trips

Get all the trips associated with the authenticated user

Parameters

token stringThe user access token

Response Codes

Status codeDescription
200OK
401Unauthorized

Code samples for "Get a user"

GET /api/v1/trips
curl -L \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/trips

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"
}
]
}

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 stringThe user access token (optional)

Path

username stringThe handle for the Trek user account

Response Codes

Status codeDescription
200OK
404Not found

Code samples for "Get a user's trips"

GET /api/v1/trips/:username
curl -L \
http://localhost:3000/api/v1/trips/gregork

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"
}
]
}

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 stringThe user access token

Path

uuid stringThe UUID of the trip

Response Codes

Status codeDescription
200OK
401Unauthorized
404Not found

Code samples for "Get a trip"

GET /api/v1/trip/:uuid
curl -L \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/trip/alsdkfj-9123jl-asldfkj

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
}

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 stringThe user access token

Path

uuid stringThe UUID of the trip

Response Codes

Status codeDescription
200OK
401Unauthorized
404Not found

Code samples for "Get a trip's map"

GET /api/v1/trip/:uuid/map
curl -L \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/trip/alsdkfj-9123jl-asldfkj/map
measurementunits
distancekilometers
timeminutes
costTBD

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,
}
}
]
}

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 stringThe user access token
Max-Width numbermaximum width of the image to return (required?)
Max-Height numbermaximum height of the image to return (required?)

Path

uuid stringThe UUID of the trip

Response Codes

Status codeDescription
200OK
401Unauthorized
403Not found

Code samples for "Get a trip's picture"

GET /api/v1/trip/:uuid/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 stringThe user access token

Body

name stringRequired. The name of the trip
desc stringThe 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 booleanPrivacy setting of the trip

Response Codes

Status codeDescription
200OK
401Not authorized

Code samples for "Create a trip"

POST /api/v1/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}'

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
}

Update a trip

PUT /api/v1/trip/:uuid

Update a trip

Parameters

Header

token stringThe user access token

Path

uuid stringThe UUID of the trip

Body

name stringThe new name of the trip
desc stringThe 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 stringThe new image url of the trip
owner stringThe username of the new owner of the trip
members Array<string>The updated members of the trip
private booleanThe new privacy setting of the trip

Response Codes

Status codeDescription
200OK
304Not modified
401Unauthorized
404Not found

Code samples for "Update a trip"

PUT /api/v1/trip/:uuid
curl -L \
-X PUT \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/trip/aksjfh9320-oaf90-12iuhfiuas \
-d '{"todo": ["visit the Vegas sphere"]}'

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
}

Update a trip's map

PUT /api/v1/trip/:uuid/map

Update a trip's map information

Parameters

Header

token stringThe user access token

Path

uuid stringThe UUID of the trip

Body

notes stringThe new notes for the trip's map
locationsThe new locations of the trip
locations schema
{
"locations": [{
"title": "string",
"address": "string",
"date": {"start": "number", "end": "number"},
"transportation": {
"type": "string",
"distance": "number",
"time": "number",
"cost": "number",
}
}
]
}

Response Codes

Status codeDescription
200OK
304Not modified
401Unauthorized
404Not found

Code samples for "Update a trip's map"

PUT /api/v1/trip/:uuid/map
curl -L \
-X PUT \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/trip/aksjfh9320-oaf90-12iuhfiuas \
-d '{"locations": []}'

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": []
}

Delete a trip

DELETE /api/v1/trip/:uuid

Delete a trip Protect against cross-site forgery? (Auth0)

Parameters

Header

token stringThe user access token

Path

uuid stringThe UUID for the trip

Response Codes

Status codeDescription
204No Content
401Unauthorized
404Not found

Code samples for "Delete a trip"

DELETE /api/v1/trip/:uuid
curl -L \
-X DELETE
-H "Authorization: Bearer <YOUR-TOKEN>" \
http://localhost:3000/api/v1/trip/askdjh-eqfhu9823-iquwef
  • No response body