This is a very simple Transposit application to demonstrate a few basic functions.
@calendarId
parameter to the email address associated with one of your calendars.get_calendar_events
operation. In the Results tab, you should see some calendar event data returned in JSON format.Now, go ahead and fork the app so you can make changes and customize it the way you'd like.
In your newly forked app, let's see how you can constrain the time range of calendar data returned, by specifying a timeMin
per the Google Calendar API. Suppose we want to see events that begin today onward, and we want to put them in a sensible order.
Take a look at the JavaScript operation today_date
, with the following code:
(params) => {
return {
today: new Date()
};
}
Run this JavaScript operation and observe the JSON result.
Next, return to the get_calendar_events
operation, and add three AND
clauses:
SELECT summary, start FROM google_calendar.get_calendar_events
WHERE calendarId=@calendarId
AND timeMin = (select today from this.today_date)
AND singleEvents=true
AND orderBy="startTime"
LIMIT 5
Run the operation, and the calendar entries now returned should start no later than today.
get_calendar_events
endpoint and set it to Deployed.Next, let's set it up so when users try your app, they can bring their own credentials and access their own data.
Click on Authentication > Production Keys, and enable the Require users to authenticate with these data connections checkbox for google_calendar
.
Click on Code > Page template to see the template for the hosted app page. Down around line 57 you'll see the operation get_calendar_events
called.
Load the live hosted app (find your app's URL at Deploy > Hosted Page) and once you've signed in and supplied Google Calendar credentials, you'll see your calendar events there.
Anyone you share your app with can then supply their own credentials and see their own data.