raise error if constraints of the api is violated

the api returns a HTTP 400 error code, if the username is more than 15 chars

This change ensures this is checked before sending the request