Contents
What is API?
API is an acronym for Application Programming Interface. This is an intermediary software that allows two applications to talk to each other. Nowadays probably the most popular type of API is a so-called RESTful API. It is a standard or set of rules for communication between client apps and server apps over the HTTP protocol.
Why do you fake API?
While the API is in development, most likely its web services are not reliable or even unavailable. Still, the business does not want the development of other apps that are dependent on this API to be blocked. For this case programmers are using mock data and mock API services in particular. It is really useful not only while coding apps, but also for running automation tests.
Types of mock API
There are a number of different approaches in order to create your mock data. Many developers just use some dummy data inside their code, methods, classes etc. Some of them are using files to store the information that needs to be mocked. There are also a variety of mock servers available like Mockoon. Finally, you may also create fake API services using some online API mocking tool or online mock server, for instance QuickMocker or many other alternatives.
What do you need to create dummy API services?
First of all you need to choose the type of your mock data, whether it can be local or it should be external. In case it will be API web services, the information about it could be provided to you by your back-end colleague. Each web service will have its own URI (URL Path), HTTP method, response headers and body and finally response status code.
This information could be provided to you in a well-known format for REST API specifications like OpenAPI (formerly Swagger). Some of the dummy API services like QuickMocker will allow you to import specifications even in bulk.
Summary
API mocks or dummy API services became vital and crucial for developers and business in order to unblock dependencies on a real API that is not available yet and continue coding apps and running automation tests.