Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase REST API: How to fetch data by priority like startAt/endAt in JS?

Tags:

firebase

I need to fetch my data by a priority range, like you can with startAt/endAt in the JS, but in REST. Is it possible?

like image 497
devmao Avatar asked Mar 27 '13 22:03

devmao


2 Answers

I believe this is now possible with the beta Queries API.

As per https://www.firebase.com/docs/beta/queries/rest.html:

The startAt parameter accepts whatever type you specify in orderBy. This query finds all dinosaurs at least 3 meters tall.

curl 'https://dinosaur-facts.firebaseio.com/.json?orderBy="height"&startAt=3'

And this query finds all dinosaurs starting with Stegosaurus.

curl 'https://dinosaur-facts.firebaseio.com/.json?orderBy="$key"&startAt="stegosaurus"'
like image 83
David Notik Avatar answered Nov 19 '22 04:11

David Notik


This isn't yet possible with the REST API.

You can, however, run on Node.js client on your own server, and query your data in that way: https://www.firebase.com/docs/nodejs-quickstart.html

like image 2
Andrew Lee Avatar answered Nov 19 '22 04:11

Andrew Lee