API - Search for published devices

edited June 2016 in General
I'm trying to get a list of all public devices that are: a) near me and b) have published. Starting with the near query parameter works just fine and I get a list in order of proximity:

curl -k https://api.smartcitizen.me/v0/devices?near=32.7157,-117.1611

Now, I also only want to retrieve devices that have *some* data that can be retrieved. I'll try adding a search string:

curl -k -g "https://api.smartcitizen.me/v0/devices?near=32.7157,-117.1611&q[state_eq]=has_published"

Ok, that doesn't work I'm getting devices returned with "never_published" as the state. Perhaps the q and brackets are not supposed to be in there and I should just request the "state_eq" parameter?

curl -k "https://api.smartcitizen.me/v0/devices?near=32.7157,-117.1611&state_eq=has_published"

Still seeing "never_published". Are multiple search parameters allowed in a single call? I've tried taking out near and just using the state search:

curl -k -g "https://api.smartcitizen.me/v0/devices?q[state_eq]=has_published"
curl -k "https://api.smartcitizen.me/v0/devices?state_eq=has_published"

Neither of these work. Does the search allow searching by *any* field, or just specific fields? Or, am I doing something wrong with my endpoint/querystring? Or, is there something that needs to be addressed?



Sign In or Register to comment.