-1

I am trying to use the github api to search for pull requests that have a specific label. Went through the documentation https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28

And built the following curl command:

curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer XXXXX" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repos/myorg/myrepo/issues?labels=My%20PR%20Label

But the command returns "no matches found"

When I look for the label itself, I can find it

curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer XXXXX" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repos/myorg/myrepo/issues/2710/labels

[
  {
    "id": XXX,
    "node_id": "XXXX",
    "url": "https://api.github.com/repos/dktunited/myorg/labels/My%20PR%20Label",
    "name": "My PR Label",
    "color": "8DFA3A",
    "default": false,
    "description": "A custom PR label"
  }
]

I have tried the gemini interface they have on their support page, which says my url is correctly formatted.

Can anyone please point out what am I doing wrong ? I have created a support ticket but noone answered yet.

1
  • The syntax for the labels query param seems fine. I'd think the problem is somewhere else. Any chances 2710 corresponds to a PR instead of an issue? I'm taking a guess here based on the name of your label. If that's the case, it's expected it wouldn't be returned by the /issues endpoint (even though it would be returned by the issues/:id endpoint) Commented Jan 12 at 18:12

1 Answer 1

0

The github support answered. it seems we have to use another syntax for the whitespace included parameters to work

curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer XXXX" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  "https://api.github.com/repos/myorg/myrepo/issues?label:\"My%20PR%20Label\""
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.