Google Calendar API: how to access X-APPLE-TRAVEL-DURATION - calendar

When accessing as .ics my (Google) calendar contains Apple Calendar travel information:
X-APPLE-TRAVEL-DURATION;VALUE=DURATION:PT45M
(full example here)
How do I retrieve this information using the Google Calendar API?
When listing the events this information is not included.
E.g.
{
"kind": "calendar#event",
"etag": "\"...\"",
"id": "...",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=...",
"created": "2016-05-29T11:45:53.000Z",
"updated": "2016-05-29T11:45:53.530Z",
"summary": "test apple travel",
"creator": {
"email": "john#doe.com",
"displayName": "John Doe",
"self": true
},
"organizer": {
"email": "john#doe.com",
"displayName": "John Doe",
"self": true
},
"start": {
"dateTime": "2016-05-30T13:00:00+02:00"
},
"end": {
"dateTime": "2016-05-30T13:30:00+02:00"
},
"iCalUID": "...",
"sequence": 0,
"hangoutLink": "...",
"reminders": {
"useDefault": true
}
}

Related

How to Break json object in a for each

How can one split the below json example by different email in a for each loop? So the end result is two completely separate entities keeping there own objects and arrays.
This result comes from a sql dump but the sql connector alters the output, so I've had to parse that output in a for each loop of its own even though there is no loop it's all in one line.
[
{
"Email": "Steve#gmail.com",
"Name": "Steve Larson",
"ID": "1111",
"Date": "2022-09-12",
"Address": "10 Chicken Place",
"Town": "Gatebody",
"Postcode": "xxx 1xx",
"Data": [
{
"Ref": "34546",
"Transaction_Date": "2018-11-29",
"Amount": 27.76,
"Balance": 27.76,
"Notes": "Beep1"
},
{
"Ref": "34546v2",
"Transaction_Date": "2018-12-24",
"Amount": 27.76,
"Balance": 27.76,
"Notes": "Beep2"
}
]
},
{
"Email": "innis#gmail.com",
"Name": "Innis Blitz",
"ID": "3456",
"Date": "2022-10-12",
"Address": "33 Snake Road",
"Town": "March",
"Postcode": "cxc 3cd",
"Data": [
{
"Ref": "078776701",
"Transaction_Date": "2021-08-27",
"Amount": 984.68,
"Balance": 984.68,
"Notes": "Yes please"
},
{
"Ref": "078776701v2",
"Transaction_Date": "2021-08-27",
"Amount": 98422.6,
"Balance": 98432.6,
"Notes": "Please not now"
}
]
}
]
Would like to do a for each so it splits the above like so. The idea then for my to load the result of the for each into a template that takes arrays.
{
"Email": "Steve#gmail.com",
"Name": "Steve Larson",
"ID": "1111",
"Date": "2022-09-12",
"Address": "10 Chicken Place",
"Town": "Gatebody",
"Postcode": "xxx 1xx",
"Data": [
{
"Ref": "34546",
"Transaction_Date": "2018-11-29",
"Amount": 27.76,
"Balance": 27.76,
"Notes": "Beep1"
},
{
"Ref": "34546v2",
"Transaction_Date": "2018-12-24",
"Amount": 27.76,
"Balance": 27.76,
"Notes": "Beep2"
}
]
}
{
"Email": "innis#gmail.com",
"Name": "Innis Blitz",
"ID": "3456",
"Date": "2022-10-12",
"Address": "33 Snake Road",
"Town": "March",
"Postcode": "cxc 3cd",
"Data": [
{
"Ref": "078776701",
"Transaction_Date": "2021-08-27",
"Amount": 984.68,
"Balance": 984.68,
"Notes": "Yes please"
},
{
"Ref": "078776701v2",
"Transaction_Date": "2021-08-27",
"Amount": 98422.6,
"Balance": 98432.6,
"Notes": "Please not now"
}
]
}
I have reproduced in my environment and got expected results and I followed below process:
I have initialized your input as below:
Then i added for each control and send the output of previous step as input as inside of foreach loop, i have added send email action.
Outputs:
I have got tow jsons in two seperate emails as above.

Invalid response from webhook: Failed to translate JSON to ExecuteHttpResponse

