Ashish Tripathi
Ashish Tripathi

Reputation: 666

Google Calendar API Error while Insert "the specified time range is empty"

If you're getting the error "the specified time range is empty" or the error response below.

{
    "error": {
        "errors": [
            {
                "domain": "calendar",
                "reason": "timeRangeEmpty",
                "message": "The specified time range is empty.",
                "locationType": "parameter",
                "location": "timeMax"
            }
        ],
    "code": 400,
    "message": "The specified time range is empty."
}
}

Upvotes: 2

Views: 1481

Answers (1)

Ashish Tripathi
Ashish Tripathi

Reputation: 666

Mostly this issue is encountered when start > end

Example: You're specifying Start and End Date as follows:

  • Start: 2020-10-10T13:30:00+5:30 (i.e. 10th Oct 2020 @1:30PM)
  • End: 2020-10-10T13:00:00+5:30 (i.e. 10th Oct 2020 @1:00PM)

End Time Should be Greater than the start Time.

{
    "summary": "some summary",
    "description": "some description",
    "location": "some location",
    "end":  {"dateTime" : "2020-10-10T13:30:00+5:30"},
    "start" : { "dateTime" : "2020-10-10T13:00:00+5:30"},
}

Upvotes: 5

Related Questions