![](/img/trans.png)
[英]Firestore DB: Create collection inside a document using REST API
[英]Error 400: unable to create collection using Firestore rest API
我正在尝试通过调用 REST API 在 FIRESTORE 中创建一个集合。
我当前为此请求的 URL 是:
https://firestore.googleapis.com/v1/projects/mountain-bear-****/databases/(default)/documents/?collectionId=<new-collection>
我收到此错误:
The requested URL /v1/projects/mountain-bear-****/databases/(default)/documents/?collectionId=grofers was not found on this server. That’s all we know.
我不确定这是否是 REST API 调用创建集合的方式。 我试着查看文档,但没有找到太多帮助就回来了。
我想要达到的目标:
非常感谢对此事的任何帮助
使用 Firestore,我们不会创建这样的集合。 创建此集合的第一个文档时,将创建一个新集合。
因此,要在新的abcd
集合中创建文档,根据REST API 文档,您需要调用以下 URL(请参阅 URL 末尾的abcd
)
https://firestore.googleapis.com/v1/projects/mountain-bear-****/databases/(default)/documents/abcd
使用 POST 请求,请求主体应包含Document
的实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.