Mock API Service
Mock API / DB service for frontend developer
This is mock API / DB service for frontend sample data test purposes. This is free service, no registration required. I've created a Medium article, to show how to use this mock API.
To use this service, you can use the following endpoints:
Endpoint URL: https://mockapi.aizu.my
Fetch all records
GET /:namespace/get
Fetch single record
GET /:namespace/get/:id
Save a new record
POST /:namespace/post
Save an existing record
POST /:namespace/post/:id
Delete a record
DELETE /:namespace/delete/:id
The output is formated in JSON format. Click this test endpoint /demo1234512345/get to see the sample JSON output.
:namespace is a unique identifier for your project. You can use any string as your namespace. For example, if you are building a project called myproject, you can use myproject as your namespace.
:id is a unique identifier for each record. The ID will auto generate and it is sequential (1, 2, 3...).
Example cURL
Below is the example use case for this service using curl command:
Example namespace = data3014
curl https://mockapi.aizu.my/data3014/post -X POST --data '{ "name":"Adam", "age":"20", "role":"PHP Developer" }' -H "Content-Type: application/json"
curl https://mockapi.aizu.my/data3014/get
curl https://mockapi.aizu.my/data3014/get/1
curl https://mockapi.aizu.my/data3014/post -X POST --data '{ "name":"Adam", "age":"20", "role":"Senior PHP Developer" }' -H "Content-Type: application/json"
curl https://mockapi.aizu.my/data3014/delete/1 -X DELETE
Example Axios
Below is the example use case for this service using curl command:
Example namespace = data3014
await axios.post('https://mockapi.aizu.my/data3014/post', { "name":"Adam", "age":"20", "role":"PHP Developer" })
const data = await axios.get('https://mockapi.aizu.my/data3014/get')
const data = await axios.get('https://mockapi.aizu.my/data3014/get/1')
await axios.post('https://mockapi.aizu.my/data3014/post', { "name":"Adam", "age":"20", "role":"Senior PHP Developer" })
await axios.delete('https://mockapi.aizu.my/data3014/delete/1')
Auto generate sample data for testing
Enter the namespace and number of records you want to generate. The sample data will be generated automatically. I use Faker to generate the sample data.
Terms of Use
Well, use your common sense. Do not store any sensitive information and values in this service. I will not be responsible for any loss or damage caused by the use of this service.
FAQ
Q: Why I build this?
This is a simple API service which helps me to simulate the DB call for my project. I can use this service to test my frontend application without worrying about the backend. It also can be used to test the API call for my mobile application.
Q: What is the maximum number of records can be stored?
There is no limit for the number of records. However, the maximum size of the database is 512MB. If the database size is exceeded, the old records will be deleted automatically.
Q: How long the data will be stored?
The data will be stored forever. However, the old records will be deleted automatically if the database size is exceeded.
Q: How many namespaces can I create?
You can create as many namespaces as you want. However, the maximum length of the namespace is 100 characters.
Q: How many fields can I create?
You can create as many fields as you want. However, the maximum length of the field name is 10 characters.
Q: What is the maximum length of the field value?
The maximum length of the field value is 1000 characters.
Q: What is the maximum number of records can be fetched?
The maximum number of records can be fetched is 100 records.
Q: What is the maximum number of records can be deleted?
The maximum number of records can be deleted is 1 record at a time. The endpoint required you to provide ID of the record.
Q: What is the maximum number of records can be add/update?
The maximum number of records can be add / update is 1 record at a time.
Q: How to contact you?
You can contact me at [email protected]
Q: You didn't scare of abuse / hack / vandalise this service ?
Well, I've taken into precoution to prevent unfavourable access; this service is totally in a isolated machine environment, I've sanitized the URL request and I have a request log which I'll check it once a while (am I going to check ? - realizing I'm talking to lazy myself).