Skip to Main Content
 

Blog title

Binubuo - The Basics Part 3

INFO_LIST

  • Author Head Binubuo
  • Category Binubuo API
  • Created Thu, May 12 2022
 

blog sections

Parameters to control your output

In the previous blog entry we started fetching data from the indivdual generator endpoints. It was the simple call, where we did not change anything to alter the output of the call. We used the full_name endpoint to fetch randomly generated names. We will continue to use the same endpoint to show the different capabilities of the standard parameters in Binubuo.

In the Binubuo API there are a number of standard parameters that can define the output you get from the call. Each of them have default values, which can be seen in the documentation.

Standard parameters that can be set for all API calls:

Rows parameter

This parameter controls how many rows of output we get. By default the value of rows is 1 for generators, meaning we get only 1 generated value. If we wanted to fetch more than 1 we simply add the rows parameter to the API url. So if we wanted to generate 5 names we can call:

https://binubuo.com/api/generator/person/full_name?rows=5

cURL example

curl -H @{"x-binubuo-key" = "ASDF1234"} -Method GET 'https://binubuo.com/api/generator/person/full_name?rows=5'

{
"Full name":[
    {
    "R_NAME":"Gianna Reed"
    },
    {
    "R_NAME":"Peyton Barnes"
    },
    {
    "R_NAME":"Jackson Hayes"
    },
    {
    "R_NAME":"Adrian Ross"
    },
    {
    "R_NAME":"Lucas Collins"
    }
]
}

Locale parameter

Many of the generators in Binubuo supports multiple locales. So you can get names, addresses or bank accounts generated in many country specific formats. You can use the locale parameter to specify what country format you want your output in. For a list of the supported locale, you can check the generator documentation where the individual generators list the supported locale options.

So let us say that we wanted to generate 5 names, but they should be from Denmark instead of the US (default), we can call:

https://binubuo.com/api/generator/person/full_name?rows=5&locale=DK

cURL example

curl -H @{"x-binubuo-key" = "ASDF1234"} -Method GET 'https://binubuo.com/api/generator/person/full_name?rows=5&locale=DK'

{
"Full name":[
    {
    "R_NAME":"Julia Hougård"
    },
    {
    "R_NAME":"Liam Hedegård"
    },
    {
    "R_NAME":"Esther Eriksen"
    },
    {
    "R_NAME":"Birk Petersen"
    },
    {
    "R_NAME":"Celina Johansson"
    }
]
}

Tag parameter

Tagging a call is one of the more powerful features of Binubuo. Imagine that you are generating a number of test cases for your code/application and you need to be able to run the same test every time. Normally you would generate the synthetic data you needed for the test, and then you would store it somewhere to reuse it every time you ran the test. What if there was an easier way, than always storing your test data? Well that is where tagging comes into the picture. With tagging you can go back and generate the same data, without the need to store the data (and Binubuo does not store it either). Simply tag a call with whatever tag you want, and you can then use the same call every time you want to reuse that same data. "Repeatable Random" data.

https://binubuo.com/api/generator/person/full_name?rows=5&locale=DK&tag=unit-test-4

cURL example

curl -H @{"x-binubuo-key" = "ASDF1234"} -Method GET 'https://binubuo.com/api/generator/person/full_name?rows=5&locale=DK&tag=unit-test-4'

{
"Full name":[
    {
    "R_NAME":"Kristian Jørgensen"
    },
    {
    "R_NAME":"Nicoline Asmussen"
    },
    {
    "R_NAME":"Cecilie Hald"
    },
    {
    "R_NAME":"Magnus Jessen"
    },
    {
    "R_NAME":"Carla Jespersen"
    }
]
}

These parameters are most likely the ones you will use the most. In later posts we will take a look at the other parameters available.

So now we know how to call and create individual data generators. You can now use any of the 150+ generators available in the Binubuo catalog, to create exactly the type of synthetic data you need.

Useful, but more likely you are here because you need to create more than just one type of data at a time. Perhaps you want to create data for a table in your database, or rows to your spreadsheet? Well then the next entry is just what you need. We will take a look at the simplest way to quickly generate lots of data rows, with multiple generators in the same call.

Don't have an account yet?

If you don't have an account on Binubuo yet, you can create one real quick. Just click "Sign up" in the top right corner, and you are on your way to create all the synthetic data you could dream about.

Want to see how to get started: Get Started Guide

Get more guides and help from the blog

Follow Binubuo on Twitter:


If you already have an account on RapidAPI, you can use your account to access Binubuo

Connect on RapidAPI