Search code examples
firebase-realtime-databasehttp-get

Can't read data from Firebase Realtime database by issuing a GET request. Always returns null


Task is simple, but I couldn't find any solution though.

Here is the request I'm sending https://graf-24561-default-rtdb.firebaseio.com/graf-24561-default-rtdb.json

Rules for reading and writing:

{
   "rules": {
     ".read": "now < 1651165200000",  // 2022-4-29
     ".write": "now < 1651165200000",  // 2022-4-29
   }
}

Data in code:

[
 {
  "name": "0002 М ( мрамор) 8м пленка с\/м\/20  DEKORON ",
  "price": 209.7
 },
 {
  "name": "0007 М ( мрамор) 8м пленка с\/м\/20  DEKORON ",
  "price": 209.7
 },
 {
  "name": "0008-2 А (дуб темный) 8м пленка с\/м \/20",
  "price": 232.84
 },
 {
  "name": "0008-3 А (темн.махагон) 8м пленка с\/м \/20 ",
  "price": 209.7
 }
 ]

Screenshot of data in console

Trying to send request from postman


Solution

  • The graf-24561-default-rtdb that you see in the root of the JSON in the screenshot is the name of your database, and is not part of the data structure.

    So to get the entire database, the URL would be:

    https://graf-24561-default-rtdb.firebaseio.com/.json
    

    It may read a bit weird with that .json at the end, but is the correct syntax.