#I'm getting a 422 Validation Failed from Github API when making a request with the cpr library

1 messages · Page 1 of 1 (latest)

dusky kettle
#

So, I'm making simple get requests to urls like:

api.github.com/search/code?q=+language:haskell+repo:krispo/awesome-haskell

Basically specifying the language and the repo, and it does work when the request is made from postman or from the browser.
However, when using https://github.com/libcpr/cpr, I'm getting the following response:

{
  "message": "Validation Failed",
  "errors": [
    {
      "message": "Must include at least one user, organization, or repository",
      "resource": "Search",
      "field": "q",
      "code": "invalid"
    }
  ],
  "documentation_url": "https://docs.github.com/v3/search/"
}

This is how I'm making the request:

cpr::Response req2 = cpr::Get(cpr::Url{"api.github.com/search/code?q=+language:haskell+repo:krispo/awesome-haskell"});

Am I missing anything?

balmy wigeonBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For more information use !howto ask.

balmy wigeonBOT
#

@dusky kettle

This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.