Retrieves a Wix event by ID.
The getEvent()
function returns a Promise that resolves to a Wix event whose ID matches the given ID.
Only those with "Manage Events" permissions can get Wix events.
Note: This function requires elevated permissions to run.
This function is not universal and runs only on the backend.
function getEvent(eventId: string): Promise<WixEvent>;
Event ID.
import { Permissions, webMethod } from "wix-web-module";
import { wixEvents } from "wix-events-backend";
import { elevate } from "wix-auth";
/* Sample eventId value: 'c241e6e2-c951-440d-8b62-52a6ec382140'; */
export const myGetEventFunction = webMethod(
Permissions.Anyone,
async (eventId) => {
try {
const elevatedGetEvent = elevate(wixEvents.getEvent);
const getEvent = await elevatedGetEvent(eventId);
console.log("Success! Event:", getEvent);
return getEvent;
} catch (error) {
console.error(error);
// Handle the error
}
},
);
/* Promise resolves to:
{
"about": "Join us for Nature's Symphony: A Musical Journey Through Wildlife at the iconic Royal Albert Hall.",
"assignedContactsLabel": "custom.natures-symphony-a-musical-journey-through-wildlif",
"calendarLinks": {
"google": "http://calendar.google.com/calendar/render?action=TEMPLATE&text=Nature%27s+Symphony%3A+A+Musical+Journey+Through+Wildlife&dates=20231129T190000Z%2F20231129T230000Z&location=Kensington+Gore%2C+London+SW7%2C+UK&details=Thank+you+for+registering+to+our+event%21+Your+tickets+are+attached+to+this+email.+Don%27t+forget+to+bring+them.%0A%0AWe%27re+looking+forward+to+seeing+you+there.%0A%0AHere+are+the+details%3A%0A%0ANature%27s+Symphony%3A+A+Musical+Journey+Through+Wildlife%0A29+November+2023%2C+19%3A00%E2%80%9323%3A00%0ARoyal+Albert+Hall%2C+Kensington+Gore%2C+London+SW7%2C+UK",
"ics": "https://www.wixevents.com/media/v2/calendar?token=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiaW5zdGFuY2VJZFwiOlwiMWY2ZGM5MDYtODAzZC00NjUwLTgzZjUtNzJlYTFkODgxMDBiXCIsXCJldmVudElkXCI6e1widmFsdWVcIjpcImMyNDFlNmUyLWM5NTEtNDQwZC04YjYyLTUyYTZlYzM4MjE0MFwifSxcIm9jTGlua1wiOm51bGx9IiwiaWF0IjoxNjk5NDUwMDE2fQ.2wZA5WH2TOR4f8M1QICFOu8oD4gX70jBaCRMCFQRbqI"
},
"categories": [],
"createdBy": "8a8b9b73-4da8-47a5-8268-4396e68a0605",
"_createdDate": "2023-07-13T12:52:00.911Z",
"description": "Immerse yourself in the enchanting harmony of nature's symphony as it intertwines with the power of music!",
"eventUrl": {
"baseUrl": "https://mysite.com/events",
"path": "/event-details-registration/natures-symphony-a-musical-journey-through-wildlife"
},
"form": {
"inputGroups": [
{
"_id": "name",
"inputs": [
{
"additionalLabels": [],
"label": "First name",
"maxLength": 50,
"name": "firstName",
"options": [],
"required": true,
"type": "TEXT"
},
{
"additionalLabels": [],
"label": "Last name",
"maxLength": 50,
"name": "lastName",
"options": [],
"required": true,
"type": "TEXT"
}
],
"orderIndex": 0,
"system": true,
"type": "NAME"
},
{
"_id": "email",
"inputs": [
{
"additionalLabels": [],
"label": "Email",
"maxLength": 255,
"name": "email",
"options": [],
"required": true,
"type": "TEXT"
}
],
"orderIndex": 1,
"system": true,
"type": "INPUT"
}
],
"messages": {
"checkout": {
"checkoutLabel": "Continue",
"title": "Add your details"
},
"registrationClosed": {
"exploreEventsLabel": "See other events",
"message": "Registration is closed"
},
"rsvp": {
"noMessages": {
"confirmationTitle": "Sorry You Can't Make It",
"shareLabel": "Share",
"title": "Add your details"
},
"rsvpNo": "Not Going",
"rsvpYes": "I'm Going",
"submitRsvpLabel": "SUBMIT",
"waitingMessages": {
"addToCalendarLabel": "Add to Calendar",
"confirmationMessage": "We'll update you if additional spots become available.",
"confirmationTitle": "Thanks! You've been added to the waitlist.",
"shareLabel": "Share",
"title": "Looks like this event is full. Join the waitlist."
},
"yesMessages": {
"addToCalendarLabel": "Add to Calendar",
"confirmationMessage": "An email with all the event info was sent to you.",
"confirmationTitle": "Thank you!",
"shareLabel": "Share",
"title": "Add your details"
}
}
}
},
"guestList": {
"public": true
},
"_id": "c241e6e2-c951-440d-8b62-52a6ec382140",
"language": "en",
"location": {
"address": {
"formatted": "Kensington Gore, London SW7, UK",
"location": {
"latitude": 51.5009132,
"longitude": -0.1766086
},
"city": "London",
"country": "GB",
"postalCode": "SW7 2BL",
"streetAddress": {
"name": "Kensington Gore",
"number": "SW7",
"apt": ""
}
},
"name": "Royal Albert Hall",
"tbd": false,
"type": "VENUE"
},
"registration": {
"initialType": "TICKETS",
"restrictedTo": "VISITOR",
"rsvp": {
"responseOptions": "YES_ONLY",
"waitlist": false
},
"status": "OPEN_TICKETS",
"tickets": {
"currency": "EUR",
"formAssignedPerTicket": false,
"highestTicketPrice": {
"currency": "EUR",
"value": "20.00"
},
"highestTicketPriceFormatted": "€20",
"lowestTicketPrice": {
"currency": "EUR",
"value": "20.00"
},
"lowestTicketPriceFormatted": "€20",
"tax": {}
},
"type": "TICKETS"
},
"scheduling": {
"endDate": "2023-11-29T23:00:00.137Z",
"formatted": "29 November 2023, 19:00–23:00",
"hideEndDate": false,
"showTimeZone": false,
"startDate": "2023-11-29T19:00:00.000Z",
"startDateFormatted": "29 November 2023",
"startTimeFormatted": "19:00",
"tbd": false,
"timeZoneId": "Europe/Dublin"
},
"slug": "natures-symphony-a-musical-journey-through-wildlife",
"status": "SCHEDULED",
"summary": {
"rsvp": {
"noCount": 0,
"totalRsvps": 0,
"waitlistCount": 0,
"yesCount": 0
},
"tickets": {
"currencyLocked": false,
"revenue": {},
"totalOrders": 0,
"totalSales": {},
"totalTickets": 0
}
},
"title": "Nature's Symphony: A Musical Journey Through Wildlife",
"_updatedDate": "2023-11-08T13:22:57.000Z",
"videoConferencing": {
"session": {
"guestLink": "https://www.wixevents.com/oc?join=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiYWN0aW9uXCI6XCJqb2luXCIsXCJpbnN0YW5jZUlkXCI6XCIxZjZkYzkwNi04MDNkLTQ2NTAtODNmNS03MmVhMWQ4ODEwMGJcIixcImV2ZW50SWRcIjpcImMyNDFlNmUyLWM5NTEtNDQwZC04YjYyLTUyYTZlYzM4MjE0MFwifSIsImlhdCI6MTY5OTQ1MDAxNn0.AfJHpzU54hY8M1oVB0KGe47GUSzOzkWBVpKTTWEXk5Y",
"hostLink": "https://www.wixevents.com/oc?start=JWS.eyJraWQiOiJpb21iOUJ0eSIsImFsZyI6IkhTMjU2In0.eyJkYXRhIjoie1wiYWN0aW9uXCI6XCJzdGFydFwiLFwiaW5zdGFuY2VJZFwiOlwiMWY2ZGM5MDYtODAzZC00NjUwLTgzZjUtNzJlYTFkODgxMDBiXCIsXCJldmVudElkXCI6XCJjMjQxZTZlMi1jOTUxLTQ0MGQtOGI2Mi01MmE2ZWMzODIxNDBcIn0iLCJpYXQiOjE2OTk0NTAwMTZ9.VmvnxZHBL6cCyE0ZYRdAa6cCud8aNchTTrLJX0b-Mhs"
}
}
}
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.