APIful Blog We're obsessed with Web APIs

Learning How Web APIs Are Used through Big Code Analysis of GitHub

Sep 13, 2016 •

Consider the following scenario that all developers will be familiar with: You are writing code to call a web API (let’s go with Instagram). You consult Instagram’s online API documentation which lists all available endpoints. For each endpoint, you observe the query and payload parameters – cool. However, if you have never invoked the API and don’t know exactly what endpoint you are looking for, it is tedious to navigate through the 30+ provided endpoints. In addition, even when you select the endpoint that appears to do what you need, what value should you use for each query parameter or the request payload?

In API Harmony, we provide you, the developer, with a summary of how the API is commonly used based on GitHub’s 28+ million open source code repositories. At the moment we’re currently only analyzing JavaScript with jQuery but we’re rapidly heading towards true Big Code Analysis for more languages and libraries!

When searching for a usage example of a specific API endpoint, a textual search like grep frequently doesn’t work because the URL of an endpoint might be located away from the actual API call or possibly constructed of multiple string segments. With Big Code Analysis, based on static code analysis, we can extract the requests on specific endpoints from JavaScript code that make use of the jQuery library. The results of each code segment is aggregated per endpoint so that we can provide you with the summary of commonly used parameters as well as values. Basically we take the grunt work out of looking through millions of lines of code to get the “gist” of how the API should be called.

Usage Examples from GitHub API

See for yourself. Checkout a couple of examples from popular web APIs on API Harmony:

Did you learn something new about the above APIs? How would you make use of this information as a developer to improve your development workflow and efficiency? Let’s discuss below!

Share via a Tweet or follow us for everything APIs!