Reputation:
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 :
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
How can I fix it?
Upvotes: 3
Views: 8750
Reputation: 5835
Please try:
curl -X PUT -d "{\"name\":{\"last\": \"sparrow\"}}" https://samplechat.firebaseio-demo.com/users/jack.json
This works for me on windows.
Upvotes: 4
Reputation: 8325
Have you tried following:
curl -X PUT -d '{"name":{ "last": "sparrow"}}' https://samplechat.firebaseio-demo.com/users/jack.json
If that works you can handle "first" too.
Upvotes: 2