[Developers] Freebase newbie: simple question

Pito Salas rps at salas.com
Thu Feb 26 01:26:45 UTC 2009


Hi Shawn

Do you know the httparty gem. It makes it really easy to do what we need here.

So... What if I wanted any US states that have the letters "mass" in
their name? Is there magic syntax for thatz?

Thanks again!

Pito

> require 'net/http'
>
> query_string =
> '{"query":{"country":{"id":"/en/united_states"},"iso_3166_2_code":null,"name":"Massachusetts","type":"/location/administrative_division"}}'
> query_uri = URI.parse('http://www.freebase.com/api/service/mqlread?query=' +
> URI.escape(query_string))
> result = Net::HTTP.get(query_uri)
>
> Then it's just a matter of parsing the JSON, getting the value of
> iso_3166_2_code and removing the "US-" from the beginning.
>
> Shawn
>
>
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
>
>


More information about the Developers mailing list