API Mock Server is the server which simulates responses for API requests. It is driven by OpenAPI specification. Using OpenAPI specification the server may prepare fake answers for API requests. Usually mock servers are used by developers to try out APIs and understand better what they can expect from API responses. Developers can create their application without presence of real backend server. They just dirrect API calls to mock server and can build and test their application with fake data. At PD we use two solutions for mock servers:
Mock server reads OpenAPI specification and calculates possible answer for request. Ususally in OpenAPI specification, response contains data scheme where it is specified how the answer will be constructed: what kind of data will be returned (string, number, boolean etc….) and how the response will be structured (structure of json objects/arrays or xml etc…). Sometimes developers provide even examples in OpenApi specifications. Mock server takes these information and produces on the fly possible answer. Currently at Iptor, we use simple mock servers which do not generare any randomized data. There are on the market mock servers which do it but we decded to not use them at this moment.
Note: Generaly mock servers handle only “happy flow”, meaning they create positive answers only. They do not produce “404 - Not found” or “500 - Server error” responses.