Unboxing PYBOSSA 2.9.0

Search within nested JSON data using the API

9 February 2018

Post by Daniel Lombraña

Cover photo by Freestocks

Reading time ~ 3 minutes

GIFs & memes ~ 0

arrow_back Back to entries

Do you know that feeling before you open, unwrap, unbox something you have in front of you? You feel excited, thrilled to discover what’s inside that box. You want to know, and you want to know it now!

You are also nervous, because, would it meet your expectations? With that mix, you cannot wait, and you do it quickly, like when you were a kid on Christmas’ day.

via GIPHY

Today we’re happy because we have something really good to share. We have a new version of PYBOSSA that adds a core feature that we think will change how you use it.

PYBOSSA always has stored its data in JSON format. This feature gives us all the freedom that we need to design any possible solution for you. However, we were only able to allow you to search within the first level of keys, missing complex operations like searching within nested data out of the box.

via GIPHY

While we knew this was a problem, the truth is that we allowed you to do full-text search queries via the API. This feature has become one of the most popular ones among our users, as you can not only enrich your data with the crowd but also exploit it.

But, we were missing nested searches. Yes, we know, with great power comes great responsibility, and today we’re happy to announce that we have finally implemented and released this new feature: JSON path searches via the API.

This new feature allows you to search within any level of your JSON by just writing the path that you want to match. As simple as that. For example, you can do a basic query like this:

Give me all the task runs sent by users that have answered yes:

http://yourserver.com/api/taskrun?info={"answer": "yes"}

What if you have several questions? Let’s say, get me all the task runs that users have responded: red, car. No problem, you can do it like this:

http://yourserver.com/api/taskrun?info={"answers": [{"device": "car", "color": "red"]}

The sky is the limit. Now, bear in mind that you can mix with those queries any other filtering option of the API and you can do crazy (but yet powerful) queries like this: Give me all the results that have been created this month where the device is a car, has color red and it’s a 4x4:

http://yourserver.com/api/result?info={"answer": {"device": {"type": "car", "color": "red", "4x4": true}}}&created=2018-02

As you can see, we are over excited about this new feature as you can do really complex queries without having to work with webhooks. Thus, go ahead, grab the latest version, and be that kid unwrapping your new toy!

via GIPHY

Share this blog post: