Quantcast
Channel: Mockaroo Community Forum - Latest posts
Viewing all articles
Browse latest Browse all 2665

How do I use an API to query data from a dataset?

$
0
0

I think what you want to do is add a Formula column to your schema and use the from_dataset() function to pull out values based on a parameter.

So something like:

from_dataset("My Data", "some column", username: request_params['username'])

This would pull the value of some_column from the dataset called "My Data" where the username column in the dataset matches the value of the username parameter in the query string of the API request.

From the docs:

from_dataset("dataset", "column", join_criteria) => Fetches a value from a dataset.
For example, from_dataset("People", "name", id: person_id) returns the value of the "name" column from the "People" dataset where the id column matches the person_id column in the current schema.

See https://www.mockaroo.com/help/formulas


Viewing all articles
Browse latest Browse all 2665

Trending Articles