1

I'm exploring API mocking tool and this one seems to be the bee's knees. Even with out figuring this out, I'm still probably going to use it for my needs.

But there's a thing that bugs me. You can mock the response you want using Faker.js in their JSON editor like so:

{
  "username": "$internet.userName",
  "balance": "$finance.amount"
}

This will result in a response that looks like:

[
 {
  "username": "Leilani46",
  "balance": "116.96",
  "userid": "1"
 },
 {
  "username": "Ellie.Stehr26",
  "balance": "15.37",
  "userid": "2"
 },
 {
  "username": "Gilda60",
  "balance": "677.77",
  "userid": "3"
 },
... etc
]

According to the Faker docs you can add parameters to the methods to control the output a little. For example finance.amount(4,10) will give you a number between 4 and 10.

I haven't found a way to get this to work, these have been my attempts:

{
  "username": "$internet.userName",
  "balance": "$finance.amount(4,10)"
}

{
  "username": "$internet.userName",
  "balance": "$finance.amount 4 10"
}

...etc

It always just results in the literal string

[
 {
  "username": "Leilani46",
  "balance": "116.96",
  "userid": "1"
 },
 {
  "username": "Ellie.Stehr26",
  "balance": "$finance.amount(4,10)",
  "userid": "2"
 },
 {
  "username": "Gilda60",
  "balance": "$finance.amount(4,10)",
  "userid": "3"
 },
... etc
]

I've reached out to their contact email, but there's no better place to tell me I'm asking too much of this world than StackOverflow.

Beuller?

Ivan M
  • 31
  • 2

1 Answers1

2

For completion, they reached back out to me and confirmed that what I want to do isn't available, yet.

Ivan M
  • 31
  • 2