Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on

google api

https://developers.google.com/calendar/quickstart/dotnet
I hope to get list of music concert event based on the zip codes
and I used above google api.

can you guide me how to filter just music event and zip?

I use c#
Avatar of David Favor
David Favor
Flag of United States of America image

What you're asking will just require you jump in + start coding/experimenting.

1) The Google Calendar API will only allow you to access calendars.

2) If you point your code a various different calendars, which contain music events + addresses (zip codes) then you can pull this data.

3) Many of these calendar entries my have various formats, since calendar events are just structured text + many times the structure may not make sense. This means you'll likely be writing a lot of custom code to look through every line of the calendar entry looking for a zip code. For example, someone my put the address in a notes field or URL field or any other oddly named field. Best of you pull all text from the entire entry, then parse the entry looking for a 5x or 10x character zip code.

4) There is no... one size fits all... approach to writing this code. You'll just have to write the code + compare your parsing with actual events, to ensure you're pulling out data you require.

5) No matter what language you choose, you'll still likely use libcurl() for sites with APIs or RSS feeds or microdata.

6) For sites you must scrape, you'll use http://phantomjs.org/ to correctly pull data generated by Javascript.

Note: Be sure to check the TOS of sites you're accessing. Some sites will be happy for you to pull data. Other sites prohibit pulling data.

7) c# eh... This means your code will be very difficult to port. If it's important for your code to work forever + coding time be minimal, then use PERL or some other scripted language, geared toward handling strings.
ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ITsolutionWizard

ASKER

thanks guys. my goal is to extract those events into my database. using c# or just JavaScript.
The response given in the api is json
{
  "kind": "calendar#events",
  "etag": etag,
  "summary": string,
  "description": string,
  "updated": datetime,
  "timeZone": string,
  "accessRole": string,
  "defaultReminders": [
    {
      "method": string,
      "minutes": integer
    }
  ],
  "nextPageToken": string,
  "nextSyncToken": string,
  "items": [
    events Resource
  ]
}

Open in new window


Your first step has two parts, a) get a token and b) call the specific api https://www.googleapis.com/calendar/v3/calendars/calendarId/events

Next, you will get a response of either an error or good data
{
  "kind": "calendar#events",
  "etag": etag,
  "summary": string,
  "description": string,
  "updated": datetime,
  "timeZone": string,
  "accessRole": string,
  "defaultReminders": [
    {
      "method": string,
      "minutes": integer
    }
  ],
  "nextPageToken": string,
  "nextSyncToken": string,
  "items": [
    events Resource
  ]
}

Open in new window

Your code will need to parse this and decide if it is good data or not to add to the database.

The final step is to ingest the json data and import it to your database.

Which step do you need more specific help with?