Events API
The Events API allows you to manage events for users in your WeComplete application.
Base Url: https://api.wecompleteapp.com
POST https://api.wecompleteapp.com/api/users/user/:userId/events
Create a new event for a user
Example Request:
POST https://api.wecompleteapp.com/api/users/user/:userId/events
Headers:
Content-Type: application/json
Body:
{
"action": "create",
"title": "Team Meeting",
"description": "Quarterly review meeting",
"startDate": "2024-08-15",
"endDate": "2024-08-15",
"startTime": "14:00",
"endTime": "15:00",
"location": "Conference Room A",
"eventType": "meeting",
"importanceLevel": "High",
"notify": "15 minutes",
"participants": []
}Example Response:
{
"id": "jx710293njzzys2x463yvmhcan7965ae",
"userId": "m173c50cgd7qw8pcdhwks3e2xs795g5z",
"title": "Team Meeting",
"description": "Quarterly review meeting",
"startDate": "2024-08-15",
"endDate": "2024-08-15",
"startTime": "14:00",
"endTime": "15:00",
"location": "Conference Room A",
"eventType": "meeting",
"importanceLevel": "High",
"notify": "15 minutes",
"participants": []
}Notes:
- eventType must be one of: 'date', 'meeting', 'reminder', 'traveling', 'task', 'other'
- importanceLevel must be one of: 'Low', 'Medium', 'High'
- participants should be an array of user IDs
- action must be 'create' for creating new events
Errors:
- 400: Missing required fields or invalid action
- 404: User not found
- 500: Internal server error
GET https://api.wecompleteapp.com/api/users/user/:userId/events
Retrieve all events for a user
Example Request:
GET https://api.wecompleteapp.com/api/users/user/:userId/events
Headers:
Content-Type: application/json
Example Response:
[
{
"id": "jx710293njzzys2x463yvmhcan7965ae",
"userId": "m173c50cgd7qw8pcdhwks3e2xs795g5z",
"title": "Team Meeting",
"description": "Quarterly review meeting",
"startDate": "2024-08-15",
"endDate": "2024-08-15",
"startTime": "14:00",
"endTime": "15:00",
"location": "Conference Room A",
"eventType": "meeting",
"importanceLevel": "High",
"notify": "15 minutes",
"participants": []
}
]Notes:
- Returns an array of events for the specified user
- If no events exist, returns an empty array
Errors:
- 400: Missing user ID
- 404: User not found
- 500: Internal server error
GET https://api.wecompleteapp.com/api/users/user/:userId/events/:eventId
Retrieve a specific event by ID (includes partner events)
Example Request:
GET /api/users/user/:userId/events/:eventId
Headers:
Content-Type: application/json
Example Response:
{
"id": "jx710293njzzys2x463yvmhcan7965ae",
"userId": "m173c50cgd7qw8pcdhwks3e2xs795g5z",
"title": "Team Meeting",
"description": "Quarterly review meeting",
"startDate": "2024-08-15",
"endDate": "2024-08-15",
"startTime": "14:00",
"endTime": "15:00",
"location": "Conference Room A",
"eventType": "meeting",
"importanceLevel": "High",
"notify": "15 minutes",
"participants": [],
"isPartnerEvent": false
}Notes:
- Returns a single event object
- Event ID can belong to either the user or their partner
- isPartnerEvent flag indicates if the event belongs to the partner
- Automatically includes partner's events if they exist
Errors:
- 400: Missing user ID or event ID
- 404: Event not found
- 500: Internal server error
PUT https://api.wecompleteapp.com/api/users/user/:userId/events/:eventId
Update an existing event
Example Request:
PUT https://api.wecompleteapp.com/api/users/user/:userId/events/:eventId
Headers:
Content-Type: application/json
Body:
{
"title": "Updated Team Meeting",
"description": "Monthly review meeting",
"startTime": "15:00",
"endTime": "16:00",
"location": "Conference Room B"
}Example Response:
{
"id": "jx710293njzzys2x463yvmhcan7965ae",
"userId": "m173c50cgd7qw8pcdhwks3e2xs795g5z",
"title": "Updated Team Meeting",
"description": "Monthly review meeting",
"startDate": "2024-08-15",
"endDate": "2024-08-15",
"startTime": "15:00",
"endTime": "16:00",
"location": "Conference Room B",
"eventType": "meeting",
"importanceLevel": "High",
"notify": "15 minutes",
"participants": []
}Notes:
- Only include fields that need to be updated
- All fields are optional for updates
- Returns the complete updated event object
Errors:
- 400: Missing user ID, event ID, or invalid fields
- 404: Event not found
- 500: Internal server error
DELETE https://api.wecompleteapp.com/api/users/user/:userId/events/:eventId
Delete an event
Example Request:
DELETE https://api.wecompleteapp.com
/api/users/user/:userId/events/:eventId
Headers:
Content-Type: application/json
Example Response:
{
"success": true
}Notes:
- Event is permanently deleted and cannot be recovered
- Returns success: true if deletion was successful
Errors:
- 400: Missing user ID or event ID
- 404: Event not found
- 500: Internal server error
GET https://api.wecompleteapp.com/api/users/user/:userId/events/date-range
Retrieve events within a specific date range with detailed categorization
Example Request:
GET https://api.wecompleteapp.com/api/users/user/:userId/events/date-range?startDate=2024-08-01&endDate=2024-08-31
Headers:
Content-Type: application/jsonExample Response:
{
"dateRange": {
"requested": {
"startDate": "2024-08-01",
"endDate": "2024-08-31"
},
"actualCoverage": {
"start": "2024-08-15T00:00:00.000Z",
"end": "2024-08-30T00:00:00.000Z"
}
},
"summary": {
"totalEvents": 5,
"exactMatches": 2,
"dateCoverageDays": 16
},
"events": {
"exactMatches": {
"message": "2 exact match(es) found",
"data": [
{
"id": "jx710293njzzys2x463yvmhcan7965ae",
"startDate": "2024-08-15",
"endDate": "2024-08-15",
"title": "Team Meeting",
"eventType": "meeting"
},
{
"id": "k9d83jf72ncmx8s3hd92jf73ncmx9s4h",
"startDate": "2024-08-30",
"endDate": "2024-08-30",
"title": "Project Deadline",
"eventType": "reminder"
}
]
},
"otherRecents": {
"message": "3 recent event(s) found in your date range",
"data": [
{
"id": "b5d83jf72ncmx8s3hd92jf73ncmx9s4h",
"startDate": "2024-08-18",
"endDate": "2024-08-20",
"title": "Company Retreat",
"eventType": "other"
}
]
}
}Notes:
- Returns events in two categories: exact date matches and overlapping events
- Exact matches have identical start/end dates to the requested range
- Overlapping events include any that intersect with the date range
- Handles multi-day events that partially overlap with the range
- Empty arrays will be returned when no events exist in a category
- Date comparisons use inclusive ranges (<= and >=)
- Actual coverage shows the earliest and latest dates found in results
- Summary statistics help visualize the distribution of events
Errors:
- 400: Missing startDate or endDate parameters
- 400: Invalid date format
- 400: Start date after end date
- 404: User not found
- 500: Internal server error