简体   繁体   English

使用 PATCH 修改 Firebase 实时数据库中的数据时出现问题

[英]Having issue with modifying data in Firebase realtime database using PATCH

I'm planning to implement to write data in Firebase Realtime Database using C compiler.我计划使用 C 编译器实现在 Firebase 实时数据库中写入数据。 I use this PATCH to modify value as in below.我使用这个 PATCH 来修改值,如下所示。 I requested but the response is having error.我请求但响应有错误。 May I know how to correct this error?我可以知道如何纠正这个错误吗?

PATCH /.json HTTP/1.1
Host: minmin-68c89.firebaseio.com
Accept: */*
{"dir":"1"}


HTTP/1.1 400 Bad Request
Server: nginx
Date: Sat, 26 Oct 2019 12:04:48 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 36
Connection: keep-alive
Access-Control-Allow-Origin: *
Cache-Control: no-cache
Strict-Transport-Security: max-age=31556926; includeSubDomains; preload

{
   "error" : "No data supplied."
                                }
                                 ATCH /.json HTTP/1.1
Host: minmin-68c89.firebaseio.com
Accept: */*
{"dir":"1"}

As far as I know you need an empty line between the headers and the body of the request.据我所知,您需要在请求的标头和正文之间留一个空行。

Also consider adding a content-type header.还可以考虑添加content-type header。

From a quick curl test I did:通过快速curl测试我做了:

PATCH /users/jack/name/.json HTTP/1.1
Host: PROJECT_ID.firebaseio.com
User-Agent: curl/7.54.0
Accept: */*
Content-Length: 16
Content-Type: application/x-www-form-urlencoded

{"last":"Jones"}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从 Firebase 实时数据库中删除一些数据? - How can I delete some data from Firebase Realtime Database? 尝试将同步融合 json 数据绑定到 Firebase 中的实时数据库 - Trying to bind syncfusion json data to realtime database in Firebase 是否有标志让 Firebase 实时数据库不将数据转换为数组? - Is there a flag to have Firebase Realtime Database NOT convert data to an array? 在 Express.js 中获取 firebase 实时数据库参考时遇到问题 - Having trouble getting firebase realtime database reference working in Express.js Firebase 实时数据库验证规则不起作用 - Firebase Realtime Database validations rules not working 使用 HTTP REST ZDB9742387014CA8DE6FZACE17 检查 firebase 实时数据库中是否存在具有特定值的记录 - Check if record with specific value exists in firebase realtime database using HTTP REST API 如何只获取Firebase RealTime数据库的一部分,而不是整个数据库? - How to fetch only part of a Firebase RealTime database, and not the entire database? Firebase数据库REST API URL的问题具有字符“。”即句点 - Issue with Firebase database REST API URL having character “.” i.e. period Firebase 实时数据库 REST 事件流:不要下载整个树 - Firebase realtime database REST event stream: do not download the whole tree Firebase 实时数据库如何添加具有自动 ID 的孩子 - Firebase Realtime Database How to add child with automatic ID
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM