Fake Data

Mockgee provides an out-of-the-box feature of setting up mock response fields with a dynamic(fake) value, which produces a new value each time the API is called.

e.g. JSON payload
{ 
    "ID": "$$.uuid", 
    "name": "$$.name", 
    "isEmployee": "$$.boolean",
    "phoneNumber": "$$.int(9)"
}
e.g. XML payload
<?xml version="1.0"?>
<response>
    <ID>$$.name</ID>
    <name>$$.name</name>
    <isEmployee>$$.boolean</isEmployee>
  <phoneNumber>$$.int(9)</phoneNumber>
</response>
Mockgee returns new dynamic values for the ID and name fields with each API request.

To make a specific field dynamic, use the placeholder $$.datatype(size[optional]).prefix/suffix(value)[optional] in the response field's value.

Data Type

Mockgee supports the following data types for generating dynamic values:

  • uuid
  • ip
  • name
  • char
  • int
  • float
  • ints
  • timestamp
  • boolean
  • enum

uuid

To set a uuid value for a field, use the placeholder $$.uuid

This returns universally unique identifier like - 123e4567-e89b-12d3-a456-426614174000

ip

To set a IP value for a field, use the placeholder $$.IP

This returns IP value like - 78.89.124.0

name

To set a String value for a field, use the placeholder $$.name

This returns scientific names of plants randomly example - Pyrus malus

int

To set a integer value for a field, use the placeholder $$.int(size)

For example to return an integer value of size 6, set $$.int(6), This returns randomly generated integer value - 463123

ints

To set a integer value in string format for a field, use the placeholder $$.ints(size)

For example to return an integer value of size 6 in string format, set $$.ints(6), This returns randomly generated integer value - "463123"

float

To set a integer value in string format for a field, use the placeholder $$.float(digitSize, decimalSize)

For example to return an float value of size 4 and decimal point size 2, set $$.float(4,2), This returns randomly generated integer value - 1234.56

timestamp

To set a Timestamp value for a field, use the placeholder $$.timestamp

This returns ISO timestamp value - 2024-02-28T12:25:41.994Z

boolean

To set a Boolean value for a field, use the placeholder $$.boolean

This returns either true or false randomly

enum

To set User Defined value for a field, use the placeholder $$.enum(value_1,value_2,....,value_n)

This returns random value from the argument list.

This is useful when you want returns only specific value for a field.

For example: For a field subscription_type you want to return only specific value either voice or data.

ENUM payload
{ 
  “orderNumber”: 14255, 
  subscription_type": “$$.enum.[voice,data]"
}