Get "PHP 8 in a Nuthshell" (Now with PHP 8.4)
Amit Merchant

Amit Merchant

A blog on PHP, JavaScript, and more

Mock JSON API endpoints for Testing

So, imagine a scenario where you’re working on a project that has its front end (or a mobile app) ready to consume data from the backend. But, the backend is not ready yet. How would you test your front end in this case?

Well, I have been using npoint.io for this purpose for quite some time now and it’s a tool that you can use to mock JSON API endpoints for testing.

Essentially, it lets you create temporary JSON endpoints, based on a JSON schema of your choice, which you can consume wherever you want. It’s a free service and you don’t even need to sign up to use it.

All you need to do is, go to the npoint.io website, paste in your JSON schema, and click on the Create JSON Bin button.

create endpoint

This will give you an endpoint URL that you can use to fetch data from.

using endpoint

By default, any endpoint that you create without signing up will be public. So, if you want to keep your endpoints private, you can sign up and create private endpoints.

You can further lock the data so that it cannot be deleted and none of its data can ever be changed.

I think it’s a nice little tool that can come in handy but try not to hammer it too much since the creator might rate-limit it if that is the case. So, use it responsibly.

Like this article?

Buy me a coffee

👋 Hi there! I'm Amit. I write articles about all things web development. You can become a sponsor on my blog to help me continue my writing journey and get your brand in front of thousands of eyes.

Comments?