Free and open source fake API for testing and prototyping
Custom API
Instantly generate a custom API from a JSON object
Rule Engine
Create rules to handle error cases and customize HTTP codes, headers, and bodies
Free & Open source
Use this tool for free; you can also retrieve the source code and set up a local installation
How to create a custom API ?
JSONing API is an open-source mock API available for download on Github, allowing you to have a local API.
You also have the option to create a custom API online by using the editors below to define the resources and any rules. It will be immediately accessible.
Notes: APIs are deleted once a day. If needed, you can recreate it on this page.
Please limit the number of your calls, otherwise please create a local API.
Documentation
Routes
GET | /products | Returns all products |
GET | /products/2 | Returns the product with ID 2 |
POST | /products | Create a new product |
GET | /products/2 | Returns the product with ID 2 |
PUT | /products/2 | Update the product with ID 2 |
PATCH | /products/2 | Update partially the product with ID 2 |
DELETE | /products/2 | Delete the product with ID 2 |
Configuration of the resources
All resources should be placed in a single JSON object. Each attribute of this object is a resource containing an array of elements.
In this example, you have created 2 resources: "products" and "users" (2 elements for each resource):
{
"products": [
{
"id": "1", "name": "T-shirt", "price": 19.99
},
{
"id": "2", "name": "Jeans", "price": 49.99
}
],
"users": [
{
"id": "1", "username": "johndoe", "email": "johndoe@example.com"
},
{
"id": "2", "username": "janedoe", "email": "janedoe@example.com"
}
]
}
Configuration of the rules
Custom rules are defined using JSON. With these JSON-based rules, you can set conditions based on the request (such as HTTP method, headers, and payload) and specify the response (including HTTP status code and payload). This allows you to tailor the API's behavior to meet specific testing and development needs.
Rules are applied before the API execution (which reads, writes, or deletes data).
If multiple rules match the request, only one is executed (the first one found).
The HTTP status and payload defined by the rules take precedence over those set by the API.
Here is an example of a rule that returns an HTTP status 401 when accessing the resource /products/23:
{
"input": { "method": "GET", "path": "/products/23" },
"output": { "status": 401, "response": {"error": "demo error"} },
"stop" : true
}
The stop
attribute indicates whether to halt after applying the rule or to continue with the API execution.
Input
The input
object is used to represent the different criteria that can be tested in the request.
Attribute | Description |
---|---|
headers | The headers (Object: each header is an attribute) |
method | The HTTP method (‘GET’, ‘POST’, ‘PUT’, ‘PATCH’, ‘DELETE’) |
path | The pathname of the URL (e.g., /users/23). |
payload | The payload (object or string) |
Output
The output
object is used to update the response if the rule match.
Attribute | Description |
---|---|
status | Sets the HTTP status (e.g., 200, 404, etc.) |
response | Sets the response payload |
headers | Sets the headers (Object: each header is an attribute) |
Free public API
A public API is available for testing. Note: This API is read-only (You cannot modify the data)
Endpoint:
https://api.jsoning.com/mock/public/{resource}