API 500 on user creation if username is integer


We’ve been having some trouble with the discourse API, and the responsible is the fact that the API sends a 500 when the username is an integer. If you cast that into a string it works…

I’ll fix this on my end and cast my usernames to string but can it be fixed or at least send a 400 back ?

1 Like

Also, when something is incorrect you send a 200 back with success: false which is a bad design. Maybe change this ?

For example:

'{"success":false,"message":"Password est trop court (nombre minimal de caractères : 8)\\nPrimary email a déjà été pris","errors":{"password":["est trop court (nombre minimal de caractères : 8)"],"email":["a déjà été pris"]},"values":{"name":"Jules Lasne","username":"6666","email":"jules@datascientest.com"},"is_developer":false}'

This should return either a 400 for the password or a 409 for the email…

Yes, that can be fixed. Thanks for reporting this.


Alright fix is in: