0

curl コマンドを使用して github api に POST リクエストを発行し、「解決済み」ラベルを追加すると、物事は良いです。

curl -i -H "Authorization: token xxxxxxxxxxxx" -X POST 'https://git.corp.yahoo.com/api/v3/repos/owner/repo/issues/1/labels' -d '["Resolved"]'}

しかし、Ruby スクリプトで Curl easy を使用して同じことをしようとすると、

 set gh_api = https://git.corp.yahoo.com/api/v3/repos/owner/repo/issues/1/labels
 curl = Curl::Easy.http_post(settings.gh_api,'["Resolved"]') 
 do |c|
    c.headers = ["Authorization: token xxxxxxxx"]
 end

私が得るJSON応答は

"{\"message\":\"Not Found\"}"

私のルビースクリプトで何が間違っていますか?

4

2 に答える 2

0

質問がないので、あなたが何を質問しているのかはまったく明確ではありません。

返されるのは JSON 応答です。JSON クラスを使用して解析し、返される内容を確認してみませんか。

require 'json'

puts JSON["{\"message\":\"Not Found\"}"]
=> {"message"=>"Not Found"}

応答が「見つかりません」の場合、問題は URL のパスにあると推測しています。

于 2013-04-30T19:16:25.867 に答える