Mocking HTTP API without Writing Any Code

Install command line HTTP client, httpie.

brew install httpie 

or

npm install httpie

This tool has sensible defaults so it is much easier to use than curl. To make a get request:

http httpie.org

Apiary provides a mock server for paid accounts. We can use Drakov, a mock Server that implements the API Blueprint specification. It is a free tool to run a mock server locally. Install it:

$ npm install -g drakov

Run the mock server:

$ drakov -f clickplan.apib

You can use the httpie as the HTTP client to test the response:

$ http GET http://localhost:3000/products --json

It is easy to use a mock server to play with your RESTful documentation to see how it works.

References


Related Articles


Ace the Technical Interview

  • Easily find the gaps in your knowledge
  • Get customized lessons based on where you are
  • Take consistent action everyday
  • Builtin accountability to keep you on track
  • You will solve bigger problems over time
  • Get the job of your dreams

Take the 30 Day Coding Skills Challenge

Gain confidence to attend the interview

No spam ever. Unsubscribe anytime.