标签: jira-rest-api

从JIRA REST API获取当前经过身份验证的用户

到目前为止,我所见过的JIRA REST api上的文档和示例并未涵盖您要标识特定主机上当前登录用户的情况(没有关于它们的先前信息)。

我想这样做,所以我只能说“将所有问题分配给我”,而不是“将所有问题分配给鲍勃”(因为我必须为此知道用户名“鲍勃”)。

这可能吗?

非常感谢

jira-rest-api

1
推荐指数
1
解决办法
3442
查看次数

C#JIRA工作日志更新错误"远程服务器返回错误:(401)未经授权."

我将通过c#应用程序上的JIRA REST API更新JIRA中的问题的工作日志.以下代码显示了我到目前为止所做的工作.

HttpWebResponse返回此错误"远程服务器返回错误:(401)未经授权." .

我尝试使用相同的凭据并在PHP cURL函数中使用相同的数据,它工作正常,并成功更新工作日志.

这是我的Jason转换序列化对象:{"update":{"worklog":[{"add":{"comment":"IJ的示例测试评论","timeSpent":"210"}}}}}

protected string RunQuery(JiraResource resource, string argument = null, string data = null, string method = "PUT")
{
// Where;
// resource = issue
// argument = "JIRA-16"
// Data = {"update":{"worklog":[{"add":{"comment":"Sample test comment by IJ","timeSpent":"210"}}]}}
// Method = "PUT"

        string url = string.Format("{0}{1}/", m_BaseUrl, resource.ToString());

        if (argument != null)
        {
            url = string.Format("{0}{1}", url, argument);
        }

// URL = https://companyname.atlassian.net/rest/api/2/issue/JIRA-16

        HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
        request.ContentType = "application/json"; …
Run Code Online (Sandbox Code Playgroud)

c# curl jira httpwebrequest jira-rest-api

1
推荐指数
1
解决办法
1032
查看次数

如何在Java中从JIRA v6.3.15下载附件

我正在尝试获取给定日期后创建的JIRA问题的列表,并从我的Java应用程序中下载相应的附件文件。我当前使用的JIRA Server版本是6.3.15。

当我在Web上搜索时,我发现以下REST客户端,但是它说它支持JIRA Server 6.0之前的版本。我想知道它是否也支持6.3.15,如果没有,是否还有其他替代解决方案?

Atlassian Labs for JIRA Server 5.0-6.0的JIRA REST Java客户端

https://marketplace.atlassian.com/plugins/com.atlassian.jira.jira-rest-java-client

jira jira-rest-api

1
推荐指数
1
解决办法
2139
查看次数

将工作日志发布到JIRA时需要哪些字段?

我想通过API发布CSV数据,以编程方式填充我的JIRA数据库.我有URL和身份验证工作,但我一直得到400错误:"错误的请求".我的猜测是我在有效载荷中遗漏了一些必填字段:

{
"comment": "test",
"self": "https://jira.mycompany.com/rest/api/latest/issue/12345",
"started": "2015-12-09T17:29:14.698-0500",
"timeSpent": "1 s",
"timeSpentSeconds": "1"
}
Run Code Online (Sandbox Code Playgroud)

文档有一个示例,但它包含一些看似不适用于POST的字段,例如工作日志ID - 肯定必须由服务器而不是客户端创建.该查询参数都是可选的.

一位用户声称有成功仅用三个字段:comment,started,和timeSpent.我仍然只有那些领域得到400. 在调整时间格式后,另一个做了同样的事情; 我匹配他或她的格式. 其他 用户可以发布使用comment,startedtimeSpentSeconds.

一个常见的问题是适当地设置内容类型; 我相信我已经覆盖了这个,因为如果我使用"application/json"以外的类型,我会得到415"不支持的媒体类型".

我听说有一个特定的产品需要使用API​​进行写入(而不是阅读,它工作正常).如果我们错过了该许可证,我希望收到一条错误信息.

这是代码,稍微调试一下:

// Initialize various parameters
string  url        = baseUrl + "issue/" + issueKey + "/worklog";
var     rawContent = // Double-quote and concatenate parameters, and wrap them in curly brackets
var     client     = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", encodedCreds); …
Run Code Online (Sandbox Code Playgroud)

c# post jira-rest-api

1
推荐指数
1
解决办法
822
查看次数

JIRA REST API - 基本身份验证

我正在尝试使用curl从我的公司服务器检索jira问题到目前为止没有任何运气.

我已经测试了这里描述的两个例子JIRA REST API示例 - 基本身份验证没有成功.我base64编码我的用户和密码,如"提供基本Auth标头"示例中所述,并输入我想要的问题的URL.我在浏览器中测试了url我得到了json文档,所以url是正确的.

这就是我的命令

someuser @ somehost:〜$ curl -D- -X GET -H"授权:基本base64encodedstringhere -H"内容类型:application/json" https://jira.acme.com/rest/api/2/issue/KEY -666

然后我得到">"的提示,但没有json文件.有什么我错过或做错了吗?

谢谢.

curl jira jira-plugin jira-rest-api

1
推荐指数
1
解决办法
2843
查看次数

使用Jira Rest API-如何获得特定问题的描述?

我正在尝试使用可从此处https://developer.atlassian.com/server/jira/platform/rest-apis/获得的jira rest api,并且正在尝试弄清楚如何获取特定问题的描述在我的项目中。

当我执行以下查询时:

curl -D- -u用户:密码-X GET -H“内容类型:application / json”“ http:// localhost / jira / rest / api / 2 / issue / ISSUE_NUMBER_1

我确实得到了整个问题的回应。它包含了许多领域,例如"avatarUrls"displayName但它也含有body。我只想获得后者。如何限制查询以使其仅返回body?我试过了:

curl -D- -u用户:密码-X GET -H“内容类型:application / json”“ http:// localhost / jira / rest / api / 2 / issue / ISSUE_NUMBER_1?fields = body

但这不起作用。这是什么问题

curl jira jira-rest-api

1
推荐指数
1
解决办法
2004
查看次数

POST使用REST API的非英语字母表

我正在使用JIRA REST API来创建一个新问题,并且在描述和一些其他自定义字段中有一些非英语字母表.请求JSON看起来像

    {
      "fields": {
        "issuetype": {
          "id": 10303
        },
        "description": " Additional informations",
        "customfield_11419": "",
        "customfield_11413": "Editor: Øyst gården",
        "customfield_11436": {
          "value": "DONE"
        },
        "customfield_11439": "Jørund"
      }
    }
Run Code Online (Sandbox Code Playgroud)

使用以下代码完成HTTP POST后,我从端点返回OK响应.

            HttpWebRequest request;
            WebResponse response;         
            request = WebRequest.Create(jira_url) as HttpWebRequest;
            request.Credentials = CredentialCache.DefaultCredentials;
            request.Method = "POST";
            request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
            byte[] authBytes = Encoding.UTF8.GetBytes((jira_email + ":" + jira_token).ToCharArray());
            request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(authBytes);
            if (!string.IsNullOrEmpty(json_string)) //the inpot JSON string to be submitted 
            {
                request.ContentType = "application/json; charset=utf8"; …
Run Code Online (Sandbox Code Playgroud)

c# jira-rest-api

1
推荐指数
1
解决办法
72
查看次数

JIRA-Python 的基本身份验证不再适用于 REST API 调用。接下来是什么?

在 Python 中,我曾经能够使用一段简单的代码在 REST 上通过 JIRA 进行身份验证:

from jira import JIRA

my_JIRA_username = 'my_name'
my_JIRA_pass = 'my_password'
server = {'server': 'https://my_site.atlassian.net'}
jira = JIRA(server, basic_auth = (my_JIRA_username, my_JIRA_pass))
Run Code Online (Sandbox Code Playgroud)

然后能够做一些简单的事情,比如:

my_issue = jira.issue('MYISSUE-1')
print my_issue.key
Run Code Online (Sandbox Code Playgroud)

但是 JIRA 已经改变了一些事情,我猜不再允许通过 REST API 进行这样的基本身份验证。相反,我收到了 401 错误。

我厌倦了创建 API 令牌,如下所示:https : //confluence.atlassian.com/cloud/api-tokens-938839638.html 除非我不知道在哪里使用它(如果我只是使用它就不起作用)作为密码,就像上面的代码一样)。

我研究了 OAuth 作为替代方案,但我找不到任何从 A 点到 B 点对我有意义的代码。

相反,我找到了这样的东西:https : //bitbucket.org/atlassianlabs/atlassian-oauth-examples/src/master/python/app.py

这对我来说是纯粹的胡言乱语。不可能那么复杂!

任何人都可以帮助一个简单的 jira-python 示例,该示例使用基本身份验证以外的其他内容从初始化移动到简单的 REST 调用?

将不胜感激!我有几个月的工作现在毫无用处,因为我无法再进行身份验证。

此外,如果您能解释如何以及何时使用 JIRA 允许您在其云实例上生成的 API 令牌,那将不胜感激,因为我也不明白!

python authentication rest jira jira-rest-api

1
推荐指数
1
解决办法
3050
查看次数

线程“主”中的异常java.lang.NoClassDefFoundError:io / restassured / response / Response

用于登录到Jira localhost的POJO类。

package com.rest.requestpojo;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class LoginApi {
	
	@SerializedName("username")
	@Expose
	private String username;
	@SerializedName("password")
	@Expose
	private String password;

	public String getUsername() {
	return username;
	}

	public void setUsername(String username) {
	this.username = username;
	}

	public String getPassword() {
	return password;
	}

	public void setPassword(String password) {
	this.password = password;
	}


}
Run Code Online (Sandbox Code Playgroud)

服务类,以从JIRA呼叫后获得响应以进行登录。我只是使用主要方法来检查响应。

package com.rest.services;


import org.json.JSONObject;

import com.rest.requestpojo.LoginApi;

import io.restassured.RestAssured;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;

public class Service 
{
	public Response jiraLoginAuth(String username, String password)
	{
		LoginApi …
Run Code Online (Sandbox Code Playgroud)

java selenium jackson rest-assured jira-rest-api

0
推荐指数
1
解决办法
3095
查看次数

使用 python 拉取更改日志的问题

我正在尝试使用 python 查询和拉取更改日志详细信息。

下面的代码返回项目中的问题列表。

issued = jira.search_issues('project=  proj_a', maxResults=5)

for issue in issued:
    print(issue)
Run Code Online (Sandbox Code Playgroud)

我正在尝试传递在上述问题中获得的值

issues = jira.issue(issue,expand='changelog')
changelog = issues.changelog
projects = jira.project(project)
Run Code Online (Sandbox Code Playgroud)

尝试上述操作时出现以下错误:

JIRAError: JiraError HTTP 404 url: https://abc.atlassian.net/rest/api/2/issue/issue?expand=changelog
text: Issue does not exist or you do not have permission to see it.
Run Code Online (Sandbox Code Playgroud)

任何人都可以就我哪里出错或我需要什么权限提出建议。

请注意,如果我issue_id在上面的代码中传递一个特定的,它工作得很好,但我试图传递一个列表issue_id

python-jira jira-rest-api

0
推荐指数
1
解决办法
2332
查看次数