【问题标题】:Yammer Data export API shows HTTP/1.1 400 Bad RequestYammer 数据导出 API 显示 HTTP/1.1 400 错误请求
【发布时间】:2015-12-03 09:39:32
【问题描述】:

我正在使用 Yammer 数据导出 API 将数据提取到本地,使用 curl 发送请求。

$AT #access token
curl -v --output export.zip \
  --header "Authorization: Bearer $AT" \
  --get --data-urlencode since=$DATE \
  "https://www.yammer.com/api/v1/export"

如示例:https://developer.yammer.com/docs/data-export-api

虽然它总是在请求检索数据时显示错误。

* Connected to www.yammer.com (192.168.1.1) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Server hello (2):
{ [data not shown]
* SSLv3, TLS handshake, CERT (11):
{ [data not shown]
* SSLv3, TLS handshake, Server key exchange (12):
{ [data not shown]
* SSLv3, TLS handshake, Server finished (14):
{ [data not shown]
* SSLv3, TLS handshake, Client key exchange (16):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Finished (20):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
{ [data not shown]
* SSL connection using ECDHD-RSA-AES256-GCU-SSA324
* Server certificate:
*    start date: 2013-01-01 00:00:00 GMT
*    expire date: 2017-01-01 12:00:00 GMT
*    subjectAltName: www.yammer.com matched
*    SSL certificate verify ok.
> GET /api/v1/export HTTP/1.1
> User-Agent: curl/7.35.0
> Host: www.yammer.com
> Accept: */*
> Authorization: Bearer 12252-xxxxxxxx
> 
< HTTP/1.1 400 Bad Request
< Date: Wed, 31 Nov 2015 16:06:49 GMT
< Content-Type: application/zip
< Transfer-Encoding: chunked
< 
{ [data not shown]
* Connection #0 to host www.yammer.com left intact

我使用的access-token属于经过验证的admin,基于这个access-token使用REST API是可以的。

谁能给我一些建议?

【问题讨论】:

  • 为什么 www.yammer.com 解析为 192.168.1.1?
  • 不,解析到公司的IP
  • 看起来 HTTP 400 是因为验证的管理员访问令牌无效,我正在使用找到的 Yammer 应用授权来检索访问令牌,如developer.yammer.com/docs/oauth-2 所述。另外检查了 current.json,它显示了我正在使用经过验证的管理员令牌的令牌。除了authorization_code post之外,是否还有其他方法可以获取经过验证的管理员访问令牌?因为现在检索到的这个令牌是无效的。

标签: curl yammer


【解决方案1】:

您是否设置了 $DATE? export.zip 中是否有任何调试信息(压缩或其他方式)?

【讨论】:

  • 我已设置 %DATE,zip 文件不包含任何数据,但 zip 文件已损坏。我也尝试过使用 wget,它显示相同的错误 400 错误请求。另外,当使用 curl 检索 .json(REST API) 时显示正确。我在想这个程序是否需要通过域帐户的机器运行。现在我正在外部计算机下运行它。
  • 如果您cat ZIP 文件会发生什么?我怀疑这不是损坏的 ZIP 文件,而是服务器发回了一个错误,该错误存储在名为 export.zip 的文件中。如果是这种情况,则 Content-Type 标头是错误的,应该类似于 text/plain
猜你喜欢
  • 2017-07-21
  • 1970-01-01
  • 2015-04-10
  • 1970-01-01
  • 2023-03-11
  • 1970-01-01
  • 2014-10-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多