☑️Introduction

APIs are mostly seen in web but its not just for the web. It helps making communications between different systems seamless. APIs create a consistent structure for how requests must be sent to the server for processing, and how the server responds to the requests.

APIs are broadly categorized as either public, accessible to external parties, or private, restricted to specific organizations or groups of systems.

API Styles

Web APIs can be built using various architectural styles, including REST, SOAP, GraphQL, and gRPC, each with its own strengths and use cases:

  • Representational State Transferarrow-up-right (REST) is the most popular API style. It uses a client-server model where clients make requests to resources on a server using standard HTTP methods (GET, POST, PUT, DELETE). RESTful APIs are stateless, meaning each request contains all necessary information for the server to process it, and responses are typically serialized as JSON or XML.

  • Simple Object Access Protocolarrow-up-right (SOAP) uses XML for message exchange between systems. SOAP APIs are highly standardized and offer comprehensive features for security, transactions, and error handling, but they are generally more complex to implement and use than RESTful APIs.

  • GraphQLarrow-up-right is an alternative style that provides a more flexible and efficient way to fetch and update data. Instead of returning a fixed set of fields for each resource, GraphQL allows clients to specify exactly what data they need, reducing over-fetching and under-fetching of data. GraphQL APIs use a single endpoint and a strongly-typed query language to retrieve data.

  • gRPCarrow-up-right is a newer style that uses Protocol Buffersarrow-up-right for message serialization, providing a high-performance, efficient way to communicate between systems. gRPC APIs can be developed in a variety of programming languages and are particularly useful for microservices and distributed systems.

OWASP Top 10 API Security Risks

The API allows authenticated users to access data they are not authorized to view.

The authentication mechanisms of the API can be bypassed or circumvented, allowing unauthorized access.

The API reveals sensitive data to authorized users that they should not access or permits them to manipulate sensitive properties.

The API does not limit the amount of resources users can consume.

The API allows unauthorized users to perform authorized operations.

The API exposes sensitive business flows, leading to potential financial losses and other damages.

The API does not validate requests adequately, allowing attackers to send malicious requests and interact with internal resources.

The API suffers from security misconfigurations, including vulnerabilities that lead to Injection Attacks.

The API does not properly and securely manage version inventory.

The API consumes another API unsafely, leading to potential security risks.

Last updated