XapiX Blog

Faking your Data in 5min

Posted by Elizabeth Ferrao on May 5, 2017 7:15:15 AM

Unsure which services to build for developers because you don't know how they'll use the data?

Start with faking data quickly as part of your development process and get dummy objects floating around your system to confirm your API structure. This provides your API stakeholders with a concrete example of what the objects will look like when all is done.

On XapiX, this is easy with our data faking feature. 

Note: Data faking is NOT a solution for load testing - XapiX being a robust system and able to handle millions of calls per second solves that predicament.


Here is a screenshare for how I went through the tutorial:




 

Let's start faking data!

Make a new project in https://app.xapix.io/projects/new

Screen Shot 2017-05-05 at 8.14.02 AM.png

 

Now that we're on the project dashboard, we see it's a bit bare right now.

Scroll down to 'project's resource classes' and click "New". Mine is called 'RC_Data_fakes'. Click 'Create Resource Class'.

Screen Shot 2017-05-05 at 8.14.50 AM.png

 

Now we're back on Dashboard. In "Attributes and Relationships", we will type in a few attributes. 

 

The fun part of data faking is deciding which values to fake!

Look through this library (https://github.com/stympy/faker) and decide 3 values you will fake. 

I chose:

Name: Faker::Name.name  

Number:  Faker::Number.number(3)

Character:  Faker::StarWars.character

 

There are MANY values but here are some sample ones: 

Random job: Faker::Job.title

Random email: Faker::Internet.email

Random password: Faker::Internet.password

Random city: Faker::Address.city

Random street: Faker::Address.street_name

Random planet: Faker::Space.planet

Random Twitter: Faker::Twitter.user

Lorem Ipsum Paragraph: Faker::Lorem.paragraph

 

 

For now, enter just the name into 'Attributes and Relationships'. Click "Save". 

Screen Shot 2017-05-05 at 9.25.24 AM.png

 

Now to fake some data!

Click "New" in "Resource Class Fakes".

Screen Shot 2017-05-05 at 8.23.03 AM.png

As we just decided the values we wanted, in the "Helpers" section, choose the 'Faker' type you decided on above. Once that is entered into "Helpers", the "Formula will automatically update. 

Screen Shot 2017-06-05 at 11.07.14 AM.png

Resource count means how many lines of data to have - 100 is default. Let's change it to 1000.

Click "Create Resources Class Fake". This page is our fake data home page.

Screen Shot 2017-05-05 at 9.31.45 AM.png

 

Scroll down to see sample data. It's all different names, numbers, and Star Wars characters! 

Screen Shot 2017-05-05 at 9.32.39 AM.png

Click "Publish". You'll see this top blue bar: Screen Shot 2017-05-05 at 8.38.10 AM.png

Click "Publish" again and now the blue bar will read "Resource Class Published". 

Estupendo! You can now make as many data fakes as your heart desires.

 

Now your API can always be prepped for any type of request. Enjoy the freedom!

logo-2.png

Welcome to the XapiX Blog

Your Portal to the API World

Check back here often or subscribe below to get the lastest on the API world from XapiX. From developer community interviews to insights and stories from the XapiX team itself, our blog will keep you updated with the most recent API trends.

Subscribe to Email Updates

Recent Posts

Posts by Topic