By codemonth | Updated 10 months ago | Data

0 / 10



Service Level


Back to All Tutorials (4)

Fetching data from individual Binubuo API endpoints

Fetching data from Binubuo API.

This tutorial is a short and simple demonstration on how you can call the Binubuo API to get randomised data. Let us imagine that we need to create a file called names.csv with the names of 10 people. For that we can use the /generator/person/full_name endpoint. Below is an example of how you could call the endpoint and put the list of the names into a file, using powershell.

# First we setup the headers with the correct key. 
# REMEMBER to change the key to your actual RapidAPI key for the example to work.
$headers.Add("x-rapidapi-host", "")
$headers.Add("x-rapidapi-key", "your_own_key_here")
$response = Invoke-RestMethod -Uri '' -Method GET -Headers $headers
# Loop over the response and add each name into file
# "Full name" is the first object in the JSON response, and each name is in an array of objects with they key named R_NAME
foreach ( $node in $response."Full name") {
	Add-Content -Path .\names.csv -Value $node.R_NAME

If you open the names.csv file in a text editor, the content will look like this:

Madeline Richardson
Abigail Washington
Maya Griffin
Kevin Baker
Scarlett Davis
Brandon Collins
Aiden Clark
Lucy Patterson
Payton Peterson
Anthony Moore

With just a list of the 10 names we fetched. Since we named it with a csv extension, you can also open the file in spreadsheet application very easily.

If you look at the above code, you can see that the data will always be present as an array under a named object, that has the name of the endpoint you are calling.

Go back to the list of tutorials and find out how you can easily create csv files with multiple columns of data, integrate the Binubuo API directly within your favorite spreadsheet application or even create your own fully customized data schema with data inheritance or logical flows between data rows.