Forums

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

How to validate if the connection is ok using Atlassian.net / C#

Carlos Torres May 13, 2019

I installed Atlassian.NET (10.5.0). I have a few questions.

When the URL has the https, it throws me an error, so i'm using http

- How to validate that the connection is ok?

- When run the LINQ query, always returns 0, how come? 

I'm including my code here:

var jira = Jira.CreateRestClient("http://xxx.atlassian.net", "username", "password");

var jiraissues = from i in jira.Issues.Queryable
                                  select i;

Console.WriteLine(jiraissues.Count());

2 answers

0 votes
JaabirH
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 7, 2020

Hello,

I am getting the same issue. How have you solved it?

Thank in advanced.

JaabirH
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 8, 2020

Hello,

I found the issue. for anyone running into this problem, the password should be a token.

Generate the token here :

https://id.atlassian.com/manage/api-tokens

And then passed it the function like:

 

var jira = Jira.CreateRestClient(url, username, Token, settings);

0 votes
Carlos Torres May 13, 2019

Does anyone has an answer ? I'm new on this and even when I'm not getting any error, it always returns 0 values, no matters if it is an Project List, Issues Types or Issues in general. I checked my credentials and all seems to be ok 

URGENT

string url = "http://xxx.atlassian.net";
string username = "myLoginID";
string password = "myPassword";

var settings = new JiraRestClientSettings()
{
EnableRequestTrace = true
};

var jira = Jira.CreateRestClient(url, username, password, settings);


var jiraprojects = jira.Projects.GetProjectsAsync().Result;

foreach (var project in jiraprojects) //jiraprojects count is always 0 :(
{
Console.WriteLine(project.Name);
Console.WriteLine(project.Key);
Console.WriteLine(project.Id);
}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events