Why documentation_url points to v3 instead of v4?

community-help

#1

Hello people,

I’m new to GraphQL and GitHub API v4.

I searched a bit, and did not find similar topic created. Not sure if it’s designed so, if it’s a bug, or maybe WIP.

When I have GraphQL query/POST request with errors, response from GitHub server shows me:

{
    "message": "Problems parsing JSON", 
    "documentation_url": "https://developer.github.com/v3"
}

Or for example this error:

{
  "message": "Bad credentials",
  "documentation_url": "https://developer.github.com/v3"
}

In fact, as much as I tested/used API v4, I saw always the same. My point here, that “documentation_url” is

  • developer.github.com/v3/ and not
  • platform.github.community/c/graphql-api

I have no idea what correct url should be, but I guess it should not mention v3 whatsoever. I found that looks-like-v4-url, in not quite related post (Jan-2017) to my, where @RomanGotsiy described and issue and @bswinnerton mentioned there should be fix for that. I can confirm, that wrong usage of header Authentification now shows at least correct error message:

{
  "message": "This endpoint requires you to be authenticated.",
  "documentation_url": "https://developer.github.com/v3/#authentication"
}

I also see in this post Possible bug: refs of Repository returns null (Mar-2017), that using query API, even via curl server responds with documentation_url pointing to v3.

But the same as with all my personal error-causing-situations, GitHub API mention v3 documentation url in response from server to me (client).

So my question is: Why is it so - that if u work with API v4, there is mention of v3 API? Is it feature or bug?

Just in case, I use simple JavaScript/ES6 code running HTML file within NodeJS 8.4.0 env. via http-server instance on localhost:8080 and I use Fetch API. Tested on Chrome Canary v63.

Here is jsfiddle example (u will need to add your token to execute that code.)


#2

@alundiak Can you post your query?


#3

@yakov116 I think it doesn’t matter, but look to description - I updated with link to jsfiddle example.
That example is OK, when I add valid token, it goes as real POST request, and I receive edges.
When I add

  headers: {
        'Content-Type': 'application/json'
  },

it’s also OK, I receive edges, but request is OPTIONS then.

So my point is, when u have ANY wrong/not-correct request, GitHub API v4 return documentation_url pointing to v3.


#4

Same for me. Been working on this for 4.5 hours for iOS platform in Swift. Keep getting same response which suggests v3

static func go(_ auth: String) {
    let url = URL(string: "https://api.github.com/graphql")!
    var request = URLRequest(url: url)
    request.httpMethod = "POST"
    request.setValue("application/vnd.github.v4+json", forHTTPHeaderField: "Accept")
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")
    request.setValue(auth, forHTTPHeaderField: "Authorization")
    request.httpBody = "{ \"query\": \"query { viewer { login }}\" }".data(using: .utf8)
    let task = session.dataTask(with: request) { (data, response, error) in
        let bleh = try! JSONSerialization.jsonObject(with: data!, options: .allowFragments)
        print(String(describing: bleh))
        print(String(describing: error))
    }
    task.resume()
}

{
"documentation_url" = "https://developer.github.com/v3/#authentication";
message = "This endpoint requires you to be authenticated.";
}

If i put those exact same values into Postman it works https://www.getpostman.com

the auth param is

"Basic \(base64mash)"