An API is data or a service that is available overthe network using a standard protocol and format for example… An HTTP search request returning results in JSON format A SOAP request for authorizing access to a secured system
Common characteristics of APIs APIs are consumed by software, not end users APIs do not have a UI – there is nothing to “look” at or interact with APIs expose business logic or functionality, mostly for integration purposes APIs can be both private or public
How do APIs fit into an architecture?Business A Business B Mobile / Web App Web App Desktop App REST SOAP Public REST Public API API REST JMS SOAP Thrift Service Service Service Service API 1 API 2 API 3 API
Quality Aspects of an API Functionality – does it work as expected? Performance – does it perform as required? Security – is it secured for common attacks? Usability – is it usable? Compliance – does it follow common practices?
How do you test an API? APIs generally implement a request-response model for exchanging messages or data Parameterized Request Test API ResponseA simple test sends a request message and validatesthat the response message has the expected content
Single vs Multi-Request Tests Request API 1 Response Multi- Request Request API 2 Test Response Request API 1 Response