factor all d3.json calls into a single "do_API" function