As a an App Developer it isn't uncommon to need to mock an API for a new project whose API hasn't been developed yet. You could also want to use one like the marvel ones used in many meetups that allows you to create a fully functional app without getting your hands dirty on the backend.
In this particular case I need an out of the box solution that allows me to easily model, document, test and mock a new API. These are a few of the solutions I found out there.
Option 1: Swagger
Swagger is sometimes incorrectly categorized as a modeling language, truly it is so much more. It uses OpenAPI specification which is both machine and human readible. It counts with massive adoption and community support.
Swagger is supported by most free/commercial options I researched so the definition written with these tools could be used to generate the server stubs on a second phase. The power of this solution lies in that it allows top-down approach where you would use the Swagger Editor to create your Swagger definition and then use the integrated Swagger Codegen tools to generate server implementation.
Option 2: Mockable.io
Mockable.io seems to be a good option for mocking an API when you need to develop a client without worrying too much about the backend. The console is easy to use, allows collaboration and seems to integrate with Swagger. They have free options and trials which is really nice.
Another cool feature is the template assistant that allows you to automate common tasks easily, i.e: Retrieve headers from the request, return dynamic responses, etc.
Option 3: Apiary
This to me looks like the best of both worlds, it supports API Blueprint and OpenAPI Modeling languages from an easy to use UI.
Here you have the convenience of controling the API from the Dashboard with easy access to Documentation, mocks, tests and even an editor that commits and pushes to your github repo. But if you decide to move on to the actual API implementation you can still reuse all the work done in this stage.
It integrates with Github meaning your API definition is versionated out of the box.
It integrates with Dredd a language agnostic API testing tool. Dredd integrates with most common Continuous Integration platforms: Travis CI, CircleCI, Jenkins, ... In terms this means that your tests can be used to test the actual implementation of the API still complies with the contract once it's implemented.
They offer free plan and trial on premium plan so you can try the product.
As an app developer for me the most immediate benefit is to be able to concentrate on developing a fully functional client with minimum effort invested on the backend. However my backend developer background makes me appreciate the collateral benefits derived from this solution:
- Debate over API model is encouraged from kickoff
- A well modeled API is easier to maintain
- The API specs are written from the consumers point of view
- Backend developers can agree on the contract before a single line of code is implemented