Overview
About
The Transpyr back-end api is a Node/Express REST API that handles Transpyr's user, event, and booking operations.
The API is designed to be consumed by the front-end application, which is written in React.js.
Setup
Starting the server
npm start
starts the server.
npm run start-dev
runs the server with nodemon.
Configuration
The following environment variables are required to run the API:
See Environment Variables
Server config
-
NODE_ENV
The environment to run the API in. This can be either
development
orproduction
. -
PORT
The port to run the API on.
Default: 3000
-
FRONTEND_HOST
The hostname of the front-end application.
Required for links contained in automated emails to work.
Sets 'domain' of refresh token's set-cookie header.
In production, Transpyr and transpyr-api must be on the same domain for refresh tokens to work due to cross-origin cookies being blocked by modern browsers.
Database config
transpyr-api uses MongoDB Atlas to host its database.
-
DB_URL
mongodb://[username:
@]host1[:port1],...hostN[:portN]][/[defaultauthdb][?options]] MongoDB connection string
<PASSWORD>
should be preserved. It is replaced programatically with the DB_PASS environment variable. -
DB_PASS
MongoDB user password.
JWT config
-
JWT_SECRET
The secret used to sign JWTs.
At least 32 character length recommended
-
JWT_EXPIRES_IN
The number of milliseconds a JWT is valid for.
Recommended:
900000
(15 minutes)
DEVELOPMENT email config
The development email service is usually something like Mailtrap.
-
EMAIL_USERNAME
Development email host username.
-
EMAIL_PASSWORD
Development email host password.
-
EMAIL_HOST
Development email host.
-
EMAIL_PORT
Development email host port.
-
EMAIL_FROM
The email address to send emails from.
PRODUCTION email config
transpyr-api uses SendGrid for emails in production.
-
SENDGRID_USERNAME
Usually 'apikey'.
-
SENDGRID_PASSWORD
The API key or password for SendGrid.
Stripe config
transpyr-api uses a development implementaton of Stripe for payments.
The api was not built for use with real payments, and lacks business logic required to support real payments.
-
STRIPE_SECRET_KEY
The secret key for Stripe.
-
STRIPE_WEBHOOK_SECRET
The secret key for authorizing Stripe webhook requests.
AWS config
transpyr-api needs to access an S3 bucket to store and stream user and event photos.
-
AWS_ACCESS_KEY_ID
The AWS access key ID.
-
AWS_SECRET_ACCESS_KEY
The AWS secret access key.
-
AWS_BUCKET
The name of the S3 bucket to use.
Resources
Event
Details
id
: String. ID of event.name
: String. Name of the event.-
type
: String. Format of the event.- Allowed values: Lecture, Class, Performance, Social, Workshop, Conference, Convention, Expo, Game, Rally, Screening, Tour
-
category
: String. Category of event.- Allowed values: Business, Food, Health & Lifestyle, Music, Vehicle, Charity, Community, Fashion, Film, Home, Hobbies, Performing & Visual Arts, Politics, Spirituality, School, Science & Technology, Holiday, Sports & Fitness, Travel, Outdoor & Recreation, Other
description
: String. Description of the event in Markdown.convertedDescription
: String. Generated copy of event description, sanitized and converted to HTMLticketTiers
: TicketTier[]. Array of event ticket types.photo
: String. Filename of event photo.dateTimeStart
: Date. Start date and time of event.dateTimeEnd
: Date. End date and time of event.createdAt
: Date. Creation date and time of event.organizer
: String. ID of event organizer.address
: String. Optional event address if the event is in-person.-
location
: Location.type
: String. Value must be "Point".coordinates
: Array. Location coordinates expressed [longitude, latitude].
totalCapacity
: Number. Total number of available tickets for event.totalBookings
: Number. Total number of current bookings for event.-
feePolicy
: String. Specifies whether booking fees should be covered by the organizer or passed to attendees.- Allowed values: absorbFee, passFee
refundPolicy
: String. Optional refund policy for event.language
: String. Language event is presented in.online
: Boolean. Specifies if event includes online attendance.canceled
: Boolean. Specifies if event is canceled.published
: Boolean. Specifies if event is published.soldOut
: Boolean. Specifies if event is sold out.
TicketTier
Details
id
: String. ID of ticket.tierName
: String. Ticket name.tierDescription
: String. Ticket description.price
: Number. Ticket price.online
: Boolean. Specifies if ticket is for online attendance.capacity
: Number. Number of tickets available.limitPerCustomer
: Number. Maximum number of bookings allowed per order.canceled
: Boolean. Specifies if ticket is canceled.numBookings
: Number. Current number of bookings for ticket.ticketSoldOut
: Boolean. Specifies if ticket is sold out.
User
Details
id
: String. ID of user.name
: String. The name of the user.email
: String. The email address of the user.-
password
: String. Hashed password of the user.- This field is not accessible by any endpoint.
createdAt
: Date. Date and time of user creation.photo
: String. Filename of user photo.tagline
: String. Short introduction of the user.bio
: String. A longer description of the user.interests
: String. A description of the user's interests.favorites
: String[]. An array of event IDs belonging to the user's favorites.privateFavorites
: Boolean. Specifies if the user's favorites are sent with their public profile.role
: String. Specifies if the user is an admin or regular user.active
: Boolean. Specifies if user is active.passwordChangedAt
: Date. The date and time of the user's last password change.passwordResetToken
: String. Hashed password reset token.passwordResetExpires
: Date. Date and time user's password reset token expires.
Booking
Details
id
: String. ID of booking.orderId
: String. ID of order the booking is a part of.name
: String. Name associated with the booking.email
: String. Email associated with the booking.user
: String. ID of user optionally associated with the booking.event
: String. ID of booked event.ticket
: String. ID of booked event ticket type.price
: Number. Price of the ticket at the time of booking.createdAt
: Date. Date and time of booking creation.paid
: Boolean. Specifies if booking has been paid for.active
: Boolean. Specifies if booking is active or canceled.refundRequest
: RefundRequest. Contains an associated refund request if applicable.
RefundRequest
Details
id
: String. UUID of the unique request document.requestId
: String. ID of the refund request that the request belongs to.createdAt
: Date. Date and time of refund request creation.resolved
: Boolean. Specifies if a decision has been made about the request.-
status
: String. The status of a resolved refund request.- Allowed values: accepted, rejected
reason
: String. Optional reason for the refund request.refundProcessed
: Boolean. Specifies if the refund payment has processed (not implemented).
API Root
Stream image from Amazon S3
/image/:folder/:id.jpg
Details
URL Params
-
:folder
StringThe folder in which the image is stored.
Either
events
orusers
. -
:id
StringThe the id of the user or image whose photo you are requesting.
Images are always stored as JPEGs. The
.jpeg
extension should always be specified.
Response
image/jpeg
The requested image.
Stripe webhook checkout
/webhook-checkout
Don't hit this endpoint directly.
Add a webhook from the Stripe dashboard to request this endpoint on the checkout.session.completed
event.
Events
Get all events
/events
Details
Query Params
-
[field]
StringThe key should correspond to a field in the events resource. The value is the value of that field you want to match in the results.
eg.
category=Lecture
-
sort
StringSorts returned events by the specified field. Accepts two field names, space separated. If events have equal values for the first sorting field, they will be sorted by the second field.
Prefixing the fieldname with - will sort descending. Otherwise it sorts ascending.
eg.
sort=totalCapacity -createdAt
-
fields
StringSpecifies a comma-separated (with no spaces) list of fields to include in the returned events. Prefixing a field with - will exclude that field and include all others. Explicit exclusion cannot be combined with inclusion.
VALID eg.
fields=name,dateTimeStart
INVALID eg.
fields=name,photo,-ticketTiers
-
loc
JSON StringReturns events within a specified radius around a specified coordinate pair."center": A comma-separated pair of coordinates, expressed "longitude,latitude".
"radius": The radius around the center in miles.
eg.
loc={"center":"-86.8893739,36.0853771","radius":"50"}
-
search
StringA case-insensitive search string that returns events matching the event name or description.
eg.
search=yoga
-
paginate
JSON StringReturns results in separate pages according to the specified limit. In addition to the events, it supplies the total number of events, current page, and total number of pages.
"page": The requested page number.
"limit": The number of results per page.
eg.
paginate={"page":1,"limit":8}
Response
JSON
-
status
: String. -
results
: Number. Number of returned documents. -
data
: Object.-
data
: Event[]. The returned event documents. -
total
: Number. (Optional) The total number of documents when using pagination. -
page
: Number. (Optional) The current page when using pagination. -
pages
: Number. (Optional) The total number of pages when using pagination.
-
Get one event
/events/:id
Details
URL Params
-
:id
StringThe id of the requested event.
Query Params
-
fields
StringSpecifies a comma-separated (with no spaces) list of fields to include in the returned events. Prefixing a field with - will exclude that field and include all others. Explicit exclusion cannot be combined with inclusion.
VALID eg.
fields=name,dateTimeStart
INVALID eg.
fields=name,photo,-ticketTiers
Response
JSON
-
status
: String. -
data
: Object.-
data
: Event. The requested event document.
-
Create an event
/events
Authorization required
Body: application/json
-
name
StringRequired
The name of the event.
- Required.
- Must be at least 8 characters.
- Cannot exceed 75 characters.
-
type
StringRequired
The event type (format).
- Required.
- Allowed values: 'Lecture', 'Class', 'Performance', 'Social', 'Workshop', 'Conference', 'Convention', 'Expo', 'Game', 'Rally', 'Screening', 'Tour'
-
category
StringRequired
The event category.
- Required.
- Allowed values: 'Business', 'Food', 'Health & Lifestyle', 'Music', 'Vehicle', 'Charity', 'Community', 'Fashion', 'Film', 'Home', 'Hobbies', 'Performing & Visual Arts', 'Politics', 'Spirituality', 'School', 'Science & Technology', 'Holiday', 'Sports & Fitness', 'Travel', 'Outdoor & Recreation', 'Other'
-
description
StringRequired
The description of the event.
- Required.
- The description is parsed from Markdown to HTML on event
creation. New lines are represented with the
\n
newline character.
-
dateTimeStart
DateRequired
The start date and time of the event.
- Required.
- The start date must be in the future. newline character.
-
dateTimeEnd
DateRequired
The end date and time of the event.
- Required.
- The end date must be after the start date. newline character.
-
ticketTiers
TicketTier[]Required
The ticket tiers for the event.
- At least one ticket is required.
- An event can have a maximum of 10 ticket tiers.
- Total ticket capacities cannot exceed the event total capacity. When all tickets have a limited capacity (greater than 0), they must equal the event total capacity.
TicketTier
-
tierName
: String. Required. The name of the ticket tier. Must be unique. Cannot exceed 50 characters. -
tierDescription
: String. Required. The description of the ticket tier. Cannot exceed 150 characters. -
price
: Number. Required. The price of the ticket tier. Must be greater than or equal to 0. -
online
: Boolean. Requied. Specifies if the ticket is for virtual attendance. -
capacity
: Number. The number of tickets available. Must be greater than or equal to 0. A value of 0 indicates that there is no limit. -
limitPerCustomer
: Number. The number of tickets available per order. Must be greater than or equal to 0. A value of 0 indicates that there is no limit. Must be less than or equal to the capacity.
-
location
LocationThe location of the event.
- Required when the address field is specified.
Location
-
coordinates
: [number, number]. Required. Coordinates are expressed as longitude, latitude.
-
address
StringThe address of the event.
- Required when the location field is specified.
-
totalCapacity
NumberThe total number of available event tickets.
- Required.
- Must be greater than or equal to 0. A value of 0 indicates there is no capacity limit.
- Must be eq
Response
JSON
-
status
: String. -
data
: Object.-
data
: Event. The created event document.
-
Upload event photo
/events/:id
Authorization required
URL Params
-
:id
StringThe id of the event.
Body: multipart/form-data
-
photo
ImageRequired
A valid image file to be uploaded.
Response
JSON
-
status
: String. -
data
: Object.-
data
: Event. The created event documents.
-
Edit an event
/events/:id
Authorization required
URL Params
-
:id
StringThe id of the event to edit.
Body: application/json
- Same as create event.
- Ticket tiers cannot be removed. See "Cancel an event ticket tier".
- The entire event object does not need to be specified in the request body.
Response
JSON
-
status
: String. -
data
: Object.-
data
: Event. The created event documents.
-
Publish an event
/events/:id/publish
Authorization required
Specify a fee policy and optional refund policy to publish an event
URL Params
-
:id
StringThe id of the event to publish.
Body: application/json
-
feePolicy
StringRequired
Allowed values: 'passFee', 'absorbFee'.
absorbFee takes Transpyr's service fee from the organizer's earnings.
passFee adds Transpyr's service fee to the ticket price.
-
refundPolicy
StringOptional refund policy.
Response
JSON
-
status
: String. -
data
: Object.-
data
: Event. The created event documents.
-
Get all own events
/events/me
Authorization required
Query params
- Same as Get All Events.
- It is not possible to query for other organizer's events from this route.
- Unlike Get All Events, this route responds with the user's unpublished events.
Response
JSON
-
status
: String. -
results
: Number. Number of returned documents. -
data
: Object.-
data
: Event[]. The returned event documents. -
total
: Number. (Optional) The total number of documents when using pagination. -
page
: Number. (Optional) The current page when using pagination. -
pages
: Number. (Optional) The total number of pages when using pagination.
-
Cancel an event ticket tiers
/events/:id/ticket/:ticketId
Authorization required
Cancel an event ticket.
URL Params
-
:id
StringThe id of the event.
-
:ticket
StringThe id of the ticket to cancel.
Response
204: No Content
Get own booked events
/events/me/booked
Authorization required
Returns events the user has booked, with the total number of bookings for each.
It is not possible to query for other organizer's events from this route.
Unlike Get All Events, this route responds with the user's unpublished events.
Query params
-
[field]
StringThe key should correspond to a field in the events resource. The value is the value of that field you want to match in the results.
eg.
category=Lecture
-
fields
StringSpecifies a comma-separated (with no spaces) list of fields to include in the returned events. Prefixing a field with - will exclude that field and include all others. Explicit exclusion cannot be combined with inclusion.
VALID eg.
fields=name,dateTimeStart
INVALID eg.
fields=name,photo,-ticketTiers
Response
JSON
-
status
: String. -
results
: Number. Number of returned documents. -
data
: Object.-
data
: Event[]. The returned event documents.-
total
: Number. Number of user bookings for event.
-
-
Admin-only actions
Users with the admin role can use normal routes with extra functionality.
- Get Events returns all events, published and unpublished.
- Admins can edit and publish any event.
- Admins can cancel and delete events and their tickets.
Users
Sign in
/users/signin
Body: application/json
-
email
StringRequired
Valid email address of the user.
-
password
StringRequired
Password of the user.
Response
JSON
-
status
: String. -
token
: String. JSON web token, which is sent in the authorization header to access protected routes. -
expiresIn
: Number. The amount of time in milliseconds for which the JWT is valid. -
data
: Object.-
user
: User. The returned user document.
-
Sign up
/users/signup
Body: application/json
-
name
StringRequired
Name for the user.
- Must be under 42 characters.
-
email
StringRequired
Email address for the account.
- Must be a valid email address.
- Must not already be in use.
-
password
StringRequired
Password for the account.
- Must be at least 8 characters long.
-
passwordConfirm
StringRequired
Confirmation of the password.
-
Must match the
password
field.
-
Must match the
Response
JSON
-
status
: String. -
token
: String. JSON web token, which is sent as a Bearer token in the authorization header to access protected routes. -
expiresIn
: Number. The amount of time in milliseconds for which the JWT is valid. -
data
: Object.-
user
: User. The returned user document.
-
Refresh token
/users/refresh-token
If a valid refresh token is sent in a secure, HTTPOnly cookie, the refresh token and JWT are replaced and returned.
Response
JSON
-
status
: String. -
token
: String. JSON web token, which is sent as a Bearer token in the authorization header to access protected routes. -
expiresIn
: Number. The amount of time in milliseconds for which the JWT is valid. -
data
: Object.-
user
: User. The returned user document.
-
Revoke token
/users/refresh-token
Authorization required
Revokes a refresh token sent in either the body of the request or a secure HTTPOnly cookie, rendering it invalid for refreshing a JWT.
Body: application/json
-
token
StringOptional. A valid refresh token (which was issued to the current user) to revoke.
Response
204 No Content
Forgot password
/users/forgot-password
Begins the password reset process by sending an email containing a link with a password reset token to a valid user email address.
Body: application/json
-
email
StringRequired
Email of the user.
- Must be a valid email address corresponding to an active user.
Response
JSON
-
status
: String. -
message
: String. Value is 'Email sent!' upon success.
Reset password
/users/reset-password/:token
URL Params
-
:token
StringRequired
Valid password reset token received in the "forgot password" email.
Body: application/json
-
password
StringRequired
Password for the account.
- Must be at least 8 characters long.
-
passwordConfirm
StringRequired
Confirmation of the password.
-
Must match the
password
field.
-
Must match the
Response
JSON
-
status
: String. -
message
: String. Value is 'Password changed successfully!' upon success.
Get public user profile
/profile/:id
URL Params
-
:id
StringRequired
User ID.
Query Params
-
fields
StringSpecifies a comma-separated (with no spaces) list of fields to include in the returned user profile. Prefixing a field with - will exclude that field and include all others. Explicit exclusion cannot be combined with inclusion.
VALID eg.
fields=name,events
INVALID eg.
fields=name,photo,-favorites
-
paginate
JSON StringReturns events in the 'favorites' and 'events' fields in separate pages according to the specified limit.
"page": The requested page number.
"limit": The number of results per page.
eg.
paginate={"page":1,"limit":8}
Response
JSON
-
status
: String. -
data
: Object.-
user
: User. The returned user document.
-
Update password
/users/update-password
Authorization required
Logged in users can use this endpoint to change their passoword.
Body: application/json
-
password
StringRequired
Current password for the account.
-
newPassword
StringRequired
New password for the account.
- Must be at least 8 characters long.
-
newPasswordConfirm
StringRequired
Confirmation of the new password.
-
Must match the
newPassword
field.
-
Must match the
Response
204 No Content
Get own user
/users/me
Authorization required
Gets logged in user's document.
Response
JSON
-
status
: String. -
data
: Object.-
data
: User. The returned user document.
-
Update own user
/users/me
Authorization required
Used to edit the currently logged-in user. Contains either FormData for changing the user's photo or JSON for editing the user's info.
Upload user photo: multipart/form-data
-
photo
imageA valid image file to be uploaded.
Edit user: application/json
-
name
stringUser name.
- Maximum of 42 characters.
-
email
stringUser email.
- Must be a valid email address.
-
privateFavorites
booleanWhether or not the user's favorites should be private.
-
favorites
string[]Array of user's favorite events.
- Must contain IDs of the events.
-
bio
stringA longer description of the user.
- Maximum of 1000 characters.
-
interests
stringSome info about the user's interests and goals.
- Maximum of 500 characters.
-
tagline
stringA short phrase to be displayed at the top of a user's profile, as well as in the "organizer" section of their events.
- Maximum of 150 characters.
Response
JSON
-
status
: String. -
data
: Object.-
user
: User. The returned user document.
-
Deactivate own user
/users/me
Authorization required
Deactivate the currently logged-in user.
Response
204: No Content
Admin-only actions
Get all users
GET
/users
Admin authorization required
Details
Query Params
-
[field]
String
The key should correspond to a field in the events resource. The value is the value of that field you want to match in the results.
eg. category=Lecture
-
sort
String
Sorts returned events by the specified field.
Accepts two field names, space separated.
If events have equal values for the first sorting field,
they will be sorted by the second field.
Prefixing the fieldname with - will sort descending. Otherwise it sorts ascending.
eg. sort=totalCapacity -createdAt
-
fields
String
Specifies a comma-separated (with no spaces) list of fields to include in the returned events.
Prefixing a field with - will exclude that field and include all others. Explicit exclusion cannot
be combined with inclusion.
VALID eg. fields=name,dateTimeStart
INVALID eg. fields=name,photo,-ticketTiers
-
loc
JSON String
Returns events within a specified radius around a specified coordinate pair.
"center": A comma-separated pair of coordinates, expressed "longitude,latitude".
"radius": The radius around the center in miles.
eg. loc={"center":"-86.8893739,36.0853771","radius":"50"}
-
search
String
A case-insensitive search string that returns events matching the event name or description.
eg. search=yoga
-
paginate
JSON String
Returns results in separate pages according to the specified limit.
In addition to the events, it supplies the total number of events, current page, and total number of pages.
"page": The requested page number.
"limit": The number of results per page.
eg. paginate={"page":1,"limit":8}
Response
JSON
-
status
: String.
-
results
: Number. Number of returned documents.
-
data
: Object.
-
data
: User[]. The returned user documents.
-
total
: Number. (Optional) The total number of documents when using pagination.
-
page
: Number. (Optional) The current page when using pagination.
-
pages
: Number. (Optional) The total number of pages when using pagination.
Get one user
GET
/users/:id
Admin authorization required
Details
URL Params
-
:id
String
The id of the requested user.
Response
JSON
-
status
: String.
-
data
: Object.
-
data
: User. The requested user document.
Update user
PATCH
/users/:id
Admin authorization required
Used to edit any user's document. Contains either FormData for changing the user's photo or JSON for editing the other fields.
Upload user photo: multipart/form-data
-
photo
image
A valid image file to be uploaded.
Edit user: application/json
- Possible fields match the user model.
- Attempting to include a password field will return an error.
Response
JSON
-
status
: String.
-
data
: Object.
-
user
: User. The returned user document.
Delete user
DELETE
/users/:id
Admin authorization required
Deletes a user's document permanently.
URL Params
-
:id
String
A valid user ID.
Response
204 No Content
Get all users
/users
Admin authorization required
Details
Query Params
-
[field]
StringThe key should correspond to a field in the events resource. The value is the value of that field you want to match in the results.
eg.
category=Lecture
-
sort
StringSorts returned events by the specified field. Accepts two field names, space separated. If events have equal values for the first sorting field, they will be sorted by the second field.
Prefixing the fieldname with - will sort descending. Otherwise it sorts ascending.
eg.
sort=totalCapacity -createdAt
-
fields
StringSpecifies a comma-separated (with no spaces) list of fields to include in the returned events. Prefixing a field with - will exclude that field and include all others. Explicit exclusion cannot be combined with inclusion.
VALID eg.
fields=name,dateTimeStart
INVALID eg.
fields=name,photo,-ticketTiers
-
loc
JSON StringReturns events within a specified radius around a specified coordinate pair."center": A comma-separated pair of coordinates, expressed "longitude,latitude".
"radius": The radius around the center in miles.
eg.
loc={"center":"-86.8893739,36.0853771","radius":"50"}
-
search
StringA case-insensitive search string that returns events matching the event name or description.
eg.
search=yoga
-
paginate
JSON StringReturns results in separate pages according to the specified limit. In addition to the events, it supplies the total number of events, current page, and total number of pages.
"page": The requested page number.
"limit": The number of results per page.
eg.
paginate={"page":1,"limit":8}
Response
JSON
-
status
: String. -
results
: Number. Number of returned documents. -
data
: Object.-
data
: User[]. The returned user documents. -
total
: Number. (Optional) The total number of documents when using pagination. -
page
: Number. (Optional) The current page when using pagination. -
pages
: Number. (Optional) The total number of pages when using pagination.
-
Get one user
/users/:id
Admin authorization required
Details
URL Params
-
:id
StringThe id of the requested user.
Response
JSON
-
status
: String. -
data
: Object.-
data
: User. The requested user document.
-
Update user
/users/:id
Admin authorization required
Used to edit any user's document. Contains either FormData for changing the user's photo or JSON for editing the other fields.
Upload user photo: multipart/form-data
-
photo
imageA valid image file to be uploaded.
Edit user: application/json
- Possible fields match the user model.
- Attempting to include a password field will return an error.
Response
JSON
-
status
: String. -
data
: Object.-
user
: User. The returned user document.
-
Delete user
/users/:id
Admin authorization required
Deletes a user's document permanently.
URL Params
-
:id
StringA valid user ID.
Response
204 No Content
Bookings
Create Stripe checkout session
/bookings/checkout-session/:eventId
Authorization optional
URL Params
-
:eventId
StringValid ID of event to be booked.
Body: application/json
-
name
StringRequired
Name for the bookings.
-
email
StringRequired
Email address for the bookings.
-
tickets
TicketSelectionsRequired
An object containing selected ticket ID keys with the selected quantity as a value.
TicketSelections
-
[ticketId]
: Number. Required. The selected quantity of the ticket.
-
Response
JSON
-
status
: String. -
id
: String. The Stripe checkout session ID.
Get order bookings
/bookings/order/:id
URL params
-
:id
StringThe order ID.
Response
JSON
-
status
: String. -
length
: Number. Number of returned documents. -
data
: Event[]. The returned booking documents.
Get own bookings
/bookings/me
Authorization required
Details
Query Params
-
[field]
StringThe key should correspond to a field in the bookings resource. The value is the value of that field you want to match in the results.
eg.
event=60266cadc727a6c634a445de
-
sort
StringSorts returned events by the specified field. Accepts two field names, space separated. If events have equal values for the first sorting field, they will be sorted by the second field.
Prefixing the fieldname with - will sort descending. Otherwise it sorts ascending.
eg.
sort=-createdAt
Response
JSON
-
status
: String. -
length
: Number. Number of returned documents. -
data
: Booking[]. The returned booking documents.-
event
: Event. The populated event data. -
ticketData
: TicketTier. The document for the booking's corresponding ticket.
-
Get all refund requests for event
/bookings/refund-requests/event/:id
Authorization required
Details
URL Params
-
:id
StringThe ID of the event.
Response
JSON
-
status
: String. -
length
: Number. Number of returned documents. -
data
: Booking[]. The returned booking documents.
Get refund request
/bookings/refund-requests/:id
Authorization required
Details
URL Params
-
:id
StringThe ID of the refund request.
Response
JSON
-
status
: String. -
length
: Number. Number of returned documents. -
data
:requestId
: String. Refund request ID.name
: String. Name associated with refund request bookings.email
: String. Email associated with refund request bookings.createdAt
: Date. Request creation date.reason
: String. Optional reason for request.-
event
:id
: String. ID of event associated with refund request bookings.name
: String. Name of event associated with refund request bookings.organizer
: String. ID of event organizer.
-
tickets
: Array. Contains all tickets in the refund request.price
: Number. Price of individual ticket.ticket
: TicketTier. Data of individual ticket.
Admin-only actions
Get all bookings
/bookings
Admin authorization required
Details
Query Params
-
[field]
StringThe key should correspond to a field in the events resource. The value is the value of that field you want to match in the results.
eg.
paid=false
-
sort
StringSorts returned events by the specified field. Accepts two field names, space separated. If events have equal values for the first sorting field, they will be sorted by the second field.
Prefixing the fieldname with - will sort descending. Otherwise it sorts ascending.
eg.
sort=price -createdAt
-
fields
StringSpecifies a comma-separated (with no spaces) list of fields to include in the returned events. Prefixing a field with - will exclude that field and include all others. Explicit exclusion cannot be combined with inclusion.
VALID eg.
fields=name,email
INVALID eg.
fields=name,email,-price
Response
JSON
-
status
: String. -
length
: Number. Number of returned documents. -
data
: Booking[]. The returned booking documents.
Get booking
/bookings/:id
Admin authorization required
Details
URL Params
-
:id
StringThe id of the requested booking.
Response
JSON
-
status
: String. -
data
: Object.-
data
: Booking. The requested booking.
-