0

xily cURL tutorialに従おうとしています。開発モードで新しいデバイスを作成し、デフォルトの自動生成された API キー (READ、WRITE、CREATE、DELETE 権限を持つ) をチュートリアルの例にコピーし、応答を取得しました。

{"title":"Forbidden","errors":"You do not have the necessary permissions to access this resource"}

明らかなステップが欠けているに違いありません。スクリプトで API キーを使用する前に、何らかの方法で API キーを有効にする必要がありますか?

cURL コマンド:

curl --request POST \
--data '{"title":"My feed", "version":"1.0.0"}' \
--header "X-ApiKey: cPHLfGw1WJdMAbU8FzbfsdFyJ8suayHEH3OChRrkpYwQCmrb" \ 
--verbose \
https://api.xively.com/v2/feeds

完全な詳細出力:

* About to connect() to api.xively.com port 443 (#0)
*   Trying 216.52.233.120...
* Connected to api.xively.com (216.52.233.120) 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 key exchange (12):
* 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 ECDHE-RSA-RC4-SHA
* Server certificate:
*    subject: C=US; postalCode=01801; ST=MA; L=Woburn; street=First Floor; street=500 Unicorn Park Drive; O=LogMeIn Inc.; OU=Secure Link SSL Wildcard; CN=*.xively.com
*    start date: 2013-05-07 00:00:00 GMT
*    expire date: 2014-04-27 23:59:59 GMT
*    subjectAltName: api.xively.com matched
*    issuer: C=US; O=Network Solutions L.L.C.; CN=Network Solutions Certificate Authority
*    SSL certificate verify ok.
> POST /v2/feeds HTTP/1.1
> User-Agent: curl/7.29.0
> Host: api.xively.com
> Accept: */*
> X-ApiKey: cPHLfGw1WJdMAbU8FzbfsdFyJ8suayHEH3OChRrkpYwQCmrb
> Content-Length: 38
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 38 out of 38 bytes
< HTTP/1.1 403 Forbidden
< Date: Sat, 30 Nov 2013 11:03:15 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 98
< Connection: keep-alive
< X-Request-Id: 6cbb9676b448a4967187271dd246b423f7da2e39
< 
* Connection #0 to host api.xively.com left intact
{"title":"Forbidden","errors":"You do not have the necessary permissions to access this resource"}
4

2 に答える 2

0

URL の末尾にフィード ID を追加する必要があると思います。

于 2013-12-01T14:07:35.043 に答える