APIs

You can modify the internal state of your server by using some of mockit's built-in APIs.

Get state of server

GET http://localhost:3000/mockit/api

Gets the internal state of your mock server.

{
    activeFixtures, // Object containing information about active fixtures
    fixtures, // Array of all fixtures found
    latency // The time in ms to wait before sending response  
}

Modify state of server

PUT http://localhost:3000/mockit/api

Makes updates to the internal state of the server

Headers

NameTypeDescription

Content-Type

object

application/json

Request Body

NameTypeDescription

throttle

string

3G, 4G, WiFi, Disabled

latency

number

When it is set, it will set the server response time to the new latency value.

id

string

The id of a fixture. When it is set, it will set the fixture with that id as active.

{
    activeFixtures,
    fixtures,
    latency
}

Adds a new fixture

POST http://localhost:3000/mockit/api/new

Creates a new fixture

Request Body

NameTypeDescription

data

object

The response data of the API

status

string

The status of the API

method

string

The method of the API

description

string

The description of the fixture

id

string

The id of the fixture

url

string

The endpoint of the API

{
    activeFixtures,
    fixtures,
    latency
}

Server state reset

PUT http://localhost:3000/mockit/api/reset

Resets server state back to when it first started

{
    activeFixtures,
    fixtures,
    latency
}

Last updated