Reputation: 87
I'm learning about reactJS and for the database I'm using firebase realtime Database.. everything works. but there is one problem..
i have Firebase url like this
https://my-app-name-rtdb.asia-southeast1.firebasedatabase.app/data.json
and the result when get the data
{
"data" : {
"-Mc8l24sBroFw8JoA32e" : {
"data" : {
"authorized" : {...},
"authorizedFinance" : {...},
"authorizedTechnical" : {...},
"billingAddress" : {...},
"information" : {...},
"serviceOrder" : {...},
"subscriptionFee" : {...},
"typeofOrder" : {...}
}
},
"-Mc9XCIdCg4FLDzj3Xmg" : {
"data" : {
"authorized" : {...},
"authorizedFinance" : {...},
"authorizedTechnical" : {...},
"billingAddress" : {...},
"information" : {...},
"serviceOrder" : {...},
"subscriptionFee" : {...},
"typeofOrder" : {...}
}
}
}
}
what i want is,just get 1 data by the id -Mc8l24sBroFw8JoA32e
.
{
"data" : {
"-Mc8l24sBroFw8JoA32e" : {
"data" : {
"authorized" : {...},
"authorizedFinance" : {...},
"authorizedTechnical" : {...},
"billingAddress" : {...},
"information" : {...},
"serviceOrder" : {...},
"subscriptionFee" : {...},
"typeofOrder" : {...}
}
}
}
i have tried to pass params in the url like this
https://my-app-name-rtdb.asia-southeast1.firebasedatabase.app/data.json?id=-Mc8l24sBroFw8JoA32e
but is not working. i get the all data..
so, how to do it? is it possible?
Upvotes: 1
Views: 989
Reputation: 515
Hi you can navigate through the child nodes in the Realtime Database console by clicking on nodes
It provides a URL for the node you want to access and append .json
at last to access it. Make sure your rules and authentication are synced.
So required link would be :
https://my-app-name-rtdb.asia-southeast1.firebaseio.com/data/-Mc8l24sBroFw8JoA32e.json
Ref:
Hope this helps🤝
Upvotes: 2
Reputation: 598718
The correct URL to get just that specific key is:
https://my-app-name-rtdb.asia-southeast1.firebasedatabase.app/data/-Mc8l24sBroFw8JoA32e.json
So the .json
is last, and before that you have the entire path to the data that you want to retrieve.
Upvotes: 2