json - Firebase - 如何使用 curl 编写?

标签 json curl firebase

我在 firebase rest api 教程中运行示例代码。上面写着

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

我的结果在这里:

enter image description here

现在我尝试使用以下命令写入 firebase 数据库

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

结果是: enter image description here

我该如何解决?

最佳答案

请尝试:

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

这对我适用于 Windows。

关于json - Firebase - 如何使用 curl 编写?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35793426/

相关文章:

json - 如何在 iOS9 上做 http 基本认证?

json - 使用 Go 解析 .Net JSON 日期

php - 如何将 1300 条 CSV 记录输入到 Web 表单中?

Php curl 返回不完整的数据

curl - libcurl — 保持连接 “open” 以上传多个文件 (FTP)

javascript - 如何在javascript中获取json键和值?

javascript - jQuery 和 JSON : chained select from an array with multiple values

java - 用于从 firebase 数据库检索数据的 valueEventListener 的更好替代方案是什么?

ios - 从 Firebase 中提取数据到数组中

firebase - 如何将 Firebase Cloud Functions 日志导出到文件?