https://app.jsonserver.io
.
However, this possibilities are optional except the creation of at least one fake API server
to get a API token.
The use of our platform requires an account which you can create here.
A jsonserver.io account is completely free as long as you not subscribe for a paid plan.
https://api.jsonserver.io
.
It is secured by a API token which is generated for each of your created API servers
individually and also by
https protocol
, but which is not required. Due to the support
of
CORS (cross-origin resource sharing)
on our API, you can use it from
everywhere.
X-Jsio-Token
.
https://api.jsonserver.io/servers
).
X-Jsio-Token
.
POST https://api.jsonserver.io HTTP/2.0
Content-Type: application/json
X-Jsio-Token: your-api-token-here
{....}
POST
method and should always target the root url
, in other words, this method
will not work with a url path,
if you want to work with url paths, then skip to Request
saved resources.
schema
which is used to generate the fake data for response. A very basic
request looks like this one.
POST https://api.jsonserver.io HTTP/2.0
Content-Type: application/json
X-Jsio-Token: your-api-token-here
{
"name": "person.firstName"
}
{
"name": "John Doe"
}
{
"@options": {
"statusCode": 500,
"delay": 1000
},
"@headers": {
"X-Custom-Header": "Test-123"
},
"name": "person.firstName"
}
curl -X POST \
-H "Content-Type: application/json" \
-H "X-Jsio-Token: your-token-here" \
-d '{"name": "person.firstName"}' \
https://api.jsonserver.io
https://app.jsonserver.io/servers
and create a new
resource by
click the plus button on the left.
url path
(route) that is
relevant for the request. The API endpoint for requesting saved resources allows
GET
,
POST
, PATCH
, PUT
and DELETE
as http
method.
/shelves/*/books
.
The request
to receive the fake data as defined in your saved resource would looks like this one:
GET https://api.jsonserver.io/shelves/1234/books/5678 HTTP/2.0
Content-Type: application/json
X-Jsio-Token: your-api-token-here
GET
request method, but others are allowed too (see information above).
curl -X GET \
-H "X-Jsio-Token: your-token-here" \
https://api.jsonserver.io/shelves/123/books/567
access-control-allow-credentials: true
access-control-allow-headers: *
access-control-allow-methods: GET, POST, PATCH, PUT, DELETE
access-control-allow-origin: *
content-type: application/json; charset=utf-8
etag: xxxxxxxxxxxxxxxxxxxxxxxxx
status: XXX
{
"error": {
"status": 401,
"reason": "Unauthorized",
"message": "...",
"details": []
}
}
{
"error": {
"status": 400,
"reason": "Invalid",
"message": "...",
"details": {
"hint": "..."
}
}
}
429
.
Due to our request quota recharge feature, you will gain as many new requests as your plan
defines per minute,
so you will be able to have some free request quota again after some waiting time.
{
"error": {
"status": 429,
"reason": "LimitReached",
"message": "...",
"details": []
}
}
{
"error": {
"status": 404,
"reason": "NotFound",
"message": "...",
"details": {
"info": "...",
"hint": "..."
}
}
}
The spawning of arrays
.
syntax
in the schema,
which is a keyword named spawn
that expect a int value as parameter within the
round brackets right
behind the keyword e.g. spawn(10)
. The are two possibilities of spawning
arrays: Spawning an
array by structure and spawning by a simple value. This two possibilities are intended to
achieve
different results in spawning. There is also a detail at spawning of root level structures
which should be
considered, which is described in the next sections.root level
structure does expect only the
spawn keyword
as property name
whereas the spawning of a non root level
structure
expects a
property name combined with the keyword
.root
level structure:
{
"spawn(3)": {
"id": "crypt.uuid",
"email": "user.email"
}
}
Response body:
[
{
"id": "fd9e1067-2b13-4539-895e-eaa87afb9558",
"name": "Catherine"
},
"id": "ca9e542b-7d84-4726-9e61-31baa1d25ba2",
"name": "Cortney"
},
"id": "4bf3309b-b72c-4b48-a1fd-3bcdbd574443",
"name": "Loriann"
}
]
non root
level structure:
{
"id":"crypt.uuid",
"customer": "company.name",
"orders|spawn(3)": {
"id": "crypt.uuid",
"product": "product.name",
"amount": "number.int(300, 500)"
}
}
Response body:
{
"id": "16812b67-80a9-4d26-b122-b67f7ff558ea",
"customer": "Kameeron Industries",
"orders": [
{
"id": "ef772c25-9709-470e-96e1-c95f6966b8f7",
"product": "Freshdox",
"amount": 373
},
{
"id": "c9177926-330c-4fd8-9a7c-c288f86870f0",
"product": "Tam Rantrax",
"amount": 399
},
{
"id": "8730562a-db1e-4e64-8bed-738aac256881",
"product": "Ontolight",
"amount": 373
}
]
}
non root
level structure:
{
"id":"crypt.uuid",
"names": "person.firstName|spawn(3)"
}
Response body:
{
"id": "dcb757c1-17fb-4524-a3d4-4bfb022e6614",
"names": [
"Leisa",
"Lasonya",
"Serafina"
]
}
person.insuranceNumber
to generate a random insurance number.
{
"name": {
"first": "person.firstName",
"middle": "person.firstName",
"last": "person.lastName",
},
"insurance": {
"number": "person.insuranceNumber"
},
"age": "person.age"
}
Some subjects provides the possibility to influence the
generated result by using parameters right behind the subject. The following schema example
will generate
a age between 20 and 30.
{
"age": "person.age(20, 30)"
}
Expression | Parameter | Description |
---|---|---|
person.firstName |
A random first name.
| |
person.lastName |
A random last name.
| |
person.fullName |
A random full name.
| |
person.age | min (default: 1) optional max (default: 100) optional |
A random age.
|
person.weightKG | min (default: 40) optional max (default: 150) optional |
A random weight number for KG.
|
person.weightLBS | min (default: 80) optional max (default: 300) optional |
A random weight for LBS
|
person.bodyHeightCm | min (default: 150) optional max (default: 200) optional |
A random body high in cm.
|
person.bodyHeightInch | min (default: 60) optional max (default: 80) optional |
A random body height in inch.
|
person.maritalStatus |
A random material status.
| |
person.hobbies | min (default: 1) optional max (default: 5) optional |
A random hobby.
|
person.insuranceNumber |
A random insurance number.
| |
person.gender |
A random gender.
| |
person.language |
A random language.
| |
person.languages | min (default: 2) optional max (default: 4) optional |
One or more random languages as array.
|
person.title |
A random title (Mr. Ms. Master etc.)
| |
person.degree |
A random degree.
| |
person.origin |
A random origin (country).
| |
person.academicTitle |
A random academic Title.
| |
person.academicRank |
A random academic rank name.
| |
person.militaryTitle |
A random military title.
|
Expression | Parameter | Description |
---|---|---|
address.country |
A random name of a country.
| |
address.state | countryCode (default: *) optional |
A random state name of the US country or country passed by country code parameter.
The result is a US state by default, use the country code parameter to choose a different country.Currently available country codes are: US
|
address.stateCode | countryCode (default: *) optional |
A random state code of the US country or country passed by country code parameter.
The result is a US state code by default, use the country code parameter to choose a different country.Currently available country codes are: US*
|
address.countryCode |
A random country code from the world.
| |
address.zipCode |
A random 5-digits zip code.
| |
address.postalCode |
A random 5-digits postal code.
| |
address.zipCodeLong |
A random long zip code #####-####.
| |
address.streetSupplement |
A random street supplement (e.g. house number, apartment number etc.)
| |
address.street | countryCode (default: *) optional |
A random name of a street with a appended street supplement.
The result is a street from US country by default, use the country code parameter to choose a different country.Currently available country codes are: US*
|
address.streetName | c (default: *) optional |
A random name of a street.
The result is a street name from US country by default, use the country code parameter to choose a different country.Currently available country codes are: US*
|
address.city | c (default: *) optional |
A random name of a city of the world.
The result is a world city name by default, use the country code parameter to choose a country.Currently available country codes are: US, DE
|
address.latitude |
A random latitude as float value.
| |
address.longitude |
A random longitude as float value.
| |
address.coordinates |
A random array contains a latitude and a longitude with keys named same.
|
Expression | Parameter | Description |
---|---|---|
crypt.uuid |
A random UUID string.
| |
crypt.md2 |
A random md2 hash.
| |
crypt.md4 |
A random md4 hash.
| |
crypt.md5 |
A random md5 hash.
| |
crypt.sha1 |
A random sh1 hash.
| |
crypt.sha256 |
A random sha256 hash.
| |
crypt.sha384 |
A random sha384 hash.
| |
crypt.sha512 |
A random sha512 hash.
| |
crypt.ripemd128 |
A random ripemd128 hash.
| |
crypt.ripemd160 |
A random ripemd160 hash.
| |
crypt.ripemd256 |
A random ripemd256 hash.
| |
crypt.ripemd320 |
A random ripemd320 hash.
| |
crypt.whirlpool |
A random whirlpool hash.
| |
crypt.tiger128 |
A random tiger128 hash.
| |
crypt.tiger160 |
A random tiger160 hash.
| |
crypt.tiger192 |
A random tiger192 hash.
| |
crypt.snefru |
A random snefru hash.
| |
crypt.gost |
A random gost hash.
| |
crypt.adler32 |
A random adler32 hash.
| |
crypt.crc32 |
A random crc32 hash.
| |
crypt.crc32b |
A random crc32b hash.
| |
crypt.haval128 |
A random haval128 hash.
| |
crypt.haval160 |
A random haval160 hash.
| |
crypt.haval192 |
A random haval192 hash.
| |
crypt.haval224 |
A random haval224 hash.
| |
crypt.haval256 |
A random haval256 hash.
| |
crypt.base64 |
A random base64 string.
| |
crypt.rsaPrivateKey512 |
A private rsa key.
| |
crypt.rsaPrivateKey1024 |
A private rsa key.
| |
crypt.rsaPrivateKey2048 |
A private rsa key.
| |
crypt.rsaPrivateKey4096 |
A private rsa key.
| |
crypt.rsaPublicKey512 |
A public rsa key.
| |
crypt.rsaPublicKey1024 |
A public rsa key.
| |
crypt.rsaPublicKey2048 |
A public rsa key.
| |
crypt.rsaPublicKey4096 |
A public rsa key.
|
Expression | Parameter | Description |
---|---|---|
phone.mobile |
A random mobile phone number.
| |
phone.mobileE164 | ||
phone.local |
A random local phone number.
| |
phone.domestic |
A random domestic phone number.
|
Expression | Parameter | Description |
---|---|---|
user.username |
A random username.
| |
user.fantasyName |
A random fantasy name.
| |
user.password |
A random password.
| |
user.email |
A random email address.
|
Expression | Parameter | Description |
---|---|---|
number.int | min (default: 0) optional max (default: 1000) optional |
A random integer.
|
number.float | min (default: 0) optional max (default: 1000) optional decimals (default: 1) optional |
A random float.
|
number.bool |
A random bool value.
|
Expression | Parameter | Description |
---|---|---|
internet.ip4 |
A random ipv4 address.
| |
internet.ip6 |
A random ipv6 address.
| |
internet.email |
A random email address.
| |
internet.url |
A random url.
| |
internet.tld |
A random top level domain.
| |
internet.userAgent |
A random user agent.
| |
internet.browser |
A random browser name.
|
Expression | Parameter | Description |
---|---|---|
text.sentence | count (default: 1) optional |
On or more sentences.
|
text.paragraph | count (default: 1) optional |
One or more paragraphs.
|
text.word | min (default: 1) optional max (default: 1) optional |
One or more random words as string.
|
text.words | min (default: 3) optional max (default: 8) optional |
One or more random words as array
|
text.businessBuzzWords | min (default: 3) optional max (default: 6) optional |
An array with random buzz words.
|
text.headline |
A random headline.
| |
text.hashtags | count (default: 6) optional |
A array with random hashtag words.
|
Expression | Parameter | Description |
---|---|---|
currency.code |
A random 3 letter currency code.
| |
currency.name |
A random currency name.
| |
currency.sign |
A random currency sign.
|
Expression | Parameter | Description |
---|---|---|
food.name |
A random food name.
| |
food.additive |
A random additive.
| |
food.additives | min (default: 0) optional max (default: 6) optional |
One or more random additives as array.
|
food.nutrient |
A random nutrient.
| |
food.nutrients | min (default: 0) optional max (default: 6) optional |
One ore more nutrients as array.
|
food.additiveCode |
A random additive code (e.g. E123)
| |
food.additiveCodes | min (default: 0) optional max (default: 6) optional |
One or more additive codes as array.
|
Expression | Parameter | Description |
---|---|---|
product.name |
A random product name.
| |
product.brand |
A random brand name or a product.
| |
product.sku |
A random SKU.
| |
product.isbn |
A random ISBN.
| |
product.upc |
A random UPC
| |
product.ean |
A random EAN number.
| |
product.type |
A random product type.
| |
product.sizeCode |
A random size code (s, m, xl etc.)
| |
product.size |
A random size as word (small, medium...)
| |
product.stars |
A random int from 1 to 5.
| |
product.starsFloat | ||
product.reviews |
A random number of product reviews.
|
Expression | Parameter | Description |
---|---|---|
company.name |
A random name of a company.
| |
company.slogan |
A random slogan of a company.
| |
company.industry |
A random industry.
| |
company.department |
A random department of a company.
| |
company.legalType |
A random company legal type.
| |
company.position |
A random slogan of a company.
| |
company.cin |
A random CIN.
| |
company.ein |
A random EIN.
|
Expression | Parameter | Description |
---|---|---|
employee.skills | min (default: 3) optional max (default: 8) optional |
One ore more skills as array.
|
employee.ein |
A random EIN.
| |
employee.job |
A random job name.
| |
employee.salary |
A random integer for salary.
| |
employee.intensity |
A random job intensity name (part-time, full-time)
|
Expression | Parameter | Description |
---|---|---|
custom.random | values optional |
A random value from the values given by parameters.
|
custom.value | value |
A custom value from first parameter.
|
custom.format | format optional |
A custom format given by the first parameter.
Use the following placeholder to generate random characters.%a for a-z, %A for A-Z, # for 0-9, any other char will be keep as is.
|
Expression | Parameter | Description |
---|---|---|
color.name |
A random color name.
| |
color.hex |
A random color hex value (e.g. #FFFFFF).
| |
color.hexValue |
A random hex value (e.g. FFFFFF).
|
Expression | Parameter | Description |
---|---|---|
date.format | format optional |
A random formatted date, use first parameter for format.
|
date.unixTimestamp |
A random unix timestamp.
| |
date.timestamp |
A random timestamp (0000-00-00 00:00:00)
| |
date.date |
A random date (0000-00-00).
| |
date.time |
A random time (00:00:00)
|
Expression | Parameter | Description |
---|---|---|
bank.name |
A random name of a bank.
| |
bank.creditCardBrand |
A random credit card brand name.
| |
bank.creditCardNumber |
A random credit card number.
| |
bank.creditCardLast4 |
A random 4-digit number represents the last 4 of a credit card number.
| |
bank.creditCardCVC |
A random CVC number used by credit cards.
| |
bank.iban |
A random IBAN formatted string.
| |
bank.bic |
A random BIC formatted string.
|