1

Using SoQL (Socrata Query Language) we can filter the values of a data set using the in(...) function. A sample example is shown in the socrata website using the Chicago open data portal.

https://data.cityofchicago.org/resource/6zsd-86xi.json?$where=primary_type in('THEFT', 'ROBBERY', 'INTIMIDATION')

But when I try this functionality using a different data set of the same data portal I don't get the answer. Here is the SoQL I used

https://data.cityofchicago.org/resource/uupf-x98q.json?$where=police_district in('12','24')

I get the following error.

{
  "code" : "query.compiler.malformed",
  "error" : true,
  "message" : "Error, could not parse SoQL query \"select * from #uupf-x98q where police_district in('12','24')\"",
  "data" : {
    "query" : "select * from #uupf-x98q where police_district in('12','24')"
  }
}
kaveman
  • 4,339
  • 25
  • 44
Nachikethas
  • 43
  • 1
  • 8

1 Answers1

0

In the case of your second query, you're accessing it via a filtered view which limits some of the things you can do with that API endpoint. If you follow the link to the API Documentation for that dataset ("Export" -> "SODA API" -> "API Docs") it'll bring you to the dataset-level API docs where you'll have more success.

For the first query, I'd recommend you migrate to it's new API endpoint, where you'll find performance to be a lot better. It should be as simple as swapping out the dataset identifier or base URL in your query.

chrismetcalf
  • 1,556
  • 1
  • 8
  • 7
  • We have a private data set with user login credentials, but unfortunately we cannot navigate to dataset-level API docs. How can we access a private dataset API docs? Also how can I make sure the data set that I am using is not in filterd view? – Nachikethas Jun 17 '15 at 13:05
  • If it is in filtered view can i make it in unfiltered view? – Nachikethas Jun 17 '15 at 13:23
  • When you're logged in, underneath the name in the upper left there will be a "Based on..." message that will link to the unfiltered dataset. Then you can grab the API link from the sidebar. – chrismetcalf Jun 17 '15 at 17:09
  • For the Chicago data portal what you said worked. I got it into the unfiltered data set .But for the private data set which i am working on there is no link underneath the name.There is only a description. Does this mean that the data set that I am working on is unfiltered? If then then problem could be with my query isn't it? – Nachikethas Jun 18 '15 at 07:39