我从Jira Atlassian API中提取信息,我使用其他代码,它工作正常,我将其更改为json,所有信息作为对象返回.
但是在这种情况下我收到此服务器错误:PHP Catchable致命错误:类411 stdClass的对象无法转换为第411行/usr/local/vhosts/999/webspace/httpdocs/mysite/filters1.php中的字符串
现在这里是我试图运行的代码:
$username = 'xxx@gmail.com';
$password = 'xxxxxxx';
$url = 'xxx.atlassian.net/rest/api/2/search?jql=project+%3D+bug+AND+component+%3D+%22issues%22+AND+status+in+(Open,+Reopened)';
$headers = array(
'Accept: application/json',
'Content-Type: application/json'
);
$ch = curl_init();
$test = "This is the content of the custom field.";
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, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
//curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
$result = curl_exec($ch);
$issue_json = json_decode($result);
$ch_error = curl_error($ch);
if ($ch_error) {
echo "cURL Error: $ch_error"; …Run Code Online (Sandbox Code Playgroud) 我想从其余 api 将问题状态更新为已完成或为 true,我尝试了一些链接和文档,但失败且不起作用,我的 json 数据和 url 如下,请查看并让我知道我错在哪里。
我点击此链接更新问题状态已完成。
jQuery.ajax({
url :'https://myurl.com/rest/api/latest/issue/10635',
type: 'PUT',
beforeSend : function(xhr) {
xhr.setRequestHeader("Authorization", "Basic " + 'QXNjiYIklOZvcxlxhZ3NodXNldA==');
},
data: JSON.stringify({"status":{"id":"10635","name":"done"}}}),
dataType: 'json',
contentType:'application/json; charset=utf8',
success: function(data){
console.log(data);
}
})
Run Code Online (Sandbox Code Playgroud)
我的json如下
{"status":{"id":"10635","name":"done"}}}
Run Code Online (Sandbox Code Playgroud)
我检查了 fiddler 上的响应,但在 fiddler 响应中出现以下错误。
{“errorMessages”:[“需要‘字段’或‘更新’之一”],“错误”:{}}
之后我将 json 数据更改如下,但也不起作用,
{"update":{"status":{"id":"10635","name":"done"}}}
Run Code Online (Sandbox Code Playgroud)
然后我在小提琴中看到了如下错误。
{“errorMessages”:[“无法从 START_OBJECT 令牌中反序列化 java.util.ArrayList 的实例\n [来源:org.apache.catalina.connector.CoyoteInputStream@19d2e36;行:1,列:12](通过引用链: com.atlassian.jira.rest.v2.issue.IssueUpdateBean[\"update\"])"]}
它浪费了我大约 2.5 个小时的时间,请帮助我哪里错了?
我需要更新“事项”字段(单选列表)。最好的方法是什么?
我有一个批量值(超过 100 个)要添加到自定义字段中。有什么方法可以通过使用 API 来做到这一点吗?我也检查了链接
但这里也没有提及任何内容。
关于如何对仅限内部的问题创建评论,确实很难找到明确的答案。
我正在尝试编写一个 shell 脚本,用 JIRA 自动化我的工作流程。我的目标是:
jira_flow start $KEY
Run Code Online (Sandbox Code Playgroud)
脚本的步骤如下:
因此,我需要一种方法来获取问题的摘要。
首先,我尝试使用issueAPI 和grep.
curl http://jira.local:8081/rest/api/2/issue/$KEY | \
json_pp | \
grep sumarry
# produces:
"summary" : "linked issue summary 1"
"summary" : "linked issue summary 2"
"summary" : "sub-task summary 1"
"summary" : "sub-task summary 2"
"summary" : "sub-task summary 3"
"summary" : "issue summary"
Run Code Online (Sandbox Code Playgroud)
这种方法给了我很多结果,因为它还打印了链接的工单和子任务的摘要。
我的第二次尝试是使用searchAPI 并限制要检索的字段。这种方法失败了,因为我无法通过它的key.
curl http://jira.local:8081/rest/api/2/search?jql=key=$KEY
# returns:
no matches found: http://jira.local/rest/api/2/search?jql=key=$KEY
Run Code Online (Sandbox Code Playgroud)
有什么建议吗?
url = "https://example.com/jira/rest/api/2/issue/issue_key/comment"
data = json.dumps({"body": 'some string'})
headers = {'content-type':'application/json'}
r = requests.post(url, data, auth=('username', 'password'))
Run Code Online (Sandbox Code Playgroud)
-> r.status_code输出是415。
但是在
r = requests.get(url, data, auth=('username', 'password'))
Run Code Online (Sandbox Code Playgroud)
-> r.status_code输出是200。请帮助我确定问题。
我试图获取项目中的所有用户,我浏览了此 API https://docs.atlassian.com/software/jira/docs/api/REST/7.9.2/#api/2/ user-findAssignableUsers,但不知道为什么我收到 {"errorMessages":["Internal server error"],"errors":{}}。
我还关注了这篇文章https://community.atlassian.com/t5/Answers-Developer-Questions/List-of-users-in-project-REST-API/qaq-p/536820但我收到 401 未经授权,由于我没有管理员权限,因此无法使用上面文章中提到的插件。我被困住了:(。如果有人能帮助我,我将不胜感激。谢谢。
我正在尝试获得项目的所有问题,然后找到哪些已完成,但我不知道如何.
我将用户连接到Jira,并希望得到他所有的项目和所有问题.然后我想找到,完成了哪些问题.请问有人帮帮我吗?
我有这个:
Iterable <BasicProject> allProj;
this.yourUsername = userName;
this.yourPassword = password;
this.jiraServerUri = new URI("https://applifting.atlassian.net");
this.factory = new JerseyJiraRestClientFactory();;
this.restClient = factory.createWithBasicHttpAuthentication(jiraServerUri, yourUsername, yourPassword);
final NullProgressMonitor pm = new NullProgressMonitor();
allProj = this.restClient.getProjectClient().getAllProjects(pm);
for(Iterator<BasicProject> i = allProj.iterator(); i.hasNext(); ) {
BasicProject proj = i.next();
Project ActualProject = this.restClient.getProjectClient().getProject(proj.getKey(), pm);
ComponentRestClient cm =
}
Run Code Online (Sandbox Code Playgroud)
我想在这个for循环中,当我拥有所有项目时,我应该得到所有问题.
这个问题是因为行:mail = Outlook.CreateItem(0)吗?我想在Python中的for循环中发送n封电子邮件。
for aaa in jira.search_issues(JQL,startAt=0, maxResults=50):
print(aaa)
try:
tworca = (jira.issue(aaa).fields.creator.name)
przypisany =(jira.issue(aaa).fields.assignee.name)
import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = tworca + ';' + przypisany
mail.Subject = 'blablabla'
mail.Body = 'Message body'
mail.send()
print ("OK!")
except Exception as e:
print("ERROR: " + str(e))
print ("done!")
Run Code Online (Sandbox Code Playgroud)
追溯:
Traceback (most recent call last):
File "C:\xxx\xxx\xxx\xxx.py", line 12, in <module>
mail.send()
TypeError: 'bool' object is not callable
Run Code Online (Sandbox Code Playgroud) 我想更改 Jira 上项目问题的状态。状态是Open,我想将其设为固定。我的网址是 PUT https://jiradbg-sandbox.deutsche-boerse.de/rest/api/latest/issue/PID-XX
{
"update": {
"fields":{
"status": [
{
"set": "Fixed"
}
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
响应是:
{
"errorMessages": ["Can not deserialize instance of java.util.ArrayList out of START_OBJECT token\n at [Source: org.apache.catalina.connector.CoyoteInputStream@5de98556; line: 3, column: 9]
(through reference chain: com.atlassian.jira.rest.v2.issue.IssueUpdateBean[\"update\"])"]
}
Run Code Online (Sandbox Code Playgroud)