1

我正在使用 Google Mirror API 并创建一些示例应用程序。由于我不是探险家,我使用的是Sturm 的 Mirror API

我想知道有效的 JSON 格式以将一段文本分享给特定的 Google Glass 联系人。我在API Explorer中尝试了以下 JSON,但收到 400 错误请求错误。还有没有办法通过Google Glass Playground而不是 API explorer来做同样的事情?

{
    'recipients': [
        {
            'acceptTypes': [
                'text/plain'
            ],
            'displayName': 'myglassapp',
            'imageUrls': [
                'https://myglassapp.appspot.com/images/welcome.jpg'
            ],
            'id': 'babu_glass_app'
        }
    ],
    'kind': 'mirror#timelineItem',
    'isDeleted': False,
    'text' : 'Hello World',
}

错误:

400 Bad Request

- Hide headers -

cache-control:  private, max-age=0
content-encoding:  gzip
content-length:  118
content-type:  application/json; charset=UTF-8
date:  Thu, 30 May 2013 08:05:47 GMT
expires:  Thu, 30 May 2013 08:05:47 GMT
server:  GSE
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "parseError",
    "message": "Parse Error"
   }
  ],
  "code": 400,
  "message": "Parse Error"
 }
}
4

1 回答 1

1

哎呀..我的坏。Python dict 到 JSON 的问题。False而不是false. 现在卡正在插入。

{
    'recipients': [
        {
            'acceptTypes': [
                'text/plain'
            ],
            'displayName': 'myglassapp',
            'imageUrls': [
                'https://myglassapp.appspot.com/images/welcome.jpg'
            ],
            'id': 'babu_glass_app'
        }
    ],
    'kind': 'mirror#timelineItem',
    'isDeleted': false,
    'text' : 'Hello World',
}
于 2013-05-30T09:44:05.437 回答