与AppGyver Composer Pro一起使用的Firestore REST API

问题描述 投票:0回答:2

我正在尝试将新的appGyver Composer Pro与Google Firebase配合使用(未成功)。 AppGyver使用REST API来获取数据库中的数据,但我无法使其正常工作。该数据库非常简单,只有两个文档,因此我正在使用SoapUI和Postman尝试使用不同的uri来确定如何设置Composer Pro:

因此,使用GET https://firestore.googleapis.com/v1/projects/{project}/databases/(default)/documents/{collection}/

这是请求的结果:

{"documents": [
      {
      "name": "projects/{project}/databases/(default)/documents/{collection}/{id}",
      "fields":       {
         "Nombre": {"stringValue": "Cerros"},
         "Resolucion": {"mapValue": {"fields":          {
            "Numero": {"stringValue": "22"},
            "Entidad": {"stringValue": "Curaduria"},
            "FechaResolucion": {"timestampValue": "2020-04-09T05:00:00Z"}
         }}}
      },
      "createTime": "2020-04-10T13:11:35.364097Z",
      "updateTime": "2020-04-10T13:11:35.364097Z"
   },
      {
      "name": "projects/{project}/databases/(default)/documents/{collection}/{id}",
      "fields":       {
         "Nombre": {"stringValue": "Urbanizacion Guayacanes"},
         "Resolucion": {"mapValue": {"fields":          {
            "Numero": {"stringValue": "14"},
            "Entidad": {"stringValue": "Municipio de Chinchina"},
            "FechaResolucion": {"timestampValue": "2013-11-13T05:00:00Z"}
         }}}
      },
      "createTime": "2020-04-09T14:29:09.633853Z",
      "updateTime": "2020-04-09T14:29:09.633853Z"
   }
]}

但是如果我使用https://firestore.googleapis.com/v1/projects/{project}/databases/(default)/documents/{collection}/?Nombre=Cerros

我知道

{"error": {
   "code": 400,
   "message": "Invalid JSON payload received. Unknown name \"Nombre\": Cannot bind query parameter. Field 'Nombre' could not be found in request message.",
   "status": "INVALID_ARGUMENT",
   "details": [   {
      "@type": "type.googleapis.com/google.rpc.BadRequest",
      "fieldViolations": [{"description": "Invalid JSON payload received. Unknown name \"Nombre\": Cannot bind query parameter. Field 'Nombre' could not be found in request message."}]
   }]
}}

我使用以下任何一种代替?Nombre = Cerros都得到几乎相同的消息(仅字段名称发生更改)。>

  • ?“ Nombre” =“ Cerros”
  • ?“ documents.Nombre” =“ Cerros”
  • ?“ documents.fields.Nombre” =“ Cerros”
  • 还是在之前使用?以下任何一项:

  • :runQuery
  • 搜索
  • 我做错了什么?我真的很感谢您的帮助

爱德华多

P.D。我在REST API资源管理器上尝试过:

curl --request POST \
  'https://firestore.googleapis.com/v1/projects/permisos-23395/databases/(default)/documents/Inmueble/:runQuery' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{"structuredQuery":{"select":{"fields":[{"fieldPath":"Nombre"},{"fieldPath":"matInm"}]},"from":[{"collectionId":"Inmueble","allDescendants":false}],"where":{"fieldFilter":{"field":{"fieldPath":"Nombre"},"op":"EQUAL","value":{"stringValue":"Cerros"}}}}}' \
  --compressed

得到

{
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"structuredQuery\" at 'document': Cannot find field.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "field": "document",
            "description": "Invalid JSON payload received. Unknown name \"structuredQuery\" at 'document': Cannot find field."
          }
        ]
      }
    ]
  }
}

我正在尝试将新的appGyver Composer Pro与Google Firebase配合使用(未成功)。 AppGyver使用REST API来获取数据库中的数据,但我无法使其正常工作。该数据库非常简单,并且具有...

rest google-cloud-firestore appgyver
2个回答
0
投票

您正在使用的端点用于列出集合的文档,而不是检索其内容。


0
投票

感谢Happy-Monad。我按照您的指导进行了工作:

© www.soinside.com 2019 - 2024. All rights reserved.