Swagger Powerapps难以访问集合中的JSON

Swagger Powerapps难以访问集合中的JSON,swagger,powerapps,Swagger,Powerapps,我很难通过PowerApps访问集合中的数据 我使用以下内容创建集合: Collect(coll15,mt.GetAnswers("3b....da","application/json",{question:"eco"})) 使用开发者工具->网络选项卡->响应正文-返回以下JSON数据: { "answers": [ { "answer": "This is the answer", "questions": [ "Private vehicle eco renewal"

我很难通过PowerApps访问集合中的数据

我使用以下内容创建集合:

Collect(coll15,mt.GetAnswers("3b....da","application/json",{question:"eco"}))
使用开发者工具->网络选项卡->响应正文-返回以下JSON数据:

{
"answers": [
{
  "answer": "This is the answer",
  "questions": [
    "Private vehicle eco renewal"
  ],
  "score": 82.901087775826454
}
]
}
集合已创建

然后,我将一个gallery控件添加到我的页面-但是我必须绑定到标签的唯一选项是:ThisItem.Value

如果我尝试输入ThisItem.Value.answer,则会出现错误:“.”的使用无效

如果我输入ThisItem.answers.answer,我会得到错误:名称无效

这是一个大摇大摆的文件:

{
"swagger": "2.0",
"info": {
  "version": "1.0.0",
  "title": "mt",
  "description": "mt"
},
"host": "westus.api.cognitive.microsoft.com:443",
"basePath": "/",
"schemes": [
  "https"
],
"consumes": [],
"produces": [
  "application/json"
],
"paths": {
  "/qnamaker/v2.0/knowledgebases/eeeee.....eeeee/generateAnswer": {
     "post": {
        "summary": "GetAnswers",
        "description": "Get answers from qna",
        "operationId": "GetAnswers",
        "parameters": [
           {
              "name": "body",
              "in": "body",
              "schema": {
                 "type": "object",
                 "properties": {
                    "question": {
                       "type": "string",
                       "description": "question",
                       "x-ms-summary": "question",
                       "title": "question",
                       "x-ms-visibility": ""
                    }
                 },
                 "default": {
                    "question": "hi"
                 },
                 "required": [
                    "question"
                 ]
              },
              "required": true
           }
        ],
        "responses": {
           "default": {
              "description": "default",
              "schema": {
                 "type": "string"
              }
           }
        }
     }
  }
},
"definitions": {},
"parameters": {},
"responses": {},
"securityDefinitions": {
  "api_key": {
     "type": "apiKey",
     "in": "header",
     "name": "Ocp-Apim-Subscription-Key"
  }
},
"security": [
  {
     "oauth2_auth": [
        "Offline-Access"
     ]
  }
],
"tags": []
}
我有没有办法访问集合中的答案文本

谢谢你的帮助


标记

问题在于连接器定义中操作的响应类型为字符串:

    "responses": {
       "default": {
          "description": "default",
          "schema": {
             "type": "string"
          }
       }
    }
但是你的反应是一个对象。如果将自定义连接器更新为使用类型化对象,则应该能够访问该操作的响应。按照下面的模式:

    "responses": {
      "default": {
        "description": "default",
        "schema": {
          "type": "object",
          "properties": {
            "answers": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "answer": {
                    "type": "string"
                  },
                  "questions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "score": {
                    "type": "number",
                    "format": "float"
                  }
                }
              }
            }
          }
        }
      }
    },
请注意,在门户网站(web.powerapps.com)中,如果转到自定义连接器定义并选择“编辑”,则可以转到操作并选择要编辑的响应:

然后使用“从样本导入”选项


这样,如果您输入来自API的响应示例,它将为您创建模式(类似于我上面的模式)。

什么是
mt
?您创建的自定义连接器还是现有连接器?如果是自定义连接器,您是否可以共享其OpenAPI/Swagger定义?您好-是,它是自定义连接器。我在中创建了它-我看不出如何下载这个招摇过市的文件。请您提供建议好吗?如果您访问web.powerapps.com,然后选择Data-->Custom Connectors(数据-->自定义连接器),您应该会看到您拥有的连接器列表,并从那里下载招摇。有关详细信息,请参阅。请记住,如果您共享swagger文件,请删除您不想共享的任何密钥/密码/信息。操作/对象定义可能是您遇到问题的地方。谢谢Carlos-我已经在我的问题中添加了swagger文件-我不确定需要更改什么(如果有)。