DEV Community

Cover image for 3 Web API skills every dev needs to know
Hunter Johnson for Educative

Posted on • Originally published at educative.io

3 Web API skills every dev needs to know

This article was written by Educative's Co-founder and CEO, Fahim ul Haq.

What's the most in-demand skill for software developers today? There is a strong case to be made for APIs.

If you are a developer, you probably understand why knowing how to integrate APIs into your work is important. In fact, it has quickly become a non-negotiable skill for many companies. After all, APIs are incredibly useful for implementing all sorts of features while abstracting much of the complexity.

Not every company has the funding to hire machine learning engineers to develop an in-house AI chatbot. Instead, they rely on existing APIs to meet their needs. (If you want to brush up on your applied API Design skills, I highly recommend checking out our new course: Grokking the API Design Interview).

Considering the vast array of features one could implement with APIs alone, companies of all sizes need engineers comfortable with API integration.

Learn to Integrate APIs Using Python: A 15-minute Tutorial

Recently, our very own Steven Yi teamed up with API engineer Joe Sauve for this video tutorial on integrating the OpenWeather API into Python applications. It's the perfect starting point for developers new to APIs and breaks down some of the most important steps and tricks in just 15 minutes.

The tutorial covers some key basics of web app development, like making API calls, formatting JSON data, and what the terminal output may look like on a finished webpage.

API Integration vs. API Design

Our OpenWeather API tutorial represents only the very basics of how developers leverage APIs every day. There is so much more to learn about APIs that I encourage developers of all levels to learn API Design.

API Design (sometimes referred to as Product Design) is becoming a skill set that is increasingly sought-after at top tech companies. In the modern development landscape, where microservices and distributed systems are becoming increasingly common, being able to design your own APIs opens up avenues for innovation.

Developers who understand how to design, develop, and scale custom APIs add an incredible amount of value to any organization. These developers can reduce reliance on external APIs (which can cut costs considerably) and design APIs with unique features that provide a competitive edge. Those companies can even choose to turn internally developed APIs into their own product offering! You can probably see why hiring managers and teams value this particular skill so highly.

So, if you're a junior developer, an aspiring product engineer, or just curious about learning more about APIs, now is the perfect time to bolster your portfolio. Just about any developer can learn to integrate powerful APIs in a relatively short amount of time. But developers with API and Product Design skills are such significant assets that this skill set should make the top of every developer's list of what to learn next.

3 Web API Best Practices to Master

As you progress along your API development journey, there are some best practices to be aware of.

A lot of the problem-solving techniques you'll encounter are specific to certain products, features, or APIs. However, there are some good habits that every product developer should form.

1) Read and Write Documentation

Whether you love it or hate it, documentation is essential to both integrating APIs and building a usable product.

Well-established, popular web APIs have extensive and descriptive documentation with answers to most issues and questions. When in doubt, check the documentation. I'm sure that plenty of people can figure out how to put IKEA furniture together without an instruction manual, but when it comes to API integration, I'd advise against it.

If you're designing your own API, it is very important to document how to use it. If anyone other than yourself will be using your code, make sure you provide the bare minimum for them to get started:

  • Overview: A high-level description of what the API does, who it's for, and any other key information to understand its purpose.

  • Authentication: Provide detailed instructions on how to authenticate. This could include how to get an API key and where to include it in the API request.

  • Endpoints and methods: List each endpoint in your API, the HTTP methods used with each (GET, POST, PUT, DELETE, etc.), and what those methods do.

  • Request parameters: Describe any parameters that can be included in the request, where they should be included (path, query, or body), and what data type each should be.

  • Request and response examples: Provide examples of requests and responses for each endpoint and method.

  • Response status and error codes: List the HTTP status codes your API uses, what they mean, and what the user should do in each case.

  • Rate limits: If your API imposes rate limits, explain what those limits are and what happens if they're exceeded.

2) Prioritize Security

If you're building a web application, pay close attention to security.

Breachable sites are easy targets for malicious actors online. Plus, APIs themselves are a common target for abuse and data exfiltration.

As a general rule, you should:

  1. Require authentication/access control: Requiring users to authenticate before they can access API endpoints prevents unauthorized use.

  2. Validate your data: Ensuring that your input data is the right type, size, and format (JSON or XML) is basic but essential for preventing malicious inputs like SQL injections or cross-site scripting (XSS).

  3. Encrypt your data: Even if someone is able to intercept your data, encryption will make it undecipherable. This is especially important if your API handles sensitive information.

3) Simplify and Refine

When brainstorming ideas for web applications or products, it can be easy to get carried away.

I see a lot of junior developers bite off a lot more than they can chew with respect to both personal and professional projects. Overscoping, or adding too many unnecessary features, increases the complexity of a project and can make it untenable to finish it within a reasonable timeline. Try to focus on a few well-designed and functional endpoints first.

If you can keep it simple, odds are you'll end up with a solid V1 and can iterate from there.

Learn to Build Your Own Products and Services

Building products by leveraging a menagerie of APIs and services is a major part of professional software development. Despite turbulent economic conditions, the demand for developers with API and product development experience remains high.

You can dive deeper into web app development concepts (and the API we highlighted in the video) in our course, Integrating the Open Weather API in Python.

By the end of the course, you will have a functional web application built entirely in Python, plus you'll get experience rendering a front-end using Django.

Hopefully, you found this quick newsletter useful! We're posting more on the Educative YouTube channel, so I encourage you to subscribe and let us know what topics you'd like to see next.

Happy learning!

Top comments (0)