通过REST API(php)在Jira中的受让人

问题描述 投票:0回答:2

我想将受让人发行给另一个人。

我有代码,但是没有用。为什么?谁可以帮助我?

可能某些参数错误吗?

如果我通过此登录名进入JIRA并通过,则可以更改代理人

    function send_to_jira($url, $data) {

    $username = '[email protected]';
    $password = 'bot_password';

    $curl = curl_init();
    $headers = array(
        'Accept: application/json',
        'Content-Type: application/json'
    );
    curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($curl, CURLINFO_HEADER_OUT, true);

    $result = curl_exec($curl);
    $info = curl_getinfo($curl);
    curl_close($curl);
    return $result;
}

        $data = array(
            "fileds" => array(
                "assignee" => array("name" => "newusername")
            ),
        );
        $url = 'https://site/rest/api/2/issue/ISSUE';
        $result = send_to_jira($url, $data);
php rest api jira jira-rest-api
2个回答
0
投票

[如果您刚刚复制了代码,则在要发送的$data对象中有一个错字:您必须写fields而不是fileds。或者,您也可以使用issue/<issue>/assignee端点。请参阅servercloud的文档。

此外,如果要调用Jira Cloud REST API,请注意有关basic authenticationusernames的弃用声明。


0
投票

代替

   ("name" = "newusername")

使用

("accountId" = "5b109f2e9xxxb51b54dc274d")   
© www.soinside.com 2019 - 2024. All rights reserved.