REST API
REST API#
Access event data programmatically through the WordPress REST API. Build custom integrations, mobile apps, or external displays.
Overview#
The API provides endpoints for:
- Events (CRUD)
- Venues (CRUD)
- Organizers (CRUD)
- Speakers (CRUD)
- Attendees (Read, Check-in)
- Calendar data
Base URL#
All endpoints use the base:
https://yoursite.com/wp-json/emwc/v1/
Authentication#
Public endpoints#
These endpoints work without authentication:
- GET events (published only)
- GET venues
- GET organizers
- GET speakers
- GET calendar
Protected endpoints#
These require authentication:
- POST, PUT, DELETE operations
- GET attendees
- Check-in operations
Authentication methods#
Application Passwords (Recommended)
- Go to Users > Profile
- Scroll to Application Passwords
- Create a new password
- Use with HTTP Basic Auth
curl -u username:application_password https://yoursite.com/wp-json/emwc/v1/events
Cookie Authentication For logged-in requests from JavaScript on your site. Include nonce in requests.
OAuth Use a plugin like WP OAuth Server for OAuth authentication.
Events endpoints#
List events#
GET /wp-json/emwc/v1/events
Parameters
| Parameter | Type | Description |
|---|---|---|
per_page | int | Results per page (default: 10, max: 100) |
page | int | Page number |
status | string | Event status filter |
type | string | Event type filter |
category | int | Category ID |
after | string | Events after date (ISO 8601) |
before | string | Events before date (ISO 8601) |
search | string | Search term |
Example
curl https://yoursite.com/wp-json/emwc/v1/events?per_page=5&status=scheduled
Response
[
{
"id": 123,
"title": "Tech Conference 2025",
"description": "Annual technology conference...",
"start_date": "2025-03-15",
"start_time": "09:00",
"end_date": "2025-03-15",
"end_time": "17:00",
"status": "scheduled",
"type": "in-person",
"venue": {
"id": 45,
"name": "Convention Center"
},
"organizer": {
"id": 12,
"name": "Tech Events Inc"
},
"capacity": 500,
"registered": 234,
"link": "https://yoursite.com/events/tech-conference-2025/"
}
]
Get single event#
GET /wp-json/emwc/v1/events/{id}
Create event#
POST /wp-json/emwc/v1/events
Body
{
"title": "New Workshop",
"description": "Workshop description here",
"start_date": "2025-04-01",
"start_time": "14:00",
"end_date": "2025-04-01",
"end_time": "16:00",
"status": "scheduled",
"type": "in-person",
"venue_id": 45,
"organizer_id": 12,
"capacity": 30
}
Update event#
PUT /wp-json/emwc/v1/events/{id}
Delete event#
DELETE /wp-json/emwc/v1/events/{id}
Venues endpoints#
List venues#
GET /wp-json/emwc/v1/venues
Get single venue#
GET /wp-json/emwc/v1/venues/{id}
Create venue#
POST /wp-json/emwc/v1/venues
Body
{
"name": "Downtown Hall",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US",
"capacity": 200
}
Update venue#
PUT /wp-json/emwc/v1/venues/{id}
Delete venue#
DELETE /wp-json/emwc/v1/venues/{id}
Organizers endpoints#
List organizers#
GET /wp-json/emwc/v1/organizers
Get single organizer#
GET /wp-json/emwc/v1/organizers/{id}
Create organizer#
POST /wp-json/emwc/v1/organizers
Update organizer#
PUT /wp-json/emwc/v1/organizers/{id}
Delete organizer#
DELETE /wp-json/emwc/v1/organizers/{id}
Attendees endpoints#
List attendees#
GET /wp-json/emwc/v1/attendees
Parameters
| Parameter | Type | Description |
|---|---|---|
event_id | int | Filter by event |
status | string | Filter by status |
search | string | Search name/email |
Requires authentication.
Get single attendee#
GET /wp-json/emwc/v1/attendees/{id}
Requires authentication.
Check-in endpoint#
Check in attendee#
POST /wp-json/emwc/v1/checkin
Body
{
"ticket_code": "EMWC-ABC123DEF"
}
Response
{
"success": true,
"message": "Check-in successful",
"attendee": {
"id": 456,
"name": "John Doe",
"email": "john@example.com",
"event": "Tech Conference 2025",
"checked_in_at": "2025-03-15T09:15:00"
}
}
Error Response
{
"success": false,
"message": "Invalid ticket code"
}
Requires authentication.
Calendar endpoint#
Get calendar data#
GET /wp-json/emwc/v1/calendar
Parameters
| Parameter | Type | Description |
|---|---|---|
year | int | Year (default: current) |
month | int | Month (default: current) |
category | int | Category ID filter |
Response
{
"year": 2025,
"month": 3,
"events": [
{
"id": 123,
"title": "Tech Conference",
"date": "2025-03-15",
"time": "09:00",
"link": "https://..."
}
]
}
Error handling#
Error response format#
{
"code": "error_code",
"message": "Human readable message",
"data": {
"status": 400
}
}
Common error codes#
| Code | Status | Description |
|---|---|---|
rest_forbidden | 403 | Authentication required |
rest_not_found | 404 | Resource not found |
rest_invalid_param | 400 | Invalid parameter |
rest_cannot_create | 403 | Cannot create resource |
Rate limiting#
The API does not impose rate limits by default. Use a caching plugin or CDN for high-traffic APIs.
Examples#
JavaScript fetch#
// Get upcoming events
fetch("https://yoursite.com/wp-json/emwc/v1/events?status=scheduled")
.then((response) => response.json())
.then((events) => console.log(events));
PHP with wp_remote_get#
$response = wp_remote_get( 'https://yoursite.com/wp-json/emwc/v1/events' );
$events = json_decode( wp_remote_retrieve_body( $response ) );
cURL#
curl -X POST \
-H "Content-Type: application/json" \
-u admin:application_password \
-d '{"ticket_code":"EMWC-ABC123DEF"}' \
https://yoursite.com/wp-json/emwc/v1/checkin
Extending the API#
Custom endpoints#
Add your own endpoints:
add_action( 'rest_api_init', function() {
register_rest_route( 'emwc/v1', '/custom', array(
'methods' => 'GET',
'callback' => 'my_custom_endpoint',
'permission_callback' => '__return_true',
) );
} );
Modifying responses#
Filter event data in responses:
add_filter( 'emwc_rest_event_response', function( $data, $event ) {
$data['custom_field'] = get_post_meta( $event->ID, 'custom_field', true );
return $data;
}, 10, 2 );