Add subnets/supernets api handlers

Also fixed up some flake errors.