MEC Restful API
Base URL
The base URL is different per website but the general pattern is like the following.
http://example.com/wp-json/mec/v1.0
API Key
The API key is required for all the following commands. You should send the API key in headers with the name of mec-token If you don’t send mec-token in headers then you will receive an invalid_api_token error.
All Events
GET /events/
This is a public command, it means all users with an API key can run it.
Request
Send the following parameters as JSON.
Name | Type | Accepted Values | Example |
limit | integer | 12 | |
order | string | ASC / DESC | ASC |
offset | integer | 0 | |
start | string | today / date / tomorrow / yesterday/ start_last_month / start_current_month / start_next_month | date |
start_date | string | (yyyy-mm-dd) | 2024-12-15 |
show_only_past_events | integer | 0,1 | 0 |
include_past_events | integer | 0,1 | 0 |
show_only_ongoing_events | integer | 0,1 | 0 |
include_ongoing_events | integer | 0,1 | 0 |
Response
You will receive all events in the events key of the response. Events are categorized based on their start date so you can utilize that to display the events in any format you need like list view, monthly calendar view, weekly timetable view or anything else.
You can also use the pagination key of the response to read all events page by page. Just send the next_date value as start_date of your next request and send next_offset as the value of the offset parameter.
{
"events": {
"2025-01-15": [{ ... }],
...
},
"pagination": {
"next_date": "2025-12-15",
"next_offset": 1,
"has_more_events": true,
"found": 12
}
}
Single Event
GET /events/{id}
This is a public command, it means all users with an API key can run it.
Request
Send the following parameters as a query string.
Name | Type | Example |
id * | integer | 1 |
occurrence | integer | 1747335600 |
Response
You will receive a bunch of information included but not limited to the following. The data key has many useful information about the event that you can use in your application. The dates key has upcoming dates of the event. You can send the start timestamp value that you can see as an occurrence value in the query string to move forward in the time. Also the date key holds information about the current occurrence.
{
"ID": 1,
"data": { ... },
"dates": [{
"start": {
"date": "2025-05-15",
"hour": 7,
"minutes": "0",
"ampm": "PM",
"timestamp": 1747335600
},
"end": {
"date": "2025-05-15",
"hour": 11,
"minutes": "0",
"ampm": "PM",
"timestamp": 1747350000
},
"allday": "0",
"hide_time": "0",
"past": 0
}],
"date": {}
}
Login
POST /login
Request
Send the following parameters as regular-form data.
Name | Type | Example |
username * | string | user |
password * | string | 12345678 |
Response
Use the token to authorize users in other commands. You should send it as a new header named user-token for those commands that require authentication like my-events or trash events commands.
{
"success": 1,
"id": 1,
"token": "W2X53XpClol8TquAIKWaZo0j68L0tuho3o4wmwD0"
}
My Events
GET /my-events
Users must be authenticated for this command. Both mec-token and user-token should be included in the headers.
Request
Send the following parameters as JSON.
Name | Type | Example |
limit * | integer | 12 |
pages * | integer | 1 |
Response
You can loop through the events to display all events. Use the pagination data to navigate through the pages of events.
{
"events": [
{
"id": 2645,
"title": "Monthly",
"url": "http://example.com/events/monthly/",
"status": "publish"
}
],
"pagination": {
"current_page": 2,
"total_pages": 5
}
}
Trash Event
DELETE /events/{id}/trash
Users must be authenticated for this command. Both mec-token and user-token should be included in the headers.
Request
None.
Response
If the command was successful you will receive the following response otherwise an error object with proper http code will be returned.
{
"success": 1
}
Delete Event
DELETE /events/{id}
Users must be authenticated for this command. Both mec-token and user-token should be included in the headers.
This command will force delete an event. It doesn’t matter if the event is already trashed or not.
Request
None.
Response
If the command was successful you will receive the following response otherwise an error object with proper http code will be returned.
{
"success": 1
}
Report Out Dated Content
If you think the content of this page does not reflect updated information, please let us know.