Para hacer una prueba de concepto que tengo en mente, necesitaba generar una cantidad de datos de usuarios grande.
Existen varias bibliotecas para tal cometido, pero en cada proyecto hay que meter la biblioteca y usarla. Y no quería eso.
Así que he creado una pequeña api rest que permite obtener usuarios haciendo una llamada http.
curl https://gofakerapi.athosnetwork.es/api/person | jq
[
{
"nombre_usuario": "clifton_johns",
"nombre": "Cooper",
"apellido": "Rohan",
"movil": "197.307.7569",
"fotos": [
"http://robohash.org/vcPVe5zSw08Df9mH.png?size=300x300",
"http://robohash.org/5WK2MNgjbDLApE47.png?size=300x300",
"http://robohash.org/hmHia6sA4DK0uftP.png?size=300x300",
"http://robohash.org/ZdQVT8ObmrLF9uv2.png?size=300x300",
"http://robohash.org/65Zjwqmnys7el2fU.png?size=300x300"
],
"ciudad": "Amaritown",
"direccion": "1938 Schinner Ville Suite 851, West Hassie Tennessee 36884",
"email": "danielle@yahoo.com",
"web": "hartmannharber.info",
"edad": "1967-10-07T13:21:47Z"
}
]
En la llamada http, podemos pasar el parámetro quantity pasándole un número entre 1 y 1000.
curl https://gofakerapi.athosnetwork.es/api/person?quantity=4 | jq
{
"nombre_usuario": "ronny_lind",
"nombre": "Lauryn",
"apellido": "Dach",
"movil": "1-360-798-4128",
"fotos": null,
"ciudad": "West Effie",
"direccion": "4613 Selena Mount Apt. 957, West Ed Delaware 80790",
"email": "lenora@gmail.com",
"web": "lubowitz.biz",
"edad": "2002-02-03T11:07:30Z"
},
{
"nombre_usuario": "tremaine",
"nombre": "Fermin",
"apellido": "DuBuque",
"movil": "917-527-0864",
"fotos": null,
"ciudad": "Quitzonside",
"direccion": "54035 Ferry Cliff Suite 332, New Oscar Maryland 27960",
"email": "haven@yahoo.com",
"web": "macgyver.biz",
"edad": "1974-08-03T10:45:23Z"
},
{
"nombre_usuario": "florine",
"nombre": "Chelsea",
"apellido": "Boyle",
"movil": "361-743-3977",
"fotos": [
"http://robohash.org/uayV6f3HKlvLY0MQ.png?size=300x300"
],
"ciudad": "New Kaycee",
"direccion": "34414 Colt Estate Suite 544, Jacobsville California 26037",
"email": "issac@gmail.com",
"web": "runte.net",
"edad": "1980-09-07T17:14:57Z"
},
{
"nombre_usuario": "giovanni",
"nombre": "Juwan",
"apellido": "Hand",
"movil": "(564) 970-1957",
"fotos": [
"http://robohash.org/kJ1yvBVQNrhjAaWc.png?size=300x300",
"http://robohash.org/Ofgeao3NtGX7Fd0Z.png?size=300x300"
],
"ciudad": "West Daisyberg",
"direccion": "801 Winifred Expressway Apt. 903, South Antone Rhode Island 38439-5584",
"email": "prudence_mayert@gmail.com",
"web": "satterfield.net",
"edad": "1972-05-19T23:32:56Z"
}
]
De momento sólo tiene un endpoint (/person) que devuelve un array de personas.
Iré actualizando tanto la api como este artículo en función de las necesidades que me vayan surgiendo.
Si necesitas algún otro endpoint, puedes participar en el proyecto
https://gitlab.com/athos.oc/gofakerapi