optimize icon

API Optimization

AppMap understands and records all the HTTP API behavior in your application, and can use that knowledge to help you manage your service's API in many ways.

Generate OpenAPI Specs & API Documentation

OpenAPI is the widely-adopted standard for describing HTTP APIs, used to catalog a service's API actions, parameters, response codes, and more. But writing and maintaining an OpenAPI specification by hand is a lot of work, and can be a pain to keep up to date with the API's latest behavior.

After recording your application's behavior, AppMap can instantly generate an OpenAPI specification that completely describes all of your APIs. Since it can do this automatically, adding AppMap's OpenAPI generation command to your continuous integration (CI) system means that you can have OpenAPI schema up to date, all the time - with zero manual effort required.

OpenAPI specs generated by AppMap can then be used for many purposes, including loading into tools like Postman, or generating your online API documentation.

Diff API Changes

Once AppMap's OpenAPI specification generator has been integrated into your CI system, you can use it within your code review workflow to see the API behavior differences caused by each Pull Request (PR). This makes it easy to verify that a PR doesn't cause inadvertent changes in API behavior. It also assists code reviewers in quickly understanding the API changes being proposed in a PR.

Validate Client API Compliance

AppMap Analysis can identify problems where the clients of your service do not comply to its API's schema. It can also spot when your own application is not complying to the schema for an API it is calling.

This is particularly helpful when an application API is evolving faster than its clients can adapt to keep up. Catching these issues in development - as AppMap Analysis does by design - makes them easier to fix and less costly than deploying them to production and creating issues for your customers.

Find Fragile API Patterns

AppMap Analysis can scan your application's runtime behaviors for problematic patterns in your API. Best of all, it can scan your AppMaps for the presence of these issues almost instantly. The following are just some of the problems that AppMap Analysis can find in your API.

Invalid Status Codes

HTTP 500 status codes generally indicate an unanticipated problem in the backend that is not handled in a predictable way. 500 status codes are also hard for client code to handle, because they don’t indicate any particular problem or suggest a solution.

AppMap Analysis finds any instance of a 500 status code during the runtme execution of your API and flag it instantly, providing a full visual map of how and where it occurred.

Non REST-ful Behavior

Performing data updates in a GET request is an anti-pattern, and counter to the intent of HTTP. Data modifications should always be done using PUT, POST, or PATCH. AppMap Analysis flags any GET request which executes a database update at runtime, saving code reviewers precious time.

Jobs Not Canceled

AppMap Analysis can find database jobs which were created within a transaction but not cancelled when the transaction was rolled back. This error is impossible for static code analyzers to check, and only the runtime behavioral analysis available in AppMap can help find these situations while code is still in development.

Circuit Breakers Misused

AppMap recognizes most popular circuit breaker libraries, and can flag when an inter-service RPC or API is called without a circuit breaker in place. In a microservice-centric environment, the lack of a circuit breaker in client code can lead to increasingly disastrous results when services degrade or fail. AppMap Analysis finds these kinds of flaws in a PR long before a code reviewer gets asked to review it.