I am trying to add/insert a google calendar event using PHP, i am using the google API libraries via a composer install.
I have traced the error to the object being inserted (i have the token). I did a json_encode of the event to be inserted to test with google's online checker (for which i use the 'primary' calendarId)
{
"creator": null,
"organizer": null,
"summary": "Meeting with Bart Simpson",
"id": null,
"attendees": null,
"htmlLink": null,
"recurrence": null,
"start": {
"date": null,
"timeZone":"Australia/Hobart",
"dateTime": "2014-02-03T15:00:00+11:00"
},
"etag": null,
"location": "-42.859634, 147.30928399999993",
"recurringEventId": null,
"gadget": null,
"status": null,
"updated": null,
"description": "Visit",
"iCalUID": null,
"extendedProperties": null,
"endTimeUnspecified": null,
"sequence": null,
"visibility": null,
"guestsCanModify": null,
"end": {
"date": null,
"timeZone":"Australia/Hobart",
"dateTime": "2014-02-03T16:00:00+11:00"
},
"attendeesOmitted": null,
"kind": null,
"locked": null,
"created": null,
"colorId": "0",
"anyoneCanAddSelf": null,
"reminders": null,
"guestsCanSeeOtherGuests": null,
"originalStartTime": null,
"guestsCanInviteOthers": null,
"transparency": null,
"privateCopy": null
}
from which i get the response:
400 Bad Request
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid value for: null is not a valid value"
}
],
"code": 400,
"message": "Invalid value for: null is not a valid value"
}
}
It seems the property name is missing from the message. "invalid value for ???:"
I have tried removing items in a stepwise manner but it does not appear to work until only the start and end are left. As all of the null entries are created by the API, I would have thought they were correct.
It was working before, and I changed something, but i am not sure what. Am I missing something in my sleep deprived state?
I also stumbled upon this problem and after some time spent with Postman, I figured that Google API doesn't accept fields with null values (for some reason