0
GET Request(私がGETリクエストを作成するためのリンクをクリックしてください)をBugzilla REST APIにすることができます認証にユーザー名/パスワードは必要ありません。ただし、バグ(POSTリクエスト)を作成するには、ユーザー名とパスワードが必要です。 APIキーも生成しましたが、PHPプログラム内からAPIキーを使用してBugzillaサーバーへのREST POST呼び出しを行う方法に関するドキュメントは見つかりませんでした。次のプログラムを実行すると、エラーが発生します。この部分を使用する前に、Bugzilla。code:410にログインする必要があります。問題を解決するための助けをいただければ幸いです。Bugzilla RESTインターフェイス - APIリクエストを受け取るためにAPIキーを提供する方法
$url ="http://localhost:8080/bugzilla/rest/bug";
$apikey = "IZC4rs2gstCal0jEZosFjDBRV9AQv2gF0udh4hgq";
$data = array(
"product" => "TestProduct",
"component" => "TestComponent",
"version" => "unspecified",
"summary" => "This is a test bug - please disregard",
"alias" => "SomeAlias",
"op_sys" => "All",
"priority" => "P1",
"rep_platform" => "All"
);
$str_data = json_encode($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$str_data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array("Content-Type: application/json", "Accept: application/json"));
$username = "[email protected]";
$password = "abbincrc";
curl_setopt($ch, CURLOPT_USERPWD, $username.":".$password);
$result = curl_exec($ch);
curl_close($ch);
echo $result