Setting the "State" field with a URL param, that then generates a random address for that state

Hello there… hope this one is easy:

So I have a schema to generate a random Address limited to the US. What I am hoping I can do is pass a state in a get request like ?state=California which is then used to filter down the results to only California.

So I can call my get request without any params to get any of the 50 states addresses or I can pass a state in the params to get a random address for that state.

Is this possible?

It’s definitely possible.

  1. Create a schema Mockaroo - Random Data Generator and API Mocking Tool | JSON / CSV / SQL / Excel
  2. Then create an API. The Handler Script can be as simple as this:
schema "GET State"
generate 10
  1. Call your API

This should give you an idea of how you can accomplish your request.