Faker API REST

An API REST to fake any other one.

Goals:

Usage

Make an HTTP request with search params like status, body, header, or delay to get the response you want.

Example:

GET https://faker.deno.dev/?body=hola&delay=1000&status=400
HTTP/1.1 400 Bad Request
content-type: text/plain
content-length: 4

hola

Try yourself: https://faker.deno.dev?body=hola&status=569

Body

Specify a search body param to retrieve a response with that body.

GET https://faker.deno.dev/?body=hola
HTTP/1.1 200 OK
content-type: text/plain
content-length: 4

hola

Response Status

Specify a search status param to get back that code status. The status must be inside the range 200 to 599.

GET https://faker.deno.dev/?status=301
HTTP/1.1 301 Moved Permanently
content-type: text/plain
content-length: 0

Headers

Specify a search header param as a JSON string to get them back.

GET https://faker.deno.dev/?headers={"x-hello":"world"}
HTTP/1.1 200 OK
x-hello: world
content-length: 0

Delay

Specify a search delay param in milliseconds in order to delay the response.

GET https://faker.deno.dev/?delay=1000

/pong

Replay with the same body and header as the request

POST https://faker.deno.dev/pong
?status=201
&delay=100
&body=willBeIgnored
&headers={"x-hola":"mundo"}
X-hello: world
content-type: text/plain

{"a":1}

HTTP/1.1 201 Created
X-hello: world
x-hola: mundo
content-type: text/plain

{"a":1}

Fakerjs

Oficial docs:

Official docs: https://fakerjs.dev

Language:

Default language is es, but can be specified with the accept-language header.

To know the languages included, check out the docs at https://fakerjs.dev/guide/localization.html#available-locales

GET https://faker.deno.dev/name/firstName
accept-language: en

HTTP/1.1 200 OK
content-type: application/json; charset=utf-8

"Chesley"

Passing Arguments:

Once a path finds a method on Faker, the rest of the path will be used as arguments.

Using path phone/number/###-###-#### will call faker.phone.number('###-###-####')

GET https://faker.deno.dev/phone/number/###-###-####
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8

"956 687 564"

It can receive any type of argument, like object, array, string, number.

But keep in mind that objects and arrays must be passed as JSON strings.

GET https://faker.deno.dev/datatype/number/{"max":3,"min":1}

If needed, use encodeURIComponent to pass an argument with special characters.

Endpoints:

The following endpoints are available to get random data using faker.js. The API will return a JSON response with the data generated.

datatype:

/datatype/boolean/

date:

/date/month/

/date/weekday/

/date/timeZone/

/date/anytime/

/date/past/

/date/future/

/date/between/

/date/betweens/

/date/recent/

/date/soon/

/date/birthdate/

number:

/number/int/

/number/float/

/number/binary/

/number/octal/

/number/hex/

/number/bigInt/

string:

/string/fromCharacters/

/string/alpha/

/string/alphanumeric/

/string/binary/

/string/octal/

/string/hexadecimal/

/string/numeric/

/string/sample/

/string/uuid/

/string/ulid/

/string/nanoid/

/string/symbol/

airline:

/airline/airport/

/airline/airline/

/airline/airplane/

/airline/recordLocator/

/airline/seat/

/airline/aircraftType/

/airline/flightNumber/

animal:

/animal/dog/

/animal/cat/

/animal/snake/

/animal/bear/

/animal/lion/

/animal/cetacean/

/animal/horse/

/animal/bird/

/animal/cow/

/animal/fish/

/animal/crocodilia/

/animal/insect/

/animal/rabbit/

/animal/rodent/

/animal/type/

book:

/book/author/

/book/format/

/book/genre/

/book/publisher/

/book/series/

/book/title/

color:

/color/human/

/color/space/

/color/cssSupportedFunction/

/color/cssSupportedSpace/

/color/rgb/

/color/cmyk/

/color/hsl/

/color/hwb/

/color/lab/

/color/lch/

/color/colorByCSSColorSpace/

commerce:

/commerce/department/

/commerce/productName/

/commerce/price/

/commerce/productAdjective/

/commerce/productMaterial/