I have a webhook from my google assistant new actions builder platform. Webhook code is written in the dotnet vs2019. I have followed the webhook request and response format and sample jsons provided in the below links.
https://developers.google.com/assistant/conversational/reference/rest/v1/TopLevel/fulfill#User
https://developers.google.com/assistant/conversational/webhooks#request-json_1
But when I test assistant action, it is failing. Below is request and response json from logs in the google assistant test simulator.Error message just says"Invalid response from webhook: Failed to translate JSON to ExecuteHttpResponse." I don't know why it is not valid. Can someone help me resolving this.
{
"requestJson": {
"handler": {
"name": "agentcube"
},
"intent": {
"name": "",
"params": {
"phone": {
"original": "1234562869",
"resolved": 1234562869
}
},
"query": "1234562869"
},
"scene": {
"name": "Start",
"slotFillingStatus": "FINAL",
"slots": {
"Zip": {
"mode": "REQUIRED",
"status": "SLOT_UNSPECIFIED",
"updated": false,
"value": 37122
},
"Phone": {
"mode": "REQUIRED",
"status": "SLOT_UNSPECIFIED",
"updated": true,
"value": 1234562869
},
"FName": {
"mode": "REQUIRED",
"status": "SLOT_UNSPECIFIED",
"updated": false,
"value": "john doe"
}
},
"next": {
"name": "actions.scene.END_CONVERSATION"
}
},
"session": {
"id": "ABwppHFkFuGBF-UawPmIkxWpkfM1Hb5An7h8KnjR302zukmBoKA1NqDp7DfePGzYsyxT5oy--wg5Jkjj",
"params": {
"Phone": 1234562869,
"FName": "john doe",
"Zip": 37122
},
"typeOverrides": [],
"languageCode": ""
},
"user": {
"locale": "en-US",
"params": {},
"accountLinkingStatus": "NOT_LINKED",
"verificationStatus": "VERIFIED",
"packageEntitlements": [],
"gaiamint": "",
"permissions": [],
"lastSeenTime": "2021-01-28T19:21:28Z"
},
"home": {
"params": {}
},
"device": {
"capabilities": [
"SPEECH",
"RICH_RESPONSE",
"LONG_FORM_AUDIO"
]
}
}
}
Invalid response from webhook: Failed to translate JSON to ExecuteHttpResponse..
{
"responseJson": {
"Session": {
"Id": "ABwppHFkFuGBF-UawPmIkxWpkfM1Hb5An7h8KnjR302zukmBoKA1NqDp7DfePGzYsyxT5oy--wg5Jkjj",
"Params": {
"Phone": 1234562869,
"Zip": 37122,
"FName": "john doe"
}
},
"Prompt": {
"Override": false,
"FirstSimple": {
"Speech": "My webhook response",
"Text": "My response from webhook"
}
},
"Scene": {
"Name": "Start",
"SlotFillingStatus": "FINAL",
"Slots": {
"Phone": {
"Mode": "REQUIRED",
"Status": "SLOT_UNSPECIFIED",
"Updated": true,
"value": 1234562869
},
"FName": {
"Mode": "REQUIRED",
"Status": "SLOT_UNSPECIFIED",
"Updated": false,
"value": "john doe"
},
"Zip": {
"Mode": "REQUIRED",
"Status": "SLOT_UNSPECIFIED",
"Updated": false,
"value": 37122
}
},
"Next": {
"Name": "actions.scene.END_CONVERSATION"
}
}
}
}
Make sure the response that you code is returning is json by checking with a linter, which this seems to checks (i.e. everything inside the ResponseJson {}
Please see my response to a similar issue at https://stackoverflow.com/a/66512370/10537202 to use the webhook playground.

How to create event by MS Graph with room as location?

I'm trying to create an event by MS Graph to Calendar with room that have been set in my outlook account.
But the problem is that the room can't be booked without adding the room as attendees.
If I only add the room as location, the Calendar in the room account won't be notified and booked.
{
"subject": "Let's go picnicking",
"body": {
"contentType": "HTML",
"content": "Does late morning work for you?"
},
"start": {
"dateTime": "2018-03-20T12:00:00",
"timeZone": "Pacific Standard Time"
},
"end": {
"dateTime": "2018-03-20T14:00:00",
"timeZone": "Pacific Standard Time"
},
"location":{
"coordinates": {"#odata.type": "microsoft.graph.outlookGeoCoordinates"},
"displayName":"RM.Papaya",
"locationType": "conferenceRoom",
"address": {"#odata.type": "microsoft.graph.physicalAddress"}
},
"locations": [
{
"displayName": "RM.Papaya",
"locationType": "conferenceRoom"
}
],
"attendees": [
{
"emailAddress": {
"address":"Matthew_Liao#Ginaworks.onmicrosoft.com",
"name": "Matthew Liao"
},
"type": "required"
}
]
}
However, if I add the room also as location and attendees, the Calendar in the room account will be notified, but the display of location is only a text unconnected with the room account.
{
"subject": "Let's go picnicking",
"body": {
"contentType": "HTML",
"content": "Does late morning work for you?"
},
"start": {
"dateTime": "2018-03-20T12:00:00",
"timeZone": "Pacific Standard Time"
},
"end": {
"dateTime": "2018-03-20T14:00:00",
"timeZone": "Pacific Standard Time"
},
"location":{
"displayName":"RM.Papaya",
"locationType": "conferenceRoom",
"address": {"#odata.type": "microsoft.graph.physicalAddress"}
},
"locations": [
{
"displayName": "RM.Papaya",
"locationType": "conferenceRoom"
}
],
"attendees": [
{
"emailAddress": {
"address":"Matthew_Liao#Ginaworks.onmicrosoft.com",
"name": "Matthew Liao"
},
"type": "required"
},
{
"emailAddress": {
"address":"rm.papaya#Ginaworks.onmicrosoft.com",
"name": "RM.Papaya"
},
"type": "required"
}
]
}
Is that reasonable or logical?
Or did I make any mistake in my code?
Thanks for helping.
The display issue is a limitation of the API. This is something we hope to fix, but I can't hazard a guess when that might happen.

Json schema for array of objects doesn't validate

I have this schema for a json response
{
"title": "Products",
"description": "schema for products",
"type": "array",
"properties": {
"id": {
"description": "id of a product",
"type": "integer"
},
"name": {
"description": "name of the product",
"type": "string"
},
"created_at": {
"description": "record created_at",
"type": "string",
"format": "date-time"
},
"updated_at": {
"description": "record updated_at",
"type": "string",
"format": "date-time"
}
},
"required": ["id", "name"]
}
and I want to match this schema with this json
[{
"id": 1,
"name": "Cricket Ball"
}, {
"id": 2,
"name": "Soccer Ball"
}, {
"id": 3,
"name": "football ball"
}, {
"id": 4,
"name": "Basketball ball"
}, {
"id": 5,
"name": "Table Tennis ball"
}, {
"id": 6,
"name": "Tennis ball"
}]
This schema matches the response but it also matches the schema in which the required field is this
"required": ["ids", "names"]
I think the schema is validated against the array and the objects in the array are not validated.
The way you have it set up now, your properties key refers to the array itself, not to each item, and is being ignored (because arrays don't have properties, they just have items). You need to use the items key to validate each item in the array, like so:
{
"title": "Products",
"description": "schema for products",
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"description": "id of a product",
"type": "integer"
},
"name": {
"description": "name of the product",
"type": "string"
},
"created_at": {
"description": "record created_at",
"type": "string",
"format": "date-time"
},
"updated_at": {
"description": "record updated_at",
"type": "string",
"format": "date-time"
}
},
"required": ["id", "name"]
}
}
try map
new_array = response.map{ |k| { 'id': k['properties']['id']['description'], 'name': k['properties']['name']['description'] } }

Google Glass Timeline Item with NAVIGATE action is not showing up on Glass device

Why doesn't a timeline item with this payload offer the turn by turn navigation options from Google Glass, is there a bug ? If the answer is because it needs more properties set that sucks to make us call another endpoint.
{
"kind": "mirror#timelineItem",
"id": "035cb808-a908-4057-914f-f980fb35c620",
"bundleId": "12",
"created": "2013-08-21T22:52:54.635Z",
"updated": "2013-08-21T22:52:54.635Z",
"etag": "\"hzfI85yu0lKQdtWV4PO1jAbQxWw/UvNo_kKkfbIjHfhmNjOLyMSNIeA\"",
"creator": {
"kind": "mirror#contact",
"source": "api:34091916267",
"id": "70",
"displayName": "Monica Wilkinson"
},
"title": "glass-4",
"text": "...",
"html": "....",
"speakableText": "...",
"location": {
"kind": "mirror#location",
"latitude": 37.7657774,
"longitude": -122.4075774,
"displayName": "Crushpath Labs"
},
"menuItems": [
{
"action": "NAVIGATE"
}
]
}
Try this:
"location": {
"latitude": 37.7657774,
"longitude": -122.4075774,
"accuracy": 36.0
},
It works for me.

Resources