how do I get calendar_id from Google Calendar API - ruby

I know you can get it on the settings page.
I have multiple calendars on a single account.
I can get the names back with
service.list_calendar_lists(page_token: page_token)
but how do I can the calendar ids associated with the names of the calendars

The structure that's returned from service.list_calendar_lists is a JSON that has an entry items
items is an array of calendar list items, and each array element includes id which is what you're asking for.
So something like
array_of_ids = service.list_calendar_lists(page_token: page_token)['items']map{|i| i['id']}

You can use CalendarList() with a GET request as shown in the Google Calendar API here. I tested this by retrieving my own calendar id by passing in the "primary" keyword as described in the documentation linked above.

Related

Google Reports API for Meet attendance - strange conference_id

I'm trying to query attendance for a Google Meet conference created via Google Calendars API.
I've found that the conferenceId returned by Calendar API > Events > insert it's different from the one I can use to filter in Reports API.
conferenceId from Calendar API --> ["conferenceId"]=>string(12) "xxx-xxxx-xxx"
conferenceId from Reports API{"name": "conference_id", "value": "xxxxxxx_12234XXXXXxxxxXX56"}
Does anyone knows why?
How can I query attendance based on the data returned by Calendar API > Events > insert ?
Steps to reprocuduce:
Insert calendar events (be sure to add conferenceData structure to create also the Meet conference):
https://developers.google.com/calendar/api/v3/reference/events/insert
Use the conference
List activities from Report API and check the conference_id: https://developers.google.com/admin-sdk/reports/reference/rest/v1/activities/list
It seems that the conferenceId from the Calendar event object is different from the conference_id in the Reports (note that the name is different). The activities.list output also has another field called meeting_code, it's also under items.events.parameters:
{
"name": "meeting_code",
"value": "ASDFASFFGJ"
}
This one matches the conferenceId in a calendar event, except that it's without dashes and capitalized, so for the example "conferenceId": "asd-fasf-fgj" in a Calendar Event object you'll find "meeting_code": "ASDFASFFGJ" in the activity reports. So you can just remove the dashes and capitalize the conferenceId to match it to its corresponding meeting_code.
As to why this discrepancy exists, my guess after reading the definition of the Meet activity events is that it tracks different "conference sessions" within the same meeting code. For example, if you join the meeting asd-fasf-fgj it will create a new conference_id until everyone leaves the meeting. Then if the same meeting code is used again a different conference_id will be created to track the new session and so on.
I did some cursory testing and the logs do create a different conference_id every time I joined the same Meeting code. I didn't have multiple accounts to test so I'm not sure if two users can have matching IDs, but I may be close. I couldn't find any in-depth documentation so it would require more testing to figure out exactly how it works.
Either way, to address your immediate concern, you should be able to match the Event's conferenceId with the Report's meeting_code to track the attendance.
Reference:
Meet Activity log definition

Mailchimp API - Method to get list of campaigns per user

I am using the Mailchimp API to collect info about list members (per email), and campaigns. However, I am not seeing a method to collect a list of campaigns that were sent to a specific email/list member.
Am I missing something?
First get list of all campains. And in loop of campains, and check if user exists in list. mailchimp provide api ti check if user contains in list.

Can I populate multiple fields in my Podio app using Email to App?

I've been trying to populate a Podio app using Email to App.
However, the problem is that the app only takes 3 blocks of data from an email submission: the subject, the sender, and the body. This would be sufficient if I had two fields of data to populate. However, I have 10 fields of data to populate in the app.
How can I send an email with the 10 fields of data and populate an app entry?
This article from 2010 is the only thing Podio says about this feature and yet it is not working for me. I have tried sending an email with
name:my name
location: my location
car: my car
...
in the body, and the Podio app simply places the entirety of the email in each field.
You cannot populate multiple fields with Email to App feature in Podio. To handle. Use Podio API for advanced use cases.
Populating multiple fields to Podio still works as descibed in https://help.podio.com/hc/en-us/articles/201019648-Email-to-app.
Email to item configuration:
Example email text:
Resulted item created:
If you are just looking to populate the data.
You could put the 10 items into the email body and send them as formatted text into Podio.
If you have dynamic data, you could achieve this by e.g. iterating through an array.
Other than that you have to use the API.
The method in the post you link to is correct and works.
In the email the format:
fieldname: content
.. gets mapped with "content" being put into the item's field with the name "fieldname". Use the field mapping user interface if you want to choose which fieldname:-label from the email maps to which field in the Podio item.

google calendar api: calendars vs calendarList

I was messing around trying to add a new calendar and it took me quite a while to figure out that I had to add it to 'Calendars' and not to 'CalendarList'. It works now, which is nice, but I what is the difference between the two concepts? It seems to me I only need Calendars? Also, CalendarList doesn't seem to work, trying to insert a Calendar returned a 404 error.
Calendars is a collection of all calendars in the world (it does not have a list method). When creating a new calendar, you should call an insert on the calendars collection. When you want calendar specific data (such as the timezone, the name) then you should retrieve a calendar from calendars collection using get.
CalendarLists is a collection of all calendar entries that a user added to their list (in the web UI it's the list of calendars in the left panel). You cannot create a new calendar through the calendar list collection but you can add an existing calendar to the list of your users calendars. Each user can for example have a different color for the same calendar and this detail will be stored in the calendar list entries.
What is sometimes confusing is that when you create a new calendar through calendars collection, it will be automatically added to your list.
Let me give you an example of how Calendars and CalendarLists work. Imagine your friend creates a calendar for a trip that you will be going on together. He does so by doing a Calendars.insert() call.
Now he makes the calendar public (via ACLs collection) and sends you and all the friends an email of this calendar. You can go into the CalendarLists collection and do an insert() call there to add it into your list of calendars and make it blue.
Calendars:
The Calendars collection represents all existing calendars. It can be
used to create and delete calendars. You can also retrieve or set
global properties shared across all users with access to a calendar.
For example, a calendar's title and default time zone are global
properties.
CalendarList:
The CalendarList is a collection of all calendar entries that a user
has added to their list (shown in the left panel of the web UI). You
can use it to add and remove existing calendars to/from the users’
list. You also use it to retrieve and set the values of user-specific
calendar properties, such as default reminders. Another example is
foreground color, since different users can have different colors set
for the same calendar.
Here the comparison table:
https://developers.google.com/google-apps/calendar/concepts/events-calendars

Google portable contacts api sort order not working

I am using this path to grab contacts from google after user is oauth2 authenticated.
path =
"http://www-opensocial.googleusercontent.com/api/people/#me/#all/?count=500&fields=name,displayName,emails&sortBy=name"
Strangely the sortBy name is not working.
It gives:
First a list of unordered contacts with no order.
Then it gives contacts with name in alphabetical order.
I want all contact names sorted by alphabetical order.
What is the work around for this problem ?
A quick reply will be appreciated.
It's a google bug.
Check my discussion with Jospeh Smarr google opensocial apis lead.
http://groups.google.com/group/portablecontacts/browse_thread/thread/1a3e2d8f5b437e7c?pli=1

Resources