Making APIs match up to middleware