Models
This is documentation for the Models admin page in RequestBite.
A model represents the schema of the objects that you can work with in your mock API. It's a JSON object with fields (schema) and values (mock data) and on these pages you can define your schema so that the mock API can populate it with realistic data.
Add new model
To add a new model, do like this:
- Click the blue Add Model button in the upper right corner.
- In the dialog that appears, provide the following:
- Name of your mock API model
Provide an optional name for your model. It will be called Untitled model #n if left blank.
- Name of your mock API model
- Click Create.
You will now have a new model with ten (10) default objects (see below to update).
Update new model
To update your new model, do like this:
- Click the name of your model.
- In the form that appears, provide the following
- Name
Keep or update your model name. - Model objects to create
This represents the number of generated instances of your model that the system will create. You can create between 1-100 objects. These are the model objects that you can list and interact with using the mock API. - Schema
Here you can define your model schema. To the right you will see an example of what a generated version of your schema could look like. See below for instructions on how to build your schema.
- Name
- As soon as you have a valid schema, you can click Save to store your updates.
Create schema
RequestBite uses Faker to generate realistic data in your mock API. To see which data from Faker is available, you can start typing your schema like this:
When your schema looks like above, meaning your cursor is next to $
, you can
type Ctrl+Space (or Cmd+Space) to get a dropdown of possible values:
Pick one that is relevant for your field name, e.g. $faker.internet.url
and
you will immediately a reasonable URL rendered in the Example schema output
area.
Available Faker fields
The system can pick any of the following values:
Person related values
-
person.first_name
Generates a first name (e.g., "John"). -
person.last_name
Generates a last name (e.g., "Doe"). -
person.name
Generates a full name (e.g., "Jane Doe"). -
person.first_name_male
Generates a male first name (e.g., "Michael"). -
person.first_name_female
Generates a female first name (e.g., "Sarah"). -
person.last_name_male
Generates a male last name (e.g., "Smith"). -
person.last_name_female
Generates a female last name (e.g., "Johnson"). -
person.prefix
Generates a name prefix (e.g., "Mr.", "Dr."). -
person.suffix
Generates a name suffix (e.g., "Jr.", "PhD"). -
person.job
Generates a job title (e.g., "Software Engineer").
Address related values
-
address.street_address
Generates a street address (e.g., "123 Main St"). -
address.city
Generates a city name (e.g., "Anytown"). -
address.state
Generates a state name (e.g., "California"). -
address.country
Generates a country name (e.g., "United States"). -
address.postcode
Generates a postal code (e.g., "90210"). -
address.zipcode
Generates a zip code (e.g., "10001").
Date/time related values
-
date_time.date
Generates a date string (e.g., "2023-10-27"). -
date_time.time
Generates a time string (e.g., "14:30:00"). -
date_time.iso8601
Generates an ISO 8601 formatted date and time string (e.g., "2023-10-27T14:30:00"). -
date_time.timestamp
Generates a Unix timestamp (e.g., 1666881000). -
date_time.month
Generates a month number (e.g., "10"). -
date_time.year
Generates a year (e.g., "2023"). -
date_time.day_of_week
Generates the name of a day (e.g., "Friday"). -
date_time.date_time
Generates a Python datetime object.
Internet related values
-
internet.email
Generates an email address (e.g., "[email protected]"). -
internet.url
Generates a URL (e.g., "http://example.org"). -
internet.domain_name
Generates a domain name (e.g., "example.com"). -
internet.ipv4
Generates an IPv4 address (e.g., "192.168.1.1"). -
internet.ipv6
Generates an IPv6 address (e.g., "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). -
internet.user_name
Generates a username (e.g., "johndoe"). -
internet.password
Generates a random password string. -
internet.user_agent
Generates a browser user agent string.
Text related values
-
text.word
Generates a single random word. -
text.words
Generates a list of random words. -
text.sentence
Generates a random sentence. -
text.sentences
Generates a list of random sentences. -
text.paragraph
Generates a random paragraph. -
text.paragraphs
Generates a list of random paragraphs. -
text.text
Generates a larger block of random text.
Phone related values
phone.phone_number
Generates a phone number string.
Company related values
-
company.company
Generates a company name (e.g., "Acme Corp"). -
company.company_suffix
Generates a company suffix (e.g., "Inc", "LLC"). -
company.catch_phrase
Generates a business catchphrase. -
company.bs
Generates business "BS" phrases.
Misc values
-
misc.random_int
Generates a random integer. -
misc.random_letter
Generates a random letter. -
misc.random_digit
Generates a random digit (0-9). -
misc.boolean
Generates a random boolean value (True/False). -
misc.uuid4
Generates a random UUID version 4 string. -
misc.color
Generates a color name (e.g., "blue") or hex code. -
misc.locale
Generates a locale code (e.g., "en_US"). -
misc.currency_code
Generates a currency code (e.g., "USD"). -
misc.file_name
Generates a random file name (e.g., "document.txt"). -
misc.file_extension
Generates a random file extension (e.g., "pdf").