How to read Github documentation for API?

I just finished the “Intermediate APIs” course and one of the takeaway is to read the Github documentation and explore. How to do that?

Most of the resources are either in Github CLI, Javascript or cURL. I am finding it very difficult to convert those to python. I feel pointing students towards a mass documentation is not very useful.

1 Like

Hello, @amogghrao,

Yeah, exploring and understanding the API documentation is very difficult for many people and you’re not alone in feeling that.

Is there a specific thing you would like to try with the Github API? I can check if it’s possible with the API and will help you as best as I can.

One thing about most REST APIs is they’re not language specific. So if you’re unsure how to convert curl to Python for example, it’s best to focus on whether the documentation provides all the necessary information to send an HTTP request to the API endpoint and ignore the curl examples for now (curl is still useful so it might be worthwhile to understand at least the basic later on).

From the doc:

When you make a request to the REST API, you will specify an HTTP method and a path. Additionally, you might also specify request headers and path, query, or body parameters. The API will return the response status code, response headers, and potentially a response body.

The above shows you what you need. Most documentation will give those information directly without any reference to any programming language or programs. Some documentation provide examples for popular programming languages but some don’t; so, it’s important to understand the fundamentals of REST API, extract the information from the documentation, and then, you can use that information to make an API call with any programming language and not just Python.

For example, this page on repository has some of the necessary information for doing things with repositories:

There are parameters and headers and request types for each action. You can use those with the methods in the Python requests module.

You might also need to read the getting started guide to learn how to get yourself authenticated because some if not all endpoints are limited to those with the necessary permissions.

I feel pointing students towards a mass documentation is not very useful.

That’s valid feedback and I can see your point.

Could you please share your feedback with the Content & Product teams of Dataquest? Just click the ? button in the upper-right corner of any screen of the Dataquest learning platform, select Share Feedback, fill in the form, and send it.