Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Get fields from Jira using c# rest

Dan27
Contributor
August 12, 2019

Hello,

I am looking for solution for 2 days already...

 

I need to take the values of specific custom field (Text field type) with rest (c# syntax).

I need to take those values to all of the issues in specifix project.

This is my URL: https://BaseURL:PORT/rest/api/latest/search?jql=project=%22ProjectKey%22 - enter JSON with all of the issues in the project.

I need to connect Jira with user+pass..

 

Please, this is an urgent issue.

 

BR,

Daniel

2 answers

0 votes
Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2019

Hi @Dan27 

I think your first (and hopefully only ) problem is that you shouldn't be using password, you need to use an API token (see this). You didn't say what error you're getting or what is wrong, but using a password should result in a 401 error (authentication).

You can also try via Postman (either online or download the app) - once it's working in Postman, you can then try to get your code working.

Here is an old post where I give some C# code which will work as long as you replace username with a Jira e-mail address and password with an API token.

0 votes
Roman Kersky
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2019

hi. You can try Atlassian.Net SDK (https://bitbucket.org/farmas/atlassian.net-sdk/wiki/Home)

Dan27
Contributor
August 12, 2019

Thank you @Roman Kersky  ,

I tried: 

namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var jiraurl = "https:/BaseURL:PORT/rest/api/latest/search?jql=project=%22XXX%22";
var login = "user";
var password = "password";

var jira = Jira.CreateRestClient(jiraurl, login, password);
Console.WriteLine(jira);

}

}

}

 

But I didn't get nothing.. What am I doing wrong?

Suggest an answer

Log in or Sign up to answer