API throws exception when response not 200