Get formdata and filter by value with api v2

Hello,
I build a portal based on LAMP+Geoserver and have to include kobo data.

I get the full dataset via curl with no trouble:

https://kf.kobotoolbox.org/api/v2/assets/FORMID/data.json

But filtering by value fails with either NULL:

?query=[Titel : nochmal]

or “must be valid JSON”:

?query=‘{“Name of the person entering the data” : “zettberlin”}’

Yes I do have rows that fit exactly that names and values :wink: and I tried the lines after encoding it to URL as well with the same results…

Is there some more extended, tested documentation on that matter?

I am sure you have found ways to do that filtering, would you be so kind to share some of your successfully working URL lines? That is: something that can be dropped to the URL line in a browser…

best regards

Welcome to the community, @zettberlin! We have some similar topics discussed in the past that could be helpful for you.

1 Like

Thanks for the hint, I actually did view some of this list but to no avail so far.

The good news: while waiting for replies I applied the old trial&error and came up with this:

First, you have to find the real names of the fields to search for their values.
The Kobo Browsertools do not, I repeat NOT show these but somehow end user friendly versions. These are used to *generate" names of fields, that can be used reliably in the internal processing of the data.
The easy way to find these internal identifiers is to get and view the whole bulk of the data without any filtering like this:

$pm_koboURL=“kf.kobotoolbox.org/api/v2/assets/FORMID/data.json?Authorization=Token%20MyToken”;

I found the field for Thing ID, that was generated to: “gen/thingID”

$kField=“gen/thingID”;
$kSearch=“uicISearchFor”;

Both fields can be used as is(with all the crazy slashes, umlauts and whitespaces etc in them since they are encoded as JSON and thus not directly visible in the HTTP Process.(hope, that is all true… )

In my experience it works good, to leave the curly brackets as is and use URL encoded double quotes(%22)

$pm_koboByUIC=“kf.kobotoolbox.org/api/v2/assets/FORMID/data.json?query={“$kField”:“$kSearch”}&Authorization=Token%20MyToken”;

I could have had some more here, but as a new user I am restricted to 2 links inapost…
thanks again for your help :slight_smile: