Endpoints
This is documentation for the Mock API Endpoints admin page in RequestBite HQ.
Prerequisites
To create an endpoint, you first need to:
Create a new endpoint
To add a new endpoint, do like this:
- Click the blue Add Endpoint in the upper right corner.
- In the modal that appears, provide the following:
Types of paths
The following are examples of valid paths:
/users
Will return an array of objects for e.g. GET requests./users/:id
Is used to return (or e.g. update or delete) a specific object./users/contacts
A nested path. Will return an array of objects for e.g. GET requests./users/contacts/:contactId
A nested path. Used to return, update or delete a specific object.
Rules and limitations
You cannot currently create nested paths like this:
plaintext
/users/:id/delete
This is a limitation that we will eventually remove.
To have working resource endpoints, the name of a resource ID in your path needs to be the same as the resource ID in your corresponding model. I.e. if you have a path like this:
plaintext
/users/:userId
Then the field in your model that represents your userId should have the same name, i.e.:
json
{
"userId": "$uuid", // The field with value "$uuid" must be called "userId"
"foo": "bar"
}