mercredi 26 août 2015

How to create a random data API

I want to create a server side API that returns random data from a text file list. And when user call that api, random data from each set of list is displayed (but data from each set should match each other) . Something like the random user generator API. So basically I have 2 lists:

Names (Names.txt)

John
Andy
James

Family Name (Family.txt)

Doe
Candy
Mill

and the basic random return json file when calling the API (http://ift.tt/1Lx3IrX) is :

{
  "name":"John",
  "family":"Doe"
}

I can't find any good tutorials on how to do this on my own server. I have found many websites which offer similar services but I want to create my own.

Update: I want every name to match exactly a specific family name. For example json output is first name and first last name, an other call outputs second name and second last name and etc.

Can someone points me to the right direction on how to do this?




Aucun commentaire:

Enregistrer un commentaire