Forums

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

I can only retrieve some records via the REST api

Jerome R. Anderson
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!
May 19, 2020

I created a very simple C# application to retrieve a single record from our JIRA server via REST. It wasn't working to I used the example provided by JIRA and it looks like this:

 

Jira jiraConn = Jira.CreateRestClient("<omitted>", "<omitted>", "<omitted>");

var issues = from i in jiraConn.Issues.Queryable
where i.Project == "<omitted>"
orderby i.Created
select i;

foreach (var issue in issues)
{
if (issue != null)
{
Debug.WriteLine(issue.Project);
Debug.WriteLine(issue.Key);
Debug.WriteLine(issue.JiraIdentifier);
Debug.WriteLine(issue.Assignee);
}
}

It only retrieves 15 records and then it throws an error in the "foreach" statement

Exception thrown: 'System.NullReferenceException' in Newtonsoft.Json.dll
Object reference not set to an instance of an object.

I have also tried just a single query and it works on some issues such as the ones which were successfully returned but not on others. We make extensive use of custom fields in our JIRA issues and I have version 12.1.1 of the Atlassian SDK and version 4.7.1 of System.Text.Json

 

Thanks

Jerry

1 answer

0 votes
Bill Sheboy
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.
June 25, 2020

Hi @Jerome R. Anderson -- Welcome to the Atlassian community!

Of the fields you are trying to write, Assignee could be null, right?  Consider running your filter by hand in JIRA to confirm by your record count where the problem occurs in the result set. If Assignee is the issue, add null handling for it and any relevant fields.

Best regards,

Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events