How to create a mock API in 5 minutes

How to create a mock API in 5 minutes image

Mockaroo is one of the best and easiest websites to create mock data with.

I have used it countless times whenever I needed a lot of test data for data visualisation.

You can also use it for machine learning experiments.

In this article I will guide you through the three steps of creating a simple mock API with generated mock data.

Step 1 – Create a schema

In order to save the schema and eventually create a mock API, you will need to sign-up.

After signing up you want to go to the schemas tab

Mockaroo homepage

In here is you can add the different attributes that your object is going to have.

Mockaroo has a wide range of possible data types, as well as a “Custom List” option in case the default types don’t suit you.

Mockaroo API data types

After selecting data types for all of your fields, go ahead and pick the amount of objects you’d like to be generated.The field is right bellow the last data field and it’s called “# Rows”.

Step 2 – Generate the API

Now you can go over to the Mock APIs tab and click on “Create a new mock API”

Mock APIs page in Mockaroo

You can then set the schema that you’d like to use.

Make sure that the name on the Handler Script matches the name of your schema EXACTLY.

Mockaroo API generation

After that you can click on “Create Mock API” and test it out by visiting the provided link and API key.

Bonus step

You change the HTTP verb to PUT, POST, etc if you’d like to test data submission as well.

If you would like a more detailed look into how to create mock API or if you’d like to learn more about implementing the different HTTP verbs, feel free to leave a comment on the video below.

Thank you for reading! 👨🏿‍💻

Leave a Reply

Your email address will not be published.