$ curl -X GET 'https://api.nylas.com/events?expand_recurring=true' -H 'Authorization: Bearer ACCESS_TOKEN'
[
{
'id': '5soti3r111c0f35dllc0iz2zb_20200317T170000Z',
'title': 'Weekly Machinery Sync',
'description': 'This is our weekly meeting to stay in sync on upcoming farming equipment!',
'when': {
'start_time': 1584464400,
'end_time': 1584465900,
'object': 'timespan'
},
"participants": [
{
"comment": null,
"email": "[email protected]",
"name": "George Washington Carver",
"status": "yes"
},
{
"comment": null,
"email": "[email protected]",
"name": "Henry Ford",
"status": "yes"
}
],
],
'calendar_id': '5idi2a6***',
'status': 'confirmed',
'master_event_id': '5soti3r111c0f35dllc0iz2zb',
'owner': ' [email protected]',
...
},
{
'id': '8dg2y9scccgacw519fd5iz89h_20200317T170000Z',
'when': {
'start_time': 1584550800,
'end_time': 1584552600,
'object': 'timespan'
},
"participants": [
{
"comment": null,
"email": "[email protected]",
"name": "George Washington Carver",
"status": "yes"
},
{
"comment": null,
"email": "[email protected]",
"name": "Henry Ford",
"status": "yes"
}
],
],
'calendar_id': '5idi2a6***',
'status': 'confirmed',
'master_event_id': '5soti3r111c0f35dllc0iz2zb',
'owner': '[email protected]',
...
},
{
'id': 'bjds9az3wmaizmd5eaq5q33lr_20200317T170000Z',
'when': {
'start_time': 1584637200,
'end_time': 1584639000,
'object': 'timespan'
},
"participants": [
{
"comment": null,
"email": "[email protected]",
"name": "George Washington Carver",
"status": "yes"
},
{
"comment": null,
"email": "[email protected]",
"name": "Henry Ford",
"status": "yes"
}
],
],
'calendar_id': '5idi2a6***',
'status': 'confirmed',
'master_event_id': '5soti3r111c0f35dllc0iz2zb',
'owner': ' [email protected]',
...
}
]
Note: The returned JSON in this example has been abbreviated for easier reading.
The Nylas Calendar API Reduces Complexity
You might be asking yourself whether to build a direct integration with Exchange Web Services or with Nylas. The Nylas ROI calculator estimates that a direct integration with Exchange for Calendar data and functionality would take you 13,812 hours to build, but would only take 18 days for a single developer to implement the same thing with Nylas. Let’s take a look at some specific examples of how Nylas abstracts away the complexity of building your Exchange Calendar integration.
Events as First Class Objects
EWS requires you to know which calendar an event exists on before you can request it. This isn’t a problem if you only need to access events from a single calendar, but it quickly becomes problematic when you need to manage events across multiple user or shared calendars, and you might be forced to sync a large amount of information from EWS to get the data you need.
With the Nylas Calendar API, events are first class objects, meaning you can access them without prior knowledge of the calendar they are contained in. If you need to search for events on a specific calendar, you can pass calendar_id={id} as a query parameter to the /events endpoint. Here’s what this looks like with our Python SDK.
from nylas import APIClient
nylas = APIClient(
CLIENT_ID,
CLIENT_SECRET,
ACCESS_TOKEN
)
# Return all of the events a user has across all of their calendars
all_events = nylas.events.all()
# Return events only for a specific calendar
my_calendar_events = nylas.events.where(calendar_id='{id}')
Additionally, if you build directly with EWS, you need to manage recurring events by making exceptions in the master event. When you use Nylas to modify recurring events, you can treat each individual occurrence of the event like any other normal event; the Nylas Sync Engine handles the complex task of making modifications to the master event to ensure all changes are reflected in the user’s calendars.
One Event to Rule Them All
EWS has two representations of events, meetings and appointments, that each have their own methods and properties that need to be considered related to schedule availability and notifications. Nylas abstracts away this complexity and presents all events in a single, predictable manner that makes it extremely easy to do things like create events and invite participants. Here’s an example of this using our Python SDK:
from nylas import APIClient
nylas = APIClient(
CLIENT_ID,
CLIENT_SECRET,
ACCESS_TOKEN
)
event = nylas.events.create()
event.title = "Learn about our new filament improvements"
event.description = "Let's talk about the recent changes to our filament technology"
event.busy = True
# Provide the appropriate id for a calendar to add the event to a specific calendar
event.calendar_id='{id}'
# Participants are added as a list of dictionary objects
# email is required, name is optional
event.participants = [
{
"name": "Thomas Alva Edison",
'email': '[email protected]'
},
{
"name": "Susan Seller",
'email': 'susan@your_company.com'
}
]
event.when = {"start_time": 1577829600, "end_time": 1577840400}
# notify_participants='true' will send a notification email to
# all email addresses specified in the participant subobject
event.save(notify_participants='true')
Nylas Provides A Modern, RESTful Interface
Exchange Web Services is only available via a SOAP API or with their C# client library called the EWS Managed API. Nylas, on the other hand, provides a REST API that returns data in a predictable JSON format that makes it much easier to manage calendar data and functionality. Additionally, Nylas provides SDKs for Java, Python, Node.js, and Ruby to suit your needs.
Take Your Calendar Integration Further With Nylas
Why Stop with Exchange Calendars? Nylas supports 100% of email, calendar, and contacts providers out of the box, enabling your users to keep using their calendar provider of choice. This post has only covered a fraction of the benefits the Nylas Platform provides, let’s take a look at a few of the other reason why you should build your calendar integration with Nylas.
- The Nylas scheduler allows you to incorporate full-featured scheduling into your app in 5 minutes.
- The Nylas Email API and Contacts API allows you to turn your app into a scheduling powerhouse.
- Learn how to use Nylas to parse calendar and contacts data and improve user engagement.
- Use the Nylas Calendar API to streamline user scheduling.