API returning user ID of -1 when uploading avatar

According to http://docs.discourse.org I believe you should afterwards send a
PUT /users/{username}/preferences/avatar/pick
with upload_id returned by this.