Google calendar API - search event by name

2019-08-23 12:09发布

问题:

I use a query parameter q=something to search

From the documentation here it is evident that q="Match entire phrase" will return all events that match Match AND entire AND phrase

But I cannot search for an event something like this "abc 1.34 - 3.03 p.m." to be clear whenever there is a minus sign the search breaks understanding it as negation

I tried escaping minus as - by "abc 1.34 \- 3.03 p.m." but I was not successful.

How do I search for the event by exact which has numbers and special chars?

回答1:

You're referencing a deprecated documentation. Instead try Events.list. There is a Try-it section. I placed a query statement in the 'q' parameter and it worked, returned the event to me:

  {
     "kind": "calendar#events",
     "etag": "\"p328xp1nqajltc9g\"",
     "summary": "myname@gmail.com",
     "updated": "2017-10-12T14:25:18.442Z",
     "timeZone": "Underworld",
     "accessRole": "owner",
     "defaultReminders": [
      {
       "method": "popup",
       "minutes": 30
      }
     ],
     "nextSyncToken": "abcdefghijklmno",
     "items": []
    }