Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query strings don't work for search endpoint #2172

Open
2 of 7 tasks
Pawper opened this issue Nov 23, 2021 · 1 comment
Open
2 of 7 tasks

Query strings don't work for search endpoint #2172

Pawper opened this issue Nov 23, 2021 · 1 comment
Labels
Type: Support Any questions, information, or general needs around the SDK or GitHub APIs

Comments

@Pawper
Copy link

Pawper commented Nov 23, 2021

Please avoid duplicates

Reproducible test case

https://runkit.com/pawper/619c82dc8a8edf0008cafe71

Please select the environment(s) that are relevant to your bug report

  • TypeScript
  • Enterprise
  • Browsers
  • Node
  • Deno

Version

[email protected]

What happened?

Not sure if this is a case of me doing it wrong or if it's not working as intended. I'm trying to get a list of my repositories with the subject portfolio-project and it's returning 0 results (should be 1). I did also try the query string in the documentation (GitHub Octocat in:readme user:defunkt) and that returned 0 results as well. I'm assuming the example should return results.

Would you be interested in contributing a fix?

  • yes
@Pawper Pawper added the Type: Bug Something isn't working as documented label Nov 23, 2021
@Chocrates
Copy link

Chocrates commented Dec 1, 2021

A couple issues with your code @Pawper
You don't need to encode the search string, and the q= is redundant. This should work

const { Octokit } = require("octokit");
const octokit = new Octokit()

async function generateHtml() {
  const queryString = 'user:pawper topic:portfolio-project'
  console.log(queryString)
  let search = await octokit.request('GET /search/repositories', { q: queryString });
  console.log(search)
}

generateHtml()

@wolfy1339 wolfy1339 added Type: Support Any questions, information, or general needs around the SDK or GitHub APIs and removed Type: Bug Something isn't working as documented labels Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Support Any questions, information, or general needs around the SDK or GitHub APIs
Projects
None yet
Development

No branches or pull requests

3 participants