I am working with Parse Server, and I am trying to fetch data using the REST API in my Angular2 application.
I am trying to fetch data according to a where condition, but I am not able to do so.
This is the code I am using:
constructor(http) {
var key = new URLSearchParams();
this.http = http;
this.disho = null;
key.set('where', {"estTime":"5min"});
this.http.get('https://parseapi.example.com/classes/Setto', { where : key }).subscribe(data => {
this.disho = data.json().results;
console.log(this.disho);
});
}
The above code ignore my where condition, and returns all the records.
However, the following code returns the right results when executed in terminal via cURL
curl -X GET \
-H "X-Parse-Application-Id: someKey" \
-H "X-Parse-REST-API-Key: someKey" \
-G \
--data-urlencode 'where={"estTime":"5min"}' \
https://parseapi.example.com/classes/Setto