0

我创建了一个基本脚本,用于检查收件箱中的电子邮件,昨天一切正常。但是今天,当我运行相同的代码时,我得到的只是 HTTP404。

我怀疑 outlook.office365.com 可能会限制我的请求,因为我每分钟运行 1 次,持续了大约 36 小时。但是我怎么知道是不是这样呢?

这是我的 curl 命令:

curl https://outlook.office365.com/api/1.0/Me/folders/Inbox/messages -u login@email.outlook:password --insecure --show-error -H Content-Type:application/json -v

和输出:

* About to connect() to outlook.office365.com port 443 (#0)
*   Trying 132.245.48.18... connected
* Connected to outlook.office365.com (132.245.48.18) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using AES256-SHA
* Server certificate:
*        subject: C=US; ST=WA; L=Redmond; O=Microsoft Corporation;     OU=Microsoft Corporation; CN=outlook.com
*        start date: 2015-02-13 00:38:15 GMT
*        expire date: 2016-02-13 00:38:15 GMT
*        subjectAltName: outlook.office365.com matched
*        issuer: C=US; ST=Washington; L=Redmond; O=Microsoft Corporation;     OU=Microsoft IT; CN=Microsoft IT SSL SHA1
*        SSL certificate verify ok.
* Server auth using Basic with user 'login@email.outlook'
> GET /api/1.0/Me/folders/Inbox/messages HTTP/1.1
> Authorization: Basic Ybase64stringU=
> User-Agent: curl/7.21.3 (x86_64-pc-linux-gnu) libcurl/7.21.3     OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: outlook.office365.com
> Accept: */*
> Content-Type:application/json
>
< HTTP/1.1 404 Not Found
< Content-Length: 0
< Server: Microsoft-IIS/8.0
< request-id: d7967869-c282-4a28-9da2-6b80edd7d965
< Set-Cookie: ClientId=XXQW0EIP0KK9NUIRICS8BQ; expires=Fri, 28-Oct-2016     13:04:08 GMT; path=/; secure; HttpOnly
< X-CalculatedBETarget: AM2PR09MB0452.eurprd09.prod.outlook.com
< X-BackEndHttpStatus: 404
< X-DiagInfo: AM2PR09MB0452
< X-BEServer: AM2PR09MB0452
< X-Powered-By: ASP.NET
< X-FEServer: HE1PR01CA0033
< Date: Thu, 29 Oct 2015 13:04:08 GMT
<
* Connection #0 to host outlook.office365.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):

有任何想法吗?

4

1 回答 1

1

如果您超出了配额,我希望您会收到一个429状态码。Microsoft 通常不会为其服务发布确切的阈值,因为他们保留调整它们的权利......

因此用户可以在不降低可靠性和性能的情况下消耗最大数量的资源

(上面的引用是专门针对 Sharepoint 的,但鉴于几乎所有 REST API 都没有公布的限制,我想这个原则是成立的)。

404通常表明某些事情不太正确...如果您的用户帐户相当新,则可能表明它尚未传播到所有服务器(尽管在您的情况下这似乎不是问题,因为您必须有帐户超过 24 小时)。

从 URL 的角度来看...... v1 URL 是outlook.office.com/api/v1.0/me/messages,新的 beat URL 是outlook.office.com/api/v1.0/me/messages这些地址似乎对我有用......但如果我使用您正在使用的地址,我会得到 404......所以请仔细检查网址。

于 2015-10-29T13:37:10.367 回答