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?
Best Answer
-
Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,212 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('Status')=='WK'%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,
Answers
-
It works, thanks!