2011-12-27 10 views
3

私はそれぞれの応答で次のコマンドを実行しました。
しかし、私が/userに関する情報を取得しようとすると、それは動作します、魔法使いは私のトークンが有効であることを意味します。Github Api v3レポを作成しようとすると404が表示される

私は間違っていますか?

[email protected]:~/$ curl -v -XPOST -H 'Authorization: token S3CR3T' -H 'Content-Type: application/json; charset=utf-8' https://api.github.com/user/repos -d '{"name":"my-new-repo","description":"my new repo description"}' 

出力:

* About to connect() to api.github.com port 443 (#0) 
* Trying 207.97.227.243... connected 
* Connected to api.github.com (207.97.227.243) 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: O=*.github.com; OU=Domain Control Validated; CN=*.github.com 
* start date: 2009-12-11 05:02:36 GMT 
* expire date: 2014-12-11 05:02:36 GMT 
* subjectAltName: api.github.com matched 
* issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certificates.godaddy.com/repository; CN=Go Daddy Secure Certification Authority; serialNumber=07969287 
* SSL certificate verify ok. 
> POST /user/repos HTTP/1.1 
> 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: api.github.com 
> Accept: */* 
> Authorization: token S3CR3T 
> Content-Type: application/json; charset=utf-8 
> Content-Length: 62 
> 
< HTTP/1.1 404 Not Found 
< Server: nginx/1.0.4 
< Date: Tue, 27 Dec 2011 03:45:12 GMT 
< Content-Type: application/json; charset=utf-8 
< Connection: keep-alive 
< Status: 404 Not Found 
< X-RateLimit-Limit: 5000 
< ETag: "31b00b4920d3470b70611b10e0ba62a7" 
< X-OAuth-Scopes: public_repo, user 
< X-RateLimit-Remaining: 4976 
< X-Accepted-OAuth-Scopes: repo 
< Content-Length: 29 
< 
{ 
    "message": "Not Found" 
} 
* Connection #0 to host api.github.com left intact 
* Closing connection #0 
* SSLv3, TLS alert, Client hello (1): 
[email protected]:~/projetos/apostilas/4linux-helper$ 

答えて

2

Oath Scope GitHub documentationを確認してください:

$ curl -H "Authorization: bearer TOKEN" https://api.github.com/users/technoweenie -I 
HTTP/1.1 200 OK 
X-OAuth-Scopes: repo, user 
X-Accepted-OAuth-Scopes: user 

によって示されているようにあなたは、レポを作成する権限を持つためにrepoスコープを持っている必要がありますSOの質問は "Github v3 API - create a REPO"です。

repo 

DBは、読み取り/書き込みアクセス権を、とGitは、パブリックとプライベートリポジトリへのアクセスをお読みください。

注:アプリケーションは、最初のリダイレクトでスコープを要求できます。
複数のスコープをカンマで区切って指定できます。

https://github.com/login/oauth/authorize? 
    client_id=...& 
    scope=user,public_repo 
+0

を使用してみてください、私は知っているが、あなたはそのサービスが返すヘッダの表情を取る場合。私はすでにこれらのスコープに登録されています: gutomaia

+0

@gutomaia:唯一の違いは '' public_repo' 'の代わりに '' repo''ですが、パブリックリポジトリを管理するためにのみ使用されます(プライベートレポは管理しません)。唯一の他の説明は、どこかの型/間違ったパラメータです。 – VonC

+0

残念ながら、パラメータには何も問題はありません。無効なトークンアクセスを使用すると、サービスは不正なエラーを出します。私は本当に理由を知らない。メソッド名は大丈夫です、paramsは大丈夫です、トークンは大丈夫です、content-typeは大丈夫です。ほかに何か?! – gutomaia

1

curl -v -X POST -H 'Content-Type: application/x-www-form-urlencoded' -d '{"name":"my-new-repo","description":"my new repo description"}' https://api.github.com/user/repos?access_token=S3CR3T 
関連する問題