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
(Unicode C) 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.
#include <C_CkJsonObjectW.h> void ChilkatSample(void) { HCkJsonObjectW json; // 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 = CkJsonObjectW_Create(); CkJsonObjectW_UpdateString(json,L"kind",L"calendar#event"); CkJsonObjectW_UpdateString(json,L"etag",L"some_etag"); CkJsonObjectW_UpdateString(json,L"id",L"string value"); CkJsonObjectW_UpdateString(json,L"status",L"string value"); CkJsonObjectW_UpdateString(json,L"htmlLink",L"string value"); CkJsonObjectW_UpdateString(json,L"created",L"datetime value"); CkJsonObjectW_UpdateString(json,L"updated",L"datetime value"); CkJsonObjectW_UpdateString(json,L"summary",L"string value"); CkJsonObjectW_UpdateString(json,L"description",L"string value"); CkJsonObjectW_UpdateString(json,L"location",L"string value"); CkJsonObjectW_UpdateString(json,L"colorId",L"string value"); CkJsonObjectW_UpdateString(json,L"creator.id",L"string value"); CkJsonObjectW_UpdateString(json,L"creator.email",L"string value"); CkJsonObjectW_UpdateString(json,L"creator.displayName",L"string value"); CkJsonObjectW_UpdateBool(json,L"creator.self",TRUE); CkJsonObjectW_UpdateString(json,L"organizer.id",L"string value"); CkJsonObjectW_UpdateString(json,L"organizer.email",L"string value"); CkJsonObjectW_UpdateString(json,L"organizer.displayName",L"string value"); CkJsonObjectW_UpdateBool(json,L"organizer.self",TRUE); CkJsonObjectW_UpdateString(json,L"start.date",L"date value"); CkJsonObjectW_UpdateString(json,L"start.dateTime",L"datetime value"); CkJsonObjectW_UpdateString(json,L"start.timeZone",L"string value"); CkJsonObjectW_UpdateString(json,L"end.date",L"date value"); CkJsonObjectW_UpdateString(json,L"end.dateTime",L"datetime value"); CkJsonObjectW_UpdateString(json,L"end.timeZone",L"string value"); CkJsonObjectW_UpdateBool(json,L"endTimeUnspecified",TRUE); CkJsonObjectW_UpdateString(json,L"recurrence[0]",L"string value"); CkJsonObjectW_UpdateString(json,L"recurringEventId",L"string value"); CkJsonObjectW_UpdateString(json,L"originalStartTime.date",L"date value"); CkJsonObjectW_UpdateString(json,L"originalStartTime.dateTime",L"datetime value"); CkJsonObjectW_UpdateString(json,L"originalStartTime.timeZone",L"string value"); CkJsonObjectW_UpdateString(json,L"transparency",L"string value"); CkJsonObjectW_UpdateString(json,L"visibility",L"string value"); CkJsonObjectW_UpdateString(json,L"iCalUID",L"string value"); CkJsonObjectW_UpdateNumber(json,L"sequence",L"1234"); CkJsonObjectW_UpdateString(json,L"attendees[0].id",L"string value"); CkJsonObjectW_UpdateString(json,L"attendees[0].email",L"string value"); CkJsonObjectW_UpdateString(json,L"attendees[0].displayName",L"string value"); // Note: We could alternately specify an index using "i", which allows // for an application to construct using a loop with a variable.. CkJsonObjectW_putI(json,0); CkJsonObjectW_UpdateBool(json,L"attendees[i].organizer",TRUE); CkJsonObjectW_UpdateBool(json,L"attendees[i].self",TRUE); CkJsonObjectW_UpdateBool(json,L"attendees[i].resource",TRUE); CkJsonObjectW_UpdateBool(json,L"attendees[i].optional",TRUE); CkJsonObjectW_UpdateString(json,L"attendees[i].responseStatus",L"string value"); CkJsonObjectW_UpdateString(json,L"attendees[i].comment",L"string value"); CkJsonObjectW_UpdateNumber(json,L"attendees[i].additionalGuests",L"1234"); CkJsonObjectW_putI(json,1); CkJsonObjectW_UpdateString(json,L"attendees[i].id",L"string value"); CkJsonObjectW_UpdateString(json,L"attendees[i].email",L"string value"); CkJsonObjectW_UpdateString(json,L"attendees[i].displayName",L"string value"); CkJsonObjectW_UpdateBool(json,L"attendees[1].organizer",TRUE); CkJsonObjectW_UpdateBool(json,L"attendees[1].self",TRUE); CkJsonObjectW_UpdateBool(json,L"attendees[1].resource",TRUE); CkJsonObjectW_UpdateBool(json,L"attendees[1].optional",TRUE); CkJsonObjectW_UpdateString(json,L"attendees[1].responseStatus",L"string value"); CkJsonObjectW_UpdateString(json,L"attendees[1].comment",L"string value"); CkJsonObjectW_UpdateNumber(json,L"attendees[1].additionalGuests",L"1234"); CkJsonObjectW_UpdateBool(json,L"attendeesOmitted",TRUE); CkJsonObjectW_UpdateString(json,L"extendedProperties.private.someKey",L"string value"); CkJsonObjectW_UpdateString(json,L"extendedProperties.shared.someKey",L"string value"); CkJsonObjectW_UpdateString(json,L"hangoutLink",L"string value"); CkJsonObjectW_UpdateString(json,L"gadget.type",L"string value"); CkJsonObjectW_UpdateString(json,L"gadget.title",L"string value"); CkJsonObjectW_UpdateString(json,L"gadget.link",L"string value"); CkJsonObjectW_UpdateString(json,L"gadget.iconLink",L"string value"); CkJsonObjectW_UpdateNumber(json,L"gadget.width",L"1234"); CkJsonObjectW_UpdateNumber(json,L"gadget.height",L"1234"); CkJsonObjectW_UpdateString(json,L"gadget.display",L"string value"); CkJsonObjectW_UpdateString(json,L"gadget.preferences.someKey",L"string value"); CkJsonObjectW_UpdateBool(json,L"anyoneCanAddSelf",TRUE); CkJsonObjectW_UpdateBool(json,L"guestsCanInviteOthers",TRUE); CkJsonObjectW_UpdateBool(json,L"guestsCanModify",TRUE); CkJsonObjectW_UpdateBool(json,L"guestsCanSeeOtherGuests",TRUE); CkJsonObjectW_UpdateBool(json,L"privateCopy",TRUE); CkJsonObjectW_UpdateBool(json,L"locked",TRUE); CkJsonObjectW_UpdateBool(json,L"reminders.useDefault",TRUE); CkJsonObjectW_UpdateString(json,L"reminders.overrides[0].method",L"string value"); CkJsonObjectW_UpdateNumber(json,L"reminders.overrides[0].minutes",L"1234"); CkJsonObjectW_UpdateString(json,L"source.url",L"string value"); CkJsonObjectW_UpdateString(json,L"source.title",L"string value"); CkJsonObjectW_UpdateString(json,L"attachments[0].fileUrl",L"string value"); CkJsonObjectW_UpdateString(json,L"attachments[0].title",L"string value"); CkJsonObjectW_UpdateString(json,L"attachments[0].mimeType",L"string value"); CkJsonObjectW_UpdateString(json,L"attachments[0].iconLink",L"string value"); CkJsonObjectW_UpdateString(json,L"attachments[0].fileId",L"string value"); CkJsonObjectW_UpdateString(json,L"attachments[1].fileUrl",L"string value"); CkJsonObjectW_UpdateString(json,L"attachments[1].title",L"string value"); CkJsonObjectW_UpdateString(json,L"attachments[1].mimeType",L"string value"); CkJsonObjectW_UpdateString(json,L"attachments[1].iconLink",L"string value"); CkJsonObjectW_UpdateString(json,L"attachments[1].fileId",L"string value"); CkJsonObjectW_putEmitCompact(json,FALSE); wprintf(L"%s\n",CkJsonObjectW_emit(json)); CkJsonObjectW_Dispose(json); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.