Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Database REST get with orderBy value and parameters

database.rules.json

{
  "rules": {
    "meetings" : {
      ".read": true,
      ".write": true,
      ".indexOn" : ["date"]
    }
  }
}

Request URL

"https://{baseURL}/meetings.json?orderBy=date&equalTo=20181005"

Error Message error: "orderBy must be a valid JSON encoded path"

But

"https://{baseURL}/meetings.json"

No Error. What did I do wrong? Plz help me.

like image 975
seung hee choi Avatar asked Dec 24 '22 03:12

seung hee choi


1 Answers

The value of the name parameter in your URL needs to be enclosed in " quotes. So:

https://{baseURL}/meetings.json?orderBy="date"&equalTo=20181005

Depending on the way you store the values of the date property, the value of the equalTo parameter may also need be enclosed in " quotes. If you store date as a string, it needs to be:

https://{baseURL}/meetings.json?orderBy="date"&equalTo="20181005"

For more on this, read the Firebase documentation on querying using the REST API.

like image 170
Frank van Puffelen Avatar answered Feb 24 '23 23:02

Frank van Puffelen