Dynamic includes
On most resources, you can dynamically include related objects (aka. expand objects). E.g. for a resource you can include the resource' calendars in the response by adding ?include=calendars to the URL.
You may also supply multiple objects that you want to fetch by separating them with commas, e.g.
?include=calendars,accounts
What is available where will be listed under each endpoint.
So running this:
curlcurl \
-H 'Timekit-App: back-to-the-future' \
-u doc.brown@timekit.io:nvHfRSlhvsnlg4rS7Wt28Ty47qdgegwSu3YK7hPW \
https://api.timekit.io/v2/resources/me?include=calendars
Will return:
json{
"data": {
"activated": true,
"calendars": [
{
"backgroundcolor": "#FFFFFF",
"description": "Doc. Browns calendar",
"foregroundcolor": "#000000",
"name": "Doc",
"system": false
}
],
"email": "doc.brown@timekit.io",
"first_name": "Dr. Emmett",
"img": "http://www.gravatar.com/avatar/7a613e5348d63476276935025",
"last_name": "Brown",
"last_sync": null,
"name": "Dr. Emmett Brown",
"timezone": "America/Los_Angeles",
"token": "UZpl3v3PTP1PRwqIrU0DSVpbJkNKl5gN"
}
}
You can include data in nested layers, so if you include calendars then you can include events also (since events are nested under calendars). You do that by using the dot annotation, so ?include=calendars.events, will return you calendars including their events.
So running this:
curlcurl \
-H 'Timekit-App: back-to-the-future' \
-u doc.brown@timekit.io:nvHfRSlhvsnlg4rS7Wt28Ty47qdgegwSu3YK7hPW \
https://api.timekit.io/v2/resources/me?include=calendars.events
Will return:
json{
"data": {
"activated": true,
"calendars": [
{
"backgroundcolor": "#FFFFFF",
"description": "Doc. Browns calendar",
"events": [
{
"id": "892d7425-ea2d-4d7d-a74e-e69fad7813cc",
"what": "Update",
"where": "Skype",
"rsvp": "needsAction",
"allDay": false,
"start": "2014-10-14T14:30:00+00:00",
"end": "2014-10-14T15:30:00+00:00",
"description": "Update about the FluxCapacitator"
},
{
"id": "4b08a047-3133-41f1-83e1-27cb933d8dbb",
"what": "Strategy Meeting",
"where": "1355 Market st, San Francisco, CA",
"rsvp": "accepted",
"allDay": false,
"start": "2014-10-14T10:00:00+00:00",
"end": "2014-10-14T12:00:00+00:00",
"description": "How to make a timemachine"
},
],
"foregroundcolor": "#000000",
"name": "Doc",
"system": false
}
],
"email": "doc.brown@timekit.io",
"first_name": "Dr. Emmett",
"img": "http://www.gravatar.com/avatar/7a613e5348d63476276935025",
"last_name": "Brown",
"last_sync": null,
"name": "Dr. Emmett Brown",
"timezone": "America/Los_Angeles",
"token": "UZpl3v3PTP1PRwqIrU0DSVpbJkNKl5gN"
}
}