Understanding APIs

Understanding APIs

An Introduction to APIs: Types, Advantages, and Challenges

Introduction:

API is short for Application Programming Interface. It helps in making a developer workflow easy as it simplifies the backend work and gives developers what they need.

I call it A Perfect Invention.

Example: Imagine a Coffee machine with latte, black coffee as options. If you select latte then it gives you a latte i.e it uses all the ingredients needed to make a latte, makes it behind the screen, and gives the latte to user. So instead of you going through the entire latte making process now you just get it in a single button.

Different Types of API:

  1. REST APIs : Representational State Transfer(REST) APIs are commonly used API for web services.

  2. SOAP APIs: Simple Object Access Protocol(SOAP) APIs are type of web services that use XML messaging and are used for complex transactions

  3. GraphQL APIs: These provide a way to easily access data. These allow developers to specify the exact data they need in a single request and can reduce the amount of data transferred over network

  4. Open APIs: These are known as public API, are accessible to developers outside of the organisation that provides them. EXAMPLE: Weather API

  5. Internal API: These are private APIs, used within the organization to share resources and data between different departments

How APIs Work?

  • The client application sends a request to the API, specifying what data is required

  • API then receives the request and process it and perform the requested action

  • API takes the data from the database and performs the requested action

  • API makes the data into JSON or XML and sends that as response back to the client application

  • The client application receives the response and whatever the user requested will be shown to the user

Examples of API

  • When we order food from Zomato(food delivery app) we see the map in the app. That map is not developed by the developers completely from scratch instead they request for the map using google maps API and build the time, and driver info on top of that.

  • Recently Twitter has commercialized its APIs. Tweet schedulers got affected because of that this is because they are built using the Twitter API.
    Though people got worried that they might get banned users can create their own keys instead of system-generated keys and paste them in those schedulers.

Advantages of API

  1. Hides all complexities

  2. Extend functionalities without bothering backend logic

  3. Reusability: Devs time gets saved as they don't need to build functionality from scratch

  4. Scalability: Millions of users get data as per their request

  5. Monetization of API: revenue stream is generated for providing data or functionality as devs use this to develop something using this API

Challenges with API

API security versioning and scalability

  1. Security: APIs are constantly facing security issues in the form of data breaches, DOS attacks(Denial of Service), and injection attacks.

  2. Performance: Poorly designed API leads to poor performance in the application and disturbs user experience

  3. Maintenance: APIs must be maintained from time to time to make sure they work as expected and also keep them secure. Changes sometimes consume a lot of time and money

Conclusion

Overall API provides a standardized way for different software applications to communicate and share data, which is essential in today's interconnected world of software and services.

I request the reader to suggest any changes, share their knowledge regarding API and help me learn more about API. This is a part of my #100daysofCode so please share your knowledge and experience and further learning concepts in this API world.