Think about your personal experiences using ride-sharing mobile apps like Lyft. You’re able to request a car to your exact geographic coordinates, right down to the street corner. This functionality is possible thanks to application programming interfaces, or APIs.
An API is a platform that allows different pieces of software, or applications, to communicate with one another. The term is used broadly in the context of programming languages, the web, operating systems, etc. For example, Apple publicly shares a number of APIs powered by iOS, its operating system for iPhones and iPads, for an app developer to use. These APIs allow applications like Facebook, Instagram and Snapchat to access a user device’s camera, microphone, and much more.
What Is an API?
APIs can fall into a number of subcategories. Many web and mobile applications, as well as devices (e.g., Amazon Echo), rely heavily on what are known as web APIs, which we’ll focus on in this guide. A web API uses the same underlying technologies as web browsers to allow different applications to communicate with one another. Web APIs allow applications to retrieve data or perform actions beyond their built-in capabilities. Typically, an application, using the internet, requests some data or action from an API. The API provides a response, and the application then adapts and displays it. The API’s code is hosted on a web server, which is essentially a computer connected to the internet. Depending on the functionality the API is providing, there may be an additional layer of security involved, such as sending a unique key.
Let’s consider a mobile weather application like Dark Sky. When you use it to check the weather for a certain zip code, the application makes a request to the API tool asking for the weather in that zip code. The API has access to the weather data and returns it as its response. Then, the application goes through the weather data and selectively displays it as, for example, the temperature in degrees Fahrenheit. The same process occurs if you check the weather in another city or at your current location.
How to Use an API
Developers can use almost any modern programming language (like JavaScript, Ruby, Python, or Java) for their own API coding. Most programming languages already come with the necessary software to interact with web APIs, but developers typically install additional packages, or code, for convenience and flexibility.
For any given programming language, there’s usually at least one popular framework — a collection of programs — that can be used to create APIs. Ruby developers, for example, use the Rails framework. Developers can also use packages to add features to their APIs, such as additional layers of security. Any additional necessary programs or packages are usually installed with that language’s package manager, e.g., Ruby’s bundler.
How Does an Internal API Work?
An internal API is one that’s used within a company or organization, although the company can choose to make portions of it accessible to the public. Users within that organization can leverage an internal API to share data and business logic (for example, the company’s rules regarding communication between a user interface and a database) across platforms — i.e., web, iOS, or an Android app. Any company with both web and smartphone apps likely has an internal API.
For example, the food-ordering service, Seamless, has web, iOS, and the Android app. All three platforms use an internal API to request that an action be performed, like placing an order for a client, as well as to request data, like the details of a user’s most recent order. This internal API allows Seamless to internally share data (restaurant information) and business logic (a customer ordering a dish) across different devices.
How Does an External API Work?
Many organizations provide external — albeit sometimes limited — APIs and documentation that allow individuals and companies outside of that organization to develop applications using its services. Depending on the external API, there may be registration, payment, or other limitations involved. For example, The New York Times provides an extensive external API that is free but requires that developers register and follow certain guidelines.
Google Maps also provides APIs that allow developers to embed maps in their websites and applications, as well as access directions and estimated travel times. Lyft, for example, uses Google Maps’ API. Other popular external APIs include Yelp’s Business APIs, which enables the user to find businesses, the OpenWeatherMap API, which retrieves weather data, and the Microsoft Azure Emotion API, which determines emotions in images.
Using external APIs allows developers to create their own mashup applications, like one that uses the Yelp Business API to find top-rated coffee shops in a neighborhood and display them on user interfaces as a map with custom icons via the Google Maps API.
APIs at 足球竞彩网 Assembly
The ability to work with web APIs is a fundamental skill in web development, whether you want to find a job as a front-end or full-stack software engineer or simply create your own applications. In GA’s career-changing Software Engineering Immersive — offered on campus and online — as well as our part-time JavaScript Development course, students learn the theory behind using web APIs and get hands-on practice incorporating them into their own projects. They also explore adjacent technologies such as AJAX and JSON. Many students choose to use a web API as part of their final projects and create their own applications. Our part-time Front-End Web Development course covers API coding essentials as well.
Browse Upcoming Coding Workshops
Meet Our Expert
Saimon Sharif is a software engineer who teaches JavaScript Development courses and workshops at 足球竞彩网 Assembly’s New York City campus. He works at the clothing-rental company Rent the Runway, focusing on its front-end stack. In his spare time, Saimon listens to podcasts, searches for the perfect cup of coffee, and reads a few too many articles.
“Given that more than half the world’s population has internet access, with more to come, now is a great time to learn web development to create applications and reach that audience.”
Saimon Sharif, JavaScript Development Instructor, 足球竞彩网 Assembly NYC