Search.../

getEventBySlug( )

Retrieves an event by the slug URL.

Description

The slug is the end of an event URL that refers to a specific event. For example, if an events' URL is https://example.com/events/event/{my-event-slug}, the slug is my-event-slug.

Syntax

function getEventBySlug(slug: string, options: GetEventBySlugOptions): Promise<GetEventBySlugResponse>

getEventBySlug Parameters

NAME
TYPE
DESCRIPTION
slug
string

URL slug.

options
Optional
GetEventBySlugOptions

Optional fields.

Returns

Return Type:

Promise<
GetEventBySlugResponse
>
NAME
TYPE
DESCRIPTION
event
V3Event

Event.

Was this helpful?

getEventBySlug example

Copy Code
1import { wixEventsV2 } from 'wix-events.v2';
2
3 async function getEventBySlug(slug, options) {
4 try {
5 const result = await wixEventsV2.getEventBySlug(slug, options);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13