我想要的只是登录,从一个简单的过滤器显示信息,就像一个里程碑中的所有开放的错误.一旦我得到了那么多病,能够解决文档问题
我希望使用简单的PHP,因为我是PHP的新手,因此编码越复杂,我就越难以弄明白.
这个脚本是我最接近成功的脚本:
<?php
define('JIRA_URL', 'https://mysite.atlassian.net');
define('USERNAME', 'me@gmail.com');
define('PASSWORD', '11111');
function post_to($resource, $data) {
$jdata = json_encode($data);
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_POST => 1,
CURLOPT_URL => JIRA_URL . '/rest/api/2/' . $resource,
CURLOPT_USERPWD => USERNAME . ':' . PASSWORD,
CURLOPT_POSTFIELDS => $jdata,
CURLOPT_HTTPHEADER => array('Content-type: application/json'),
CURLOPT_RETURNTRANSFER => true
));
$result = curl_exec($ch);
curl_close($ch);
return json_decode($result);
}
function create_issue($issue) {
return post_to('issue', $issue);
}
$new_issue = array(
'fields' => array(
'project' => array('key' => 'FOO'),
'summary' => 'Test via REST', …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Jira 的 python API 将问题分配给史诗。从文档中,我发现 GreenHopper 类中有一个 add_issues_to_epic 方法,但它似乎对我不起作用。到目前为止,我有以下内容
from jira.client import JIRA
from jira.client import GreenHopper
jira = JIRA(options, basic_auth=(username, password))
greenhopper = GreenHopper(options, basic_auth=(username, password))
epicLink = 'IR-345'
issuesToAdd = ['IR-1459']
greenhopper.add_issues_to_epic(epicLink, issuesToAdd)
Run Code Online (Sandbox Code Playgroud)
但这给了我一个错误,即找不到 GreenHopper 类的 add_issues_to_epic。我试过 jira.add_issues_to_epic(epicLink, issuesToAdd),但这给了我同样的错误。
我究竟做错了什么?
我正在使用Jira的API将附件文件添加到案例中.我的问题是在我的代码附加了一个文件后,我转到JIRA案例进行确认,我看到了两件事.首先,如果是图像,我可以看到图像的缩略图.但是,如果我点击它,我会收到错误消息"无法加载请求的内容.请重试." 其次,在缩略图下,它没有显示文件的名称,而是具有文件最初上传的路径(id:c:/ wamp/www/...."这是否有原因发生?这里是我的代码:
$ch = curl_init();
$header = array(
'Content-Type: multipart/form-data',
'X-Atlassian-Token: no-check'
);
$attachmentPath = $this->get_file_uploads();
//$attachmentPath comes out to be something like:
//c:/wamp/www/mySite/web/system/files/my_folder/DSC_0344_3.JPG
$data = array('file'=>"@". $attachmentPath, 'filename'=>'DSC_0344_3.JPG');
$url= 'https://mysite.atlassian.net/rest/api/2/issue/20612/attachments/';
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS ,$data);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "myusername:mypassword");
$result = curl_exec($ch);
$ch_error = curl_error($ch);
Run Code Online (Sandbox Code Playgroud)
一旦文件被添加到Jira,当我登录jira时,我可以看到缩略图,但文件下的标题是:c:/wamp/www/mySite/web/system/files/my_folder/DSC_0344_3.JPG的文件名.
谢谢
我正在尝试在 Jira 中创建一个问题。
我能够以正确的响应发出 GET 请求,但是当我发出 POST 请求时出现问题。这是代码。
<?php
$userName ='xxxxxxxxxxxxxxxx';
$password ='xxxxxxxxxxxx';
$data = ['fields' => ['projects'=>['key'=>'ABC'],'summary'=>'abc','description'=>'abc','issuetype'=>['name'=>'Task']]];
$data = http_build_query($data);
$context =
array("http"=>
array(
"method" => "POST",
"header" => "Authorization: Basic " . base64_encode($userName.':'.$password) . "\r\n".
'Accept: application/json'."\r\n".
"Content-Length: ".strlen($data)."\r\n".
'Content-Type: application/json'."\r\n",
'content' => $data,
'verify_peer'=>false,
'verify_peer_name'=>false,
)
);
$context = stream_context_create($context);
$result = file_get_contents("https://xxxxx.atlassian.net/rest/api/2/issue/", false, $context);
echo "The result is ", $result;
Run Code Online (Sandbox Code Playgroud)
?>
我收到以下错误:
Warning:file_get_contents(https://xxxxx.atlassian.net/rest/api/2/issue/):
failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in
/var/www/html/test/new.php …Run Code Online (Sandbox Code Playgroud) 我希望在 JIRA 中设置智能提交,但我的开发人员想知道他们转换的所有选项。为了帮助他们,我想打印一份所有转换名称的备忘单(我相信他们足够聪明,可以从那里弄清楚什么是什么)。
但是当我查看 REST API 文档时,我只能找到一种方法来获取特定问题的转换列表(大概是通过其状态)。有没有办法获取任何工单可以在其工作流程中的任何点进行的所有转换的列表?
我以前用Java创建了一个轻松的客户端应用程序来批量处理票证和加快工作流,但是,我想创建一个更完整的应用程序,该应用程序利用实际的JIRA api而不是在自己的解决方案中解析JSON。我有一个非常简单的代码块来创建客户端:
public class SimpleMain {
public static void main(String[] args) {
try {
JiraRestClient client = new AsynchronousJiraRestClientFactory()
.createWithBasicHttpAuthentication(new URI("https://jira.redacted.com"), "redacted", "redacted");
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
尝试创建简单的AsynchronousJiraRestClientFactory会导致以下异常:
15:12:06.625 [main] DEBUG c.a.j.r.c.i.a.AsynchronousHttpClientFactory$MavenUtils - Could not find version for maven artifact com.atlassian.jira:jira-rest-java-com.atlassian.jira.rest.client
15:12:06.633 [main] DEBUG c.a.j.r.c.i.a.AsynchronousHttpClientFactory$MavenUtils - Got the following exception
java.lang.NullPointerException: null
at java.util.Properties$LineReader.readLine(Properties.java:434) ~[na:1.8.0_51]
at java.util.Properties.load0(Properties.java:353) ~[na:1.8.0_51]
at java.util.Properties.load(Properties.java:341) ~[na:1.8.0_51]
at com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory$MavenUtils.getVersion(AsynchronousHttpClientFactory.java:158) ~[jira-rest-java-client-core-3.0.0.jar:na]
at com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory$RestClientApplicationProperties.getVersion(AsynchronousHttpClientFactory.java:121) [jira-rest-java-client-core-3.0.0.jar:na]
at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClient.getUserAgent(DefaultHttpClient.java:168) [atlassian-httpclient-apache-httpcomponents-0.13.2.jar:na]
at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClient.<init>(DefaultHttpClient.java:139) [atlassian-httpclient-apache-httpcomponents-0.13.2.jar:na]
at com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory.createClient(AsynchronousHttpClientFactory.java:53) …Run Code Online (Sandbox Code Playgroud) 我对使用 JIRA 还很陌生,目前我正在使用 curl 来调用 jira rest 命令。我想通过休息获得问题的受让人,但我似乎找不到如何做到这一点的方法。
我正在尝试获取所有 JIRA 问题的列表,以便我可以通过以下方式遍历它们:
from jira import JIRA
jira = JIRA(basic_auth=('username', 'password'), options={'server':'https://MY_JIRA.atlassian.net'})
issue = jira.issue('ISSUE_KEY')
print(issue.fields.project.key)
print(issue.fields.issuetype.name)
print(issue.fields.reporter.displayName)
print(issue.fields.summary)
print(issue.fields.comment.comments)
Run Code Online (Sandbox Code Playgroud)
上面的代码返回所需的字段(但一次只有一个问题),但是,我需要能够将所有问题键的列表传递到:
issue = jira.issue('ISSUE_KEY')
Run Code Online (Sandbox Code Playgroud)
这个想法是编写一个 for 循环来遍历这个列表并打印指定的字段。
我无法填充此列表。
有人可以指出我正确的方向吗?
尝试创建特定的新 jira 票证requestType,但它嵌套了两层深。尝试了一些可能的改变,但没有运气。这是我的代码,
require 'jira-ruby' # https://github.com/sumoheavy/jira-ruby
options = {
:username => jira_username,
:password => jira_password,
:site => 'https://jiraurl/rest/api/2/',
:context_path => '',
:auth_type => :basic,
:read_timeout => 120
}
client = JIRA::Client.new(options)
issue = client.Issue.build
fields_options = {
"fields" =>
{
"summary" => "Test ticket creation",
"description" => "Ticket created from Ruby",
"project" => {"key" => "AwesomeProject"},
"issuetype" => {"name" => "Task"},
"priority" => {"name" => "P1"},
"customfield_23070" =>
{
"requestType" => {
"name" => "Awesome Request Type" …Run Code Online (Sandbox Code Playgroud) 我需要使用 JIRA REST 客户端版本 5.2.0 或更高版本。Cloud JIRA 不适用于早期版本的客户端。
在我的pom.xml文件中,我有以下依赖项:
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client-core</artifactId>
<version>5.2.1</version>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client-app</artifactId>
<version>5.2.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
当我构建项目时,我遇到这样的异常:
Failed to execute goal on project XXXXXXXXX: Could not resolve dependencies for project XXXXXXXXXX:jar:XXXX: Failed to collect dependencies at com.atlassian.jira:jira-rest-java-client-core:jar:5.2.1: Failed to read artifact descriptor for com.atlassian.jira:jira-rest-java-client-core:jar:5.2.1: Could not find artifact com.atlassian.platform:platform:pom:3.1.7 in MY_REPO (http://XXXXXXXXXX/repository/maven-public) -
Run Code Online (Sandbox Code Playgroud)
com.atlassian.platform:platform:pom:3.1.7未在mvnrepository中列出。有版本3.1.12和3.1.17,但没有3.1.7。有人告诉我该版本3.1.7可能存在与安全相关的错误,因此被 Atlassian 删除。
和jira-rest-java-client-app都是jira-rest-java-client-parentjira-rest-java-client-core的子级,它使用该平台的版本: …