DSS API - Filter data

Solved!
Maurip00
Level 2
DSS API - Filter data

I am using curl to get data from a dataset via REST service and API following the documentation found here:
https://doc.dataiku.com/dss/api/9.0/rest/#datasets-dataset-data-get

filterstring (optional) Example: mycol1 > 0 && mycol3 > 0

Formula to select only a subset of rows based on a boolean expression

 

when I try to filter the data I cannot apply the boolean "and" condition with && syntax; the answer I get doesn't take into account the filter after && (instead with "or", using ||, no problem).
With this request:

 

$url = "https://my-site/public/api/projects/my-project/datasets/my-dataset/data?format=json&filter=val('Status')=='WK'&&val('Order')=='22416'&columns=Order,Status"

curl.exe --user my-api: -H "Content-Type: application/json" -X GET $url

 

I get this response:

 

[["22417","WK"],["22522","WK"],["22853","WK"]...

 

 

What am I doing wrong?

0 Kudos
1 Solution
AlexT
Dataiker

Hi @Maurip00 ,

Can you try using the url-encoded version(%26%26) instead of && in your query instead. As & is reserved for splitting the query. Please try changing it to :

$url = "https://my-site/public/api/projects/my-project/datasets/my-dataset/data?format=json&filter=val('Stat...'%26%26val('Order')=='22416'&columns=Order,Status"

Let me know if that works for you. We will need to update our REST API doc to correct this. 

Thanks,

View solution in original post

0 Kudos
2 Replies
AlexT
Dataiker

Hi @Maurip00 ,

Can you try using the url-encoded version(%26%26) instead of && in your query instead. As & is reserved for splitting the query. Please try changing it to :

$url = "https://my-site/public/api/projects/my-project/datasets/my-dataset/data?format=json&filter=val('Stat...'%26%26val('Order')=='22416'&columns=Order,Status"

Let me know if that works for you. We will need to update our REST API doc to correct this. 

Thanks,

0 Kudos
Maurip00
Level 2
Author

It works, thanks!

0 Kudos