/commerce/product/

/commerce/productDescription/

/commerce/isbn/

company:

/company/name/

/company/catchPhrase/

/company/buzzPhrase/

/company/catchPhraseAdjective/

/company/catchPhraseDescriptor/

/company/catchPhraseNoun/

/company/buzzAdjective/

/company/buzzVerb/

/company/buzzNoun/

database:

/database/column/

/database/type/

/database/collation/

/database/engine/

/database/mongodbObjectId/

finance:

/finance/accountNumber/

/finance/accountName/

/finance/routingNumber/

/finance/maskedNumber/

/finance/amount/

/finance/transactionType/

/finance/currency/

/finance/currencyCode/

/finance/currencyName/

/finance/currencySymbol/

/finance/bitcoinAddress/

/finance/litecoinAddress/

/finance/creditCardNumber/

/finance/creditCardCVV/

/finance/creditCardIssuer/

/finance/pin/

/finance/ethereumAddress/

/finance/iban/

/finance/bic/

/finance/transactionDescription/

food:

/food/adjective/

/food/description/

/food/dish/

/food/ethnicCategory/

/food/fruit/

/food/ingredient/

/food/meat/

/food/spice/

/food/vegetable/

git:

/git/branch/

/git/commitEntry/

/git/commitMessage/

/git/commitDate/

/git/commitSha/

hacker:

/hacker/abbreviation/

/hacker/adjective/

/hacker/noun/

/hacker/verb/

/hacker/ingverb/

/hacker/phrase/

image:

/image/avatar/

/image/avatarGitHub/

/image/avatarLegacy/

/image/url/

/image/urlLoremFlickr/

/image/urlPicsumPhotos/

/image/urlPlaceholder/

/image/dataUri/

internet:

/internet/email/

/internet/exampleEmail/

/internet/userName/

/internet/username/

/internet/displayName/

/internet/protocol/

/internet/httpMethod/

/internet/httpStatusCode/

/internet/url/

/internet/domainName/

/internet/domainSuffix/

/internet/domainWord/

/internet/ip/

/internet/ipv4/

/internet/ipv6/

/internet/port/

/internet/userAgent/

/internet/color/

/internet/mac/

/internet/password/

/internet/emoji/

/internet/jwtAlgorithm/

/internet/jwt/

location:

/location/zipCode/

/location/city/

/location/buildingNumber/

/location/street/

/location/streetAddress/

/location/secondaryAddress/

/location/county/

/location/country/

/location/continent/

/location/countryCode/

/location/state/

/location/latitude/

/location/longitude/

/location/direction/

/location/cardinalDirection/

/location/ordinalDirection/

/location/nearbyGPSCoordinate/

/location/timeZone/

lorem:

/lorem/word/

/lorem/words/

/lorem/sentence/

/lorem/slug/

/lorem/sentences/

/lorem/paragraph/

/lorem/paragraphs/

/lorem/text/

/lorem/lines/

music:

/music/album/

/music/artist/

/music/genre/

/music/songName/

person:

/person/firstName/

/person/lastName/

/person/middleName/

/person/fullName/

/person/gender/

/person/sex/

/person/sexType/

/person/bio/

/person/prefix/

/person/suffix/

/person/jobTitle/

/person/jobDescriptor/

/person/jobArea/

/person/jobType/

/person/zodiacSign/

phone:

/phone/number/

/phone/imei/

science:

/science/chemicalElement/

/science/unit/

system:

/system/fileName/

/system/commonFileName/

/system/mimeType/

/system/commonFileType/

/system/commonFileExt/

/system/fileType/

/system/fileExt/

/system/directoryPath/

/system/filePath/

/system/semver/

/system/networkInterface/

/system/cron/

vehicle:

/vehicle/vehicle/

/vehicle/manufacturer/

/vehicle/model/

/vehicle/type/

/vehicle/fuel/

/vehicle/vin/

/vehicle/color/

/vehicle/vrm/

/vehicle/bicycle/

word:

/word/adjective/

/word/adverb/

/word/conjunction/

/word/interjection/

/word/noun/

/word/preposition/

/word/verb/

/word/sample/

/word/words/