new API - applying IssueCountResponse entity syntax to count issues in a specific project

Hi,

With the new API IssueCountResponse explanation, I couldn't figure out how to get the total number of issues contained in a specific project.

I tried the following in Postman:

  • POST {{baseUrl}}/issuesGetter/count?fields=count&query=project:+%7Bname+of+my+project%7D
  • GET {{baseUrl}}/issuesGetter/count?fields=count&query=project:+%7Bname+of+my+project%7D

What I received as a response, with the POST was:

"
{

    "error": "Bad Request",
    "error_description": "An Project-type entity with the specified ID (0-0) was not found",
    "error_developer_message": "An Project-type entity with the specified ID (0-0) was not found"
}
"
A colleague of mine tried the same, and even received another error message mentioning "non null being null".
Important note: we are seeking to get the count, NOT overwrite anything.
 
Could you please help on that and document it?
Thanks in advance,
0
4 comments
Hello,

I'm Lena from YouTrack. I will be happy to help you.

Please use the following instructions to get the issues count: https://www.jetbrains.com/help/youtrack/devportal/resource-api-issuesGetter-count.html#create-IssueCountResponse-method. We use POST in this example because we pass the filter query to the server.

Let me know if you need further assistance.
0

Hello Lena,

I tried to apply the issuesGetter syntax like this:

{{baseUrl}}/issuesGetter/count?fields=count&query=project:+%7BMy+Project+%7D

and also like:

{{baseUrl}}/issuesGetter/count?query=project:+%7BMy+Project+%7D

But I keep receiving this error:

{
    "error": "Bad Request",
    "error_description": "An Project-type entity with the specified ID (0-0) was not found",
    "error_developer_message": "An Project-type entity with the specified ID (0-0) was not found"
}
 
I assume that it is because the request doesn't use fields & query like I seem to understand it.
Could you please provide the exact POST request syntax to use when we want to apply this issuesGetter request to count the number of issues of a project named My Project?
 
Thanks in advance for your help,
0

Hi again,
When trying another time with this:

youtrack/api/issuesGetter/count?fields=count&query=project:+%7BMy+Project%7D

This time, I received this error:
 
{
    "error": "server_error",
    "error_description": "Parameter specified as non-null is null: method jetbrains.charisma.persistent.issue.IssuesGetterResource.getIssuesCount, parameter data"
}

Could you please explain what can cause these 2 errors (the one in my previous message and this one above)? And provide the exact syntax as requested in my previous message?

Thanks in advance,
0

Hello,

This request doesn't support quesry, you should send the query in the request body:

https://www.jetbrains.com/help/youtrack/devportal/resource-api-issuesGetter-count.html#create-IssueCountResponse-method-sample-1

Sample request

https://example.youtrack.cloud/api/issuesGetter/count?fields=count


Sample request body

{
  "folder":
  {
    "$type":"Project",
  "id":"81-1". // here should go the project ID
}
}


Sample response body

{
  "count":29,
  "$type":"IssueCountResponse"
}
0

Please sign in to leave a comment.