Hi Team,
We have integrated JIRA API in one of our .NET application.
API URL is - https://koodaideri.atlassian.net/rest/api/3/search?jql=project=KAL&startAt0&maxResults=100
Everything was working fine but from past couple of weeks it is not working.
To integrate JIRA API in .NET project, we are using library Atlassian.SDK version=“12.0.0” in our C# application.
Mentioned below is code snippet,
var jira = Jira.CreateRestClient(Url, Username, Password);
IPagedQueryResult<Issue> result = await jira.Issues.GetIssuesFromJqlAsync(filter, MAX_ISSUES, 0);
int total = result.TotalItems;
As a output total shows total number of issues in JIRA project.
But result object does not contain any data.
Can you please assist what’s issue with “GetIssuesFromJqlAsync”?
Is there any updates in API data or library which needs to be integrated.
Thanks,
Alpesh
1 Like
I use the below and see no issues
private async Task<List<Issue>> GetIssues(Jira client, string query)
{
List<Issue> issues = new List<Issue>();
int issuesPerRequest = 100;
int startAt = 0;
int total = 0;
do
{
var newIssues =
await client.Issues.GetIssuesFromJqlAsync(query, maxIssues: issuesPerRequest, startAt).ConfigureAwait(false);
issues.AddRange(newIssues);
total = newIssues.TotalItems;
startAt = startAt + newIssues.ItemsPerPage;
} while (startAt < total);
return issues;
}
Dear, did you get some solution to solve it?
Welcome to the Atlassian developer community @QuanZHANG,
Are you referring to this project:
https://bitbucket.org/farmas/atlassian.net-sdk
If so, that was not developed or supported by Atlassian. Furthermore, the project announces:
Due to time constraints, this project is no longer mantained. Thank you for all the support during these past years.
So the problem could be that it simply hasn’t kept up with the latest REST API changes. I’m not sure what can be done to get a solution when even the maintainer isn’t working on it anymore.
So, is there an SDK supported by Atlassian?
Welcome to the Atlassian developer community @AlekseiBiriukov,
No.
The options I would recommend instead:
- For other languages (Python & Java), I’ve recommended the style provided by Refit. I find this style strikes the best balance between having a type-safe SDK and being overly coupled to the OpenAPI Spec. Another similar library would be Flurl, which solves many of the same problems with a fluent interface instead of annotations. Flurl is less helpful in manipulating responses with native types.
- Generate a C# client from the OpenAPI spec available for download from the Jira Cloud Platform REST API docs. The official OpenAPI project maintains CSharp Code Generator. Microsoft seems to prefer NSwag because it’s written in .NET with its own CSharp Code Generator. Both would provide a strongly-typed interface to both response & requests. While I haven’t used either library specifically, I have used other generators. They can be very sensitive to problems in the underlying spec, even if you don’t care about that part of the API. And I know there are bugs in our OpenAPI specs.
- Use any general HTTP/REST client lib. I’ve seen many references to RestClient and RestSharp in community posts. These usually leave a lot of JSON handling up to you. However, that might be the case in any of these solutions because Jira Issues aren’t well-typed. The configuration of issue types & custom fields makes issues look a lot more like loosely-typed dictionaries than a well-structured class.