Sample projects
Three practice APIs you run on your own computer. Each one is a pair of files: a Mock Studio project that pretends to be the API, and an ApiWorkbench collection of requests and tests that exercises it. Import both, press Start server, and follow the lab.
Nothing here needs an account, the internet or any code.
What you need
| Mock Studio | Runs the practice API |
| ApiWorkbench | Sends the requests and runs the tests |
New to both? Do Your first API call and Your first mock server first. They take ten minutes each.
How every lab starts
The same four steps open each lab.
Download the two files from the lab page.
Import the mock. In Mock Studio, select Import on the rail, choose Mock Studio project file and pick the file ending in
.mockstudio.json. Then select Start server.Import the requests. In ApiWorkbench, select Import on the rail, choose the file ending in
.apiworkbench.json, and select Import.Check the connection. Open the first request of the new collection and select Send. A
200means the two apps are talking.
Each mock uses its own port, so all three can run at the same time:
| Project | Address |
|---|---|
| Todo API | http://localhost:4010 |
| Shop API | http://localhost:4020 |
| Flaky Payments | http://localhost:4030 |
The address is stored once, in the collection variable baseUrl. If a port is already taken on your machine, change the port in Mock Studio's Project settings and change baseUrl to match.
All downloads
- todo-api.mockstudio.json and todo-api.apiworkbench.json
- shop-api.mockstudio.json, shop-api.apiworkbench.json and shop-orders.csv
- flaky-payments.mockstudio.json and flaky-payments.apiworkbench.json
The files are plain JSON. Open one in a text editor to see how a project or a collection is stored; Projects, files and Git and Export and share explain the formats.
Make them yours
These are starting points. Good next exercises:
- Add an endpoint to the mock, then a request and tests for it.
- Break the mock on purpose (change a status, rename a field) and watch which tests catch it.
- Write a test plan for one of the APIs before reading its lab.
- Run a collection from the command line with
apiworkbench-cli.