The Ranmoji public API exposes a single GET
endpoint for returning a single random emoji.
Endpoint
https://ranmoji.herokuapp.com/emojis/api/v.1.0/
example response:
parsing fetch request repsponse.json()
will result in the following data.
json
{
"emoji": "⛩"
}
Demo Use
Here, we make a fetch request to the API endpoint, parse the response, and can use the returned json data.
function getRandom() {
fetch('https://ranmoji.herokuapp.com/emojis/api/v.1.0/')
.then(response => {
response.json().then(data => {
console.log('data!', data);
})
});
}
See it in action on CodePen. Press RERUN
in the example below to see the demo return new, random emojis.
See the Pen Ranmoji API usage-example by Genki Hagata (@hagata) on CodePen.