refactor specs a little, pull out common api-request function