Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Chilkat2-Python) Google Calendar -- Generate Event JSONSee more Google Calendar ExamplesDemonstrates how to generate the JSON for an event resource. This code can be used as a template for generating JSON to insert new events. See https://developers.google.com/google-apps/calendar/v3/reference/events#resource for details about the Calender Event Resource JSON.
import chilkat2 # This example (below) generates the following JSON: # Note: Your application code would construct the event JSON using your # desired subset of members. For boolean values, you would pass True or False. # For date or date/time values, you would pass the appropriately formatted date/time string. # { # "kind": "calendar#event", # "etag": "some_etag", # "id": "string value", # "status": "string value", # "htmlLink": "string value", # "created": "datetime value", # "updated": "datetime value", # "summary": "string value", # "description": "string value", # "location": "string value", # "colorId": "string value", # "creator": { # "id": "string value", # "email": "string value", # "displayName": "string value", # "self": true # }, # "organizer": { # "id": "string value", # "email": "string value", # "displayName": "string value", # "self": true # }, # "start": { # "date": "date value", # "dateTime": "datetime value", # "timeZone": "string value" # }, # "end": { # "date": "date value", # "dateTime": "datetime value", # "timeZone": "string value" # }, # "endTimeUnspecified": true, # "recurrence": [ # "string value" # ], # "recurringEventId": "string value", # "originalStartTime": { # "date": "date value", # "dateTime": "datetime value", # "timeZone": "string value" # }, # "transparency": "string value", # "visibility": "string value", # "iCalUID": "string value", # "sequence": 1234, # "attendees": [ # { # "id": "string value", # "email": "string value", # "displayName": "string value", # "organizer": true, # "self": true, # "resource": true, # "optional": true, # "responseStatus": "string value", # "comment": "string value", # "additionalGuests": 1234 # }, # { # "id": "string value", # "email": "string value", # "displayName": "string value", # "organizer": true, # "self": true, # "resource": true, # "optional": true, # "responseStatus": "string value", # "comment": "string value", # "additionalGuests": 1234 # } # ], # "attendeesOmitted": true, # "extendedProperties": { # "private": { # "someKey": "string value" # }, # "shared": { # "someKey": "string value" # } # }, # "hangoutLink": "string value", # "gadget": { # "type": "string value", # "title": "string value", # "link": "string value", # "iconLink": "string value", # "width": 1234, # "height": 1234, # "display": "string value", # "preferences": { # "someKey": "string value" # } # }, # "anyoneCanAddSelf": true, # "guestsCanInviteOthers": true, # "guestsCanModify": true, # "guestsCanSeeOtherGuests": true, # "privateCopy": true, # "locked": true, # "reminders": { # "useDefault": true, # "overrides": [ # { # "method": "string value", # "minutes": 1234 # } # ] # }, # "source": { # "url": "string value", # "title": "string value" # }, # "attachments": [ # { # "fileUrl": "string value", # "title": "string value", # "mimeType": "string value", # "iconLink": "string value", # "fileId": "string value" # }, # { # "fileUrl": "string value", # "title": "string value", # "mimeType": "string value", # "iconLink": "string value", # "fileId": "string value" # } # ] # } json = chilkat2.JsonObject() json.UpdateString("kind","calendar#event") json.UpdateString("etag","some_etag") json.UpdateString("id","string value") json.UpdateString("status","string value") json.UpdateString("htmlLink","string value") json.UpdateString("created","datetime value") json.UpdateString("updated","datetime value") json.UpdateString("summary","string value") json.UpdateString("description","string value") json.UpdateString("location","string value") json.UpdateString("colorId","string value") json.UpdateString("creator.id","string value") json.UpdateString("creator.email","string value") json.UpdateString("creator.displayName","string value") json.UpdateBool("creator.self",True) json.UpdateString("organizer.id","string value") json.UpdateString("organizer.email","string value") json.UpdateString("organizer.displayName","string value") json.UpdateBool("organizer.self",True) json.UpdateString("start.date","date value") json.UpdateString("start.dateTime","datetime value") json.UpdateString("start.timeZone","string value") json.UpdateString("end.date","date value") json.UpdateString("end.dateTime","datetime value") json.UpdateString("end.timeZone","string value") json.UpdateBool("endTimeUnspecified",True) json.UpdateString("recurrence[0]","string value") json.UpdateString("recurringEventId","string value") json.UpdateString("originalStartTime.date","date value") json.UpdateString("originalStartTime.dateTime","datetime value") json.UpdateString("originalStartTime.timeZone","string value") json.UpdateString("transparency","string value") json.UpdateString("visibility","string value") json.UpdateString("iCalUID","string value") json.UpdateNumber("sequence","1234") json.UpdateString("attendees[0].id","string value") json.UpdateString("attendees[0].email","string value") json.UpdateString("attendees[0].displayName","string value") # Note: We could alternately specify an index using "i", which allows # for an application to construct using a loop with a variable.. json.I = 0 json.UpdateBool("attendees[i].organizer",True) json.UpdateBool("attendees[i].self",True) json.UpdateBool("attendees[i].resource",True) json.UpdateBool("attendees[i].optional",True) json.UpdateString("attendees[i].responseStatus","string value") json.UpdateString("attendees[i].comment","string value") json.UpdateNumber("attendees[i].additionalGuests","1234") json.I = 1 json.UpdateString("attendees[i].id","string value") json.UpdateString("attendees[i].email","string value") json.UpdateString("attendees[i].displayName","string value") json.UpdateBool("attendees[1].organizer",True) json.UpdateBool("attendees[1].self",True) json.UpdateBool("attendees[1].resource",True) json.UpdateBool("attendees[1].optional",True) json.UpdateString("attendees[1].responseStatus","string value") json.UpdateString("attendees[1].comment","string value") json.UpdateNumber("attendees[1].additionalGuests","1234") json.UpdateBool("attendeesOmitted",True) json.UpdateString("extendedProperties.private.someKey","string value") json.UpdateString("extendedProperties.shared.someKey","string value") json.UpdateString("hangoutLink","string value") json.UpdateString("gadget.type","string value") json.UpdateString("gadget.title","string value") json.UpdateString("gadget.link","string value") json.UpdateString("gadget.iconLink","string value") json.UpdateNumber("gadget.width","1234") json.UpdateNumber("gadget.height","1234") json.UpdateString("gadget.display","string value") json.UpdateString("gadget.preferences.someKey","string value") json.UpdateBool("anyoneCanAddSelf",True) json.UpdateBool("guestsCanInviteOthers",True) json.UpdateBool("guestsCanModify",True) json.UpdateBool("guestsCanSeeOtherGuests",True) json.UpdateBool("privateCopy",True) json.UpdateBool("locked",True) json.UpdateBool("reminders.useDefault",True) json.UpdateString("reminders.overrides[0].method","string value") json.UpdateNumber("reminders.overrides[0].minutes","1234") json.UpdateString("source.url","string value") json.UpdateString("source.title","string value") json.UpdateString("attachments[0].fileUrl","string value") json.UpdateString("attachments[0].title","string value") json.UpdateString("attachments[0].mimeType","string value") json.UpdateString("attachments[0].iconLink","string value") json.UpdateString("attachments[0].fileId","string value") json.UpdateString("attachments[1].fileUrl","string value") json.UpdateString("attachments[1].title","string value") json.UpdateString("attachments[1].mimeType","string value") json.UpdateString("attachments[1].iconLink","string value") json.UpdateString("attachments[1].fileId","string value") json.EmitCompact = False print(json.Emit()) |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.