Realtime Database
Firebase.auth_headerFirebase.auth_urlFirebase.cloudstore_addfirebaseFirebase.cloudstore_getFirebase.cloudstore_getbucketFirebase.cloudstore_initFirebase.cloudstore_listbucketsFirebase.cloudstore_removefirebaseFirebase.cloudstore_sendfileFirebase.confirm_passwordresetFirebase.content_typeFirebase.database_nsFirebase.emulator_activeFirebase.emulator_runningFirebase.firebase_changeemailFirebase.firebase_changepasswordFirebase.firebase_confirmemailverifyFirebase.firebase_deleteuserFirebase.firebase_fetchprovidersFirebase.firebase_getuserinfoFirebase.firebase_linkoauthFirebase.firebase_linkuserinfoFirebase.firebase_passwordresetFirebase.firebase_signinFirebase.firebase_signinanonFirebase.firebase_signinoauthFirebase.firebase_signupFirebase.firebase_unlinkprovideFirebase.firebase_updateprofileFirebase.firebase_verifyemailFirebase.firestore_batchgetFirebase.firestore_batchwriteFirebase.firestore_beginTransactionFirebase.firestore_commitFirebase.firestore_createdocFirebase.firestore_deletedocFirebase.firestore_getcollectionidsFirebase.firestore_getdoclistFirebase.firestore_partitionqueryFirebase.firestore_patchFirebase.firestore_runqueryFirebase.firestore_urlFirebase.get_requestFirebase.get_tokenFirebase.initFirebase.initparsedjsonFirebase.realdb_deleteFirebase.realdb_downloadFirebase.realdb_getFirebase.realdb_initFirebase.realdb_patchFirebase.realdb_postFirebase.realdb_putFirebase.set_webapikeyFirebase.use_emulatorFirebase.use_productionFirebase.verify_passwordresetcode
Realtime Database
Initializing the realdb for the base url, reduces the effort later
realdbinit("https://fir-jl-457eb-default-rtdb.asia-southeast1.firebasedatabase.app")
Base Url set:"https://fir-jl-457eb-default-rtdb.asia-southeast1.firebasedatabase.app"GET - Reading Data
Data from your Realtime Database can be read by issuing an HTTP GET request to an endpoint. The following example demonstrates how you might retrieve a user's name that you had previously stored in Realtime Database.
julia> realdb_get("/firebase_test")
ulia> realdb_get("/firebase_test")
FINAL URL: "https://fir-jl-457eb-default-rtdb.asia-southeast1.firebasedatabase.app/firebase_test.json"
GET successful
Dict{String, Any} with 3 entries:
"firebase_get" => Dict{String, Any}("firebase_get_3"=>3, "firebase_get_2"=>2, "firebase_get_1"=>1)
"firebase_new" => Dict{String, Any}("-McEjFxupzSbZwojItzL"=>Dict{String, Any}("name"=>"real_db_test"), "-McEjCHubimhfipKm2yo"=>Dict{String, Any}("name"=>"real_db_test"), "-McEjNy8-8VjqSH3P8dO"=>Dict{String, Any}…
"firebase_post" => Dict{String, Any}("firebase_post_1"=>1, "firebase_post_3"=>3, "firebase_post_2"=>2, "input"=>Dict{String, Any}("-McEQ7vGcvji7Myab182"=>Dict{String, Any}("stockAmount"=>350, "price"=>"7.5 TL", "…
POST - Pushing Data
To accomplish the equivalent of the JavaScript push() method (see Lists of Data), you can issue a POST request. A successful request is indicated by a 200 OK HTTP status code. The response contains the child name of the new data specified in the POST request.
julia> realdb_post("/firebase_test/firebase_new")
FINAL URL: "https://fir-jl-457eb-default-rtdb.asia-southeast1.firebasedatabase.app/firebase_test/firebase_new.json"
POST successful
Dict{String, Any} with 1 entry:
"name" => "-McEkk8qvdT4UHSUQALx"
julia> realdb_post("/firebase_test/firebase_new/","""{"hello":1}""")
FINAL URL: "https://fir-jl-457eb-default-rtdb.asia-southeast1.firebasedatabase.app/firebase_test/firebase_new.json"
POST successful
Dict{String, Any} with 1 entry:
"name" => "-McElRx3ZBP-l7pCF0LN"DELETE - Removing Data
You can delete data with a DELETE request A successful DELETE request is indicated by a 200 OK HTTP status code with a response containing JSON null.
julia> realdb_delete("/firebase_test/firebase_new")
https://fir-jl-457eb-default-rtdb.asia-southeast1.firebasedatabase.app/firebase_test/firebase_new.json
DELETE successfulPUT - Writing Data
You can write data with a PUT request. A successful request is indicated by a 200 OK HTTP status code. The response contains the data specified in the PUT request.
julia> realdb_put("/firebase_test/firebase_new/","""{"hello":1}""")
FINAL URL: "https://fir-jl-457eb-default-rtdb.asia-southeast1.firebasedatabase.app/firebase_test/firebase_new.json"
PUT successful
Dict{String, Any} with 1 entry:
"name" => "-McElRx3ZBP-l7pCF0LN"Firebase.realdb_delete — Function
realdb_delete(url, authheader = ""; query = Dict())
DELETE request to an endpoint
Example
realdb_init("https://[PROJECT_ID].asia-southeast1.firebasedatabase.app")
realdb_delete("/users/jack/name/last")Firebase.realdb_download — Function
realdb_download(url, authheader = "", filename = "test"; query = Dict())
GET the data at url, asking the server to serve it as a download named filename.txt (the REST API's download parameter). Returns the parsed data.
Firebase.realdb_get — Function
realdb_get(url, authheader = ""; query = Dict())
GET request to an endpoint. query is passed through as URL parameters, e.g. Dict("orderBy" => "\"$key\"", "limitToFirst" => 10) or Dict("shallow" => true).
Requests are authenticated automatically when credentials are loaded (see init) or the emulator is active. Pass authheader to override, or query = Dict("auth" => id_token) to act as a signed-in user.
Example
realdb_init("https://[PROJECT_ID].asia-southeast1.firebasedatabase.app")
realdb_get("/users/jack/name")Firebase.realdb_init — Method
realdbinit(baseurl)
Initialize the realtimedb with baseurl to make things easier
Example
realdb_init("https://[PROJECT_ID].asia-southeast1.firebasedatabase.app")Firebase.realdb_patch — Function
realdbpatch(url, authheader = "", body = Dict("name" => "realdb_test"); query = Dict())
PATCH request to an endpoint.
Example
realdb_init("https://[PROJECT_ID].asia-southeast1.firebasedatabase.app")
body = Dict("last" => "Jones")
realdb_patch("/users/jack/name/", "", body)Firebase.realdb_post — Function
realdbpost(url, authheader = "", body = Dict("name" => "realdb_test"); query = Dict())
POST request to an endpoint.
Example
realdb_init("https://[PROJECT_ID].asia-southeast1.firebasedatabase.app")
body = Dict("user_id" => "jack", "text" => "Ahoy!")
realdb_post("/message_list", "", body)Notes:
According to the REST API documentation for Realtime Database, a POST is the equivalent of a "push" operation when using the client SDKs. This push operation always involves adding data under a random ID. There is no avoiding that for a push.
If you know the name of the node where you want to add data, you should use a PUT instead. This is the equivalent of using "set" operation with the client SDKs.
Firebase.realdb_put — Function
realdbput(url, authheader = "", body = Dict("name" => "realdb_test"); query = Dict())
PUT request to a endpoint.
Example
realdb_init("https://[PROJECT_ID].asia-southeast1.firebasedatabase.app")
body = Dict("first" => "Ash", "last" => "Sparrow")
realdb_put("/users/jack/name", "", body)