Jira Soap with a Php

两盒软妹~` 提交于 2019-12-01 11:55:22

Yes it can be done, using SOAP or XML-RPC.

Using the APIs is pretty much straight forward - have a look at the API documentation to find the right functions for you. your code should look something like :

<?
$soapClient = new SoapClient("https://your.jira/rpc/soap/jirasoapservice-v2?wsdl");
$token = $soapClient->login('user', 'password');
...  
... # get/create/modify issues
... 
?>

Example of adding a new comment:

$issueKey = "key-123";
$myComment = "your comment";

$soapClient = new SoapClient("https://your.jira/rpc/soap/jirasoapservice-v2?wsdl");
$token = $soapClient->login('user', 'password');
$soapClient->addComment($token, $issueKey, array('body' => $myComment));

Example of creating an issue:

$issue = array(
    'type'=>'1',
    'project'=>'TEST',
    'description'=>'my description',
    'summary'=>'my summary',
    'priority'=>'1',
    'assignee'=>'user',
    'reporter'=>'user',
);
$soapClient = new SoapClient("https://your.jira/rpc/soap/jirasoapservice-v2?wsdl");
$token = $soapClient->login('user', 'password');
$soapClient->createIssue($token, $issue);

Note that you need to install php-soap in linux (or it's equivalent in windows) to be able to use the SOAP library.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!