0

我正在开发一个燃料聊天机器人,它从谷歌驱动器获取文件内容来构建画廊。我正在使用 JSON API(燃料聊天机器人)来获取 JSON 响应。我在驱动器中的文件:https ://drive.google.com/file/d/0Bx79Tkj95Q3iNmVHOFN0Q3BITE0/view 我想得到 JSON 响应,如:

{
 "messages": [
    {
      "attachment":{
        "type":"template",
        "payload":{
          "template_type":"generic",
          "elements":[
            {
              "title":"Classic White T-Shirt",
              "image_url":"http://petersapparel.parseapp.com/img/item100-thumb.png",
              "subtitle":"Soft white cotton t-shirt is back in style",
              "buttons":[
                {
                  "type":"web_url",
                  "url":"https://petersapparel.parseapp.com/view_item?item_id=100",
                  "title":"View Item"
                },
                {
                  "type":"web_url",
                  "url":"https://petersapparel.parseapp.com/buy_item?item_id=100",
                  "title":"Buy Item"
                }
              ]
            },
            {
              "title":"Classic Grey T-Shirt",
              "image_url":"http://petersapparel.parseapp.com/img/item101-thumb.png",
              "subtitle":"Soft gray cotton t-shirt is back in style",
              "buttons":[
                {
                  "type":"web_url",
                  "url":"https://petersapparel.parseapp.com/view_item?item_id=101",
                  "title":"View Item"
                },
                {
                  "type":"web_url",
                  "url":"https://petersapparel.parseapp.com/buy_item?item_id=101",
                  "title":"Buy Item"
                }
              ]
            }
          ]
        }
      }
    }
  ]
}

我试图通过 URL 获取文件的内容:

https://www.googleapis.com/drive/v3/files/0Bx79Tkj95Q3iNmVHOFN0Q3BITE0/export?mimeType=application/vnd.google-apps.file

但我得到了回应 驱动响应

您对获取 JSON 响应有什么建议吗?

4

1 回答 1

0

考虑这个文档并再次测试。

你的错误是:

403:超出每日限制

已达到项目的礼貌 API 限制。

{
  "error": {
    "errors": [
      {
        "domain": "usageLimits",
        "reason": "dailyLimitExceeded",
        "message": "Daily Limit Exceeded"
      }
    ],
    "code": 403,
    "message": "Daily Limit Exceeded"
  }
}

建议采取的措施:申请额外配额

根据SO post,您可以执行以下操作来消除您的错误。

  1. 创建Google API 控制台项目
  2. 在“服务”窗格上,启用您的项目所需的所有 API。
  3. API 访问窗格中,单击创建 OAuth 2.0 客户端 ID。将打开一个对话框。填写您的项目信息。单击 下一步
  4. 选择适当的应用程序类型。根据您在这篇文章中使用的标签,我猜这是一个 iOS 项目,所以选择 Installed application
  5. 输入您的捆绑包 ID。在您的应用程序在此处列出之前,您无需输入 App Store ID。
  6. 单击创建客户 ID

您将看到客户端 ID 和客户端密码值。您将使用这些值来启用与您的项目和 Google API 的通信。

如果您尚未使用它,请参阅Google+ iOS SDK 和文档以进行完整的演练。名为“编写时刻”的任务在实现上类似,它演示了如何在使用 SDK 的 iOS 项目中连接和使用 Google+ REST API。

您需要指定 plus.me 的范围以获取配置文件信息。

希望这可以帮助。

于 2017-08-16T11:10:13.790 回答