here you shoud look at the status_code before you actually call json() otherwise you might get a Json error before you get to the API error behavior