zenodeo2

a plazi project

Examples

Web page with images

Let’s say you want to make a web page that displays images for all records with the word 'nymphalidae' in their text. Below is a script that will do the work (change the value for a different query):

nymphalidae

const url = "v2/treatments?page=1&q=nymphalidae&size=30";

fetch(url)
    .then(function(response) {
        if (!response.ok) {
            throw new Error('HTTP error, status = ' + response.status);
        }

        return response.json();
    })
    .then(function(res) {
        const result = document.getElementById('result');
        result.innerHTML = JSON.stringify(res, null, 2);
    });