您知道如何使用REST API设置Firestore监听.这是我的尝试:
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
身体应该怎么样?
提前致谢.
最佳答案 通过REST API无法使用listen方法.它可以通过
RPC API获得.