Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase - How to write using curl?

I run sample code on firebase rest api tutorial. It says that

Data from our Firebase database can be read by issuing an HTTP GET request to an endpoint:

 curl 'https://samplechat.firebaseio-demo.com/users/jack/name.json'

A successful request will be indicated by a 200 OK HTTP status code. The response will contain the data being retrieved:

{ "first": "Jack", "last": "Sparrow" }

My result is here :

enter image description here

Now I try to write to firebase database using below command

curl -X PUT -d '{ "last": "sparrow"}' https://samplechat.firebaseio-demo.com/users/jack/name.json

The result is : enter image description here

How can I fix it?


1 Answers

Please try:

curl -X PUT -d "{\"name\":{\"last\": \"sparrow\"}}" https://samplechat.firebaseio-demo.com/users/jack.json

This works for me on windows.

like image 158
atlanteh Avatar answered Apr 11 '26 17:04

atlanteh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!