Graphql: Find issues using filter for workspace, repos and pipelines

I’m attempting to use the zenhub graphql to find issues using a filter as follows:

query SearchIssues($workspaceId: ID!,$repoIds: [ID!]!,$pipelineIds: [ID!]!) {
   searchIssues(workspaceId: $workspaceId,filters: {repositoryIds:$repoIds,pipelineIds:$pipelineIds}) {
		totalCount
		nodes {
      id
      title
      ghId
	}
}
}

with variables along the lines of:

{
	"workspaceId": "myworkspaceIdxyz",
	"repoIds": [
		123,456
	],
	"pipelineIds": [
		"pipelineid1","pipelineid2"
	]
}

But I get Internal Server Error 500 and no content to debug what went wrong. Does this query work or how can I check if my input/query valid?

Hey @zenchen!

Try this query from our postman collection fetchIssuesbyPipeline. This query will allow you to retrieve the issues from a single given pipeline, we currently don’t support retrieving issues from multiple pipelines within a single request due to the potential size of the query. Here is the code for the query:

query ($pipelineId: ID!, $filters: IssueSearchFiltersInput!) {
    searchIssuesByPipeline(pipelineId: $pipelineId, filters: $filters) {
        nodes {
            id
            title
        }
    }
}

Variables

{
    "pipelineId": "",
    "filters": {
        "repositoryIds": []
    }
}

Hopefully this helps!

Thank you @Joseph.from.Zenhub this works. The only minor change is fieldname for repositoryIds needs to be repositoryGhIds for this query to work.

1 Like