本文介绍了Firestore REST API数据库监听的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您知道如何使用REST API设置Firestore侦听.这是我的尝试:
Do you know how to setup Firestore listening using REST API. This is my attempt:
url: "https://firestore.googleapis.com/v1beta1/projects/project_name/databases/(default)/documents:listen"
headers: {["Content-Type"] = "application/json"}
body: "{"addTarget": {
"once" : false,
"documents" : {
"documents" : [ "projects/project_name/databases/(default)/documents/Users/USER_DOC_ID" ]
}
}}"
Request verb: POST
响应:
[{
"error": {
"code": 400,
"message": "Invalid value (Object), ",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"description": "Invalid value (Object), "
}
]
}
]
}
}
]
大多数情况下,我的请求正文无效.我使用了以下参考: https://firebase.google. com/docs/reference/rest/firestore/v1beta1/projects.databases/listen
Most propably, my request body is invalid. I used this reference: https://firebase.google.com/docs/reference/rest/firestore/v1beta1/projects.databases/listen
身体应该是什么样子?提前致谢.
How is the body should look like?Thanks in advance.
推荐答案
通过REST API无法使用listen方法.可通过 RPC API .
The listen method is not available through the REST API. It is available through the RPC API.
这篇关于Firestore REST API数据库监听的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!