Antwort auf: Google Kalender – Events erstellen

Startseite Foren Deutsches LiveCode-Forum Google Kalender – Events erstellen Antwort auf: Google Kalender – Events erstellen

#8822
mimu
Teilnehmer

    Schau Dir mal diese Seite an:

    https://developers.google.com/apis-explorer/?hl=de#p/calendar/v3/calendar.events.insert

    Post request an
    https://www.googleapis.com/calendar/v3/calendars/primary/events –?key={YOUR_API_KEY}
    — primary ist Dein DefaultKalender

    So sollte Dein Json Payload aussehen:
    {
    „end“: {
    „dateTime“: „2018-11-25T18:00:00Z“,
    „timeZone“: „Europe/Berlin“
    },
    „start“: {
    „dateTime“: „2018-11-25T17:00:00Z“,
    „timeZone“: „Europe/Berlin“
    },
    „description“: „Das ist ein Test“
    }

    Baue dir ein Array pData mit den benoetigten Feldern auf.
    Dann ArraytoJson oder JsonExport(pValue)

    ————————–

    on mouseUp

    put „2018-11-25T18:00:00Z“ into pDataA[„start“][„dateTime“]
    put „Europe/Berlin“ into pDataA[„start“][„timeZone“]
    put „2018-11-25T19:00:00Z“ into pDataA[„end“][„dateTime“]
    put „Europe/Berlin“ into pDataA[„end“][„timeZone“]
    put „Das ist ein Test“ into pDataA[„description“]

    put ArrayToJSON(pDataA,true,true) into tpayload
    constructHeaderPost
    put „https://www.googleapis.com/calendar/v3/calendars/primary/events“ into turl
    post tpayload to url turl
    try
    put jsonToArray(it) into tResponse
    catch terror
    put terror into tResponse[„error“]
    end try
    end mouseUp

    command constructHeaderPost
    put „Content-Type: application/json“ & cr \
    & „Accept: */*“ & cr \
    & „Authorization: Bearer“ && taccess_token & cr \
    & „Accept-Encoding: gzip, deflate“ into tHeaders
    set the httpHeaders to tHeaders
    end constructHeaderPost

    (bin nicht sicher ob die Header „Accept und Accept-Encoding“ gebraucht werden)

    Ich habe bisher keine Erfahrung mit oAuth, aber wenn du den AccesToken schon hast muss dieser in die Variable „taccess_token“ in der Methode „constructHeaderPost“

    hier noch etwas Info :
    https://developers.google.com/identity/protocols/OAuth2InstalledApp#callinganapi