简体   繁体   中英

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
 }
 ]

控制台数据截图

试图从邮递员发送请求

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM