The discussion revolves around uploading an avatar image using the Discourse API. adam_beers initially encountered a 500 error while trying to upload an avatar image and sought help.
blake explained that uploading an avatar via API requires two requests: a POST to /uploads.json and a PUT to /users/{username}/preferences/avatar/pick. However, the upload_id is not returned in the response.
riking suggested that the upload_id can be obtained by connecting to the message bus and listening on /uploads. Alternatively, adding synchronous: true to the upload request can return the upload_id, as demonstrated by blake.
adam_beers eventually got the synchronous upload working with a non-staff member. riking clarified that the message bus method is available via API calls but requires a different approach.
In a separate inquiry, AntiMetaman asked about the possibility of sending a Discord auth token to Discourse to upload/download files. However, this question remains unanswered in the discussion.
I’m trying to upload an avatar image with the API as follows. I’m getting back a 500 error and I don’t see anything in the Error Logs on the server, via the Admin user.
I’ve attached a picture with the data from a Postman POST.
Of note is that I had this working at one time but then something changed and it stopped working. I’m not sure what changed, besides an update to Discourse and Docker.
How would I find the changelog around the upload API? This worked before I did an update of Discourse. The update was large, as it was about a year old.
Previously I did it this way:
POST to {base_url}/users/{username}/preferences/user_image?api_key={key}&api_username={username}
followed by
POST to {base_url}/users/{username}/preferences/avatar/pick?upload_id={id}api_key={key}&api_username={username}
The upload_id was returned by the first POST. This flow is not working anymore. Does anybody know what might have changed? Or how I can get it working again?
There is supposed to be a synchronous option with uploads API as well and I can’t get that to work either. The synchronous option was supposed to return the upload_id. At least that is what I gathered from other posts here.
I got that to work with a non-staff member. Not sure what I was doing wrong, but I had tried basically the same thing several times to no avail. One thing that I did different was I had some headers defined for “Accept” and “Content-Type”
어플리케이션이 Discord 인증 토큰을 Discourse에 전송하여 파일을 업로드/다운로드할 수 있는지 궁금합니다.
즉, 현재 사용자는 기본적으로 아바타 사진으로 최대 4096KB까지 업로드할 수 있습니다. 저는 이미 Discord OAuth를 설정하고 정상적으로 작동시키고 있습니다. 이 경우, 앱이 Discourse와 통신하여 동일한 요청(예: SSO를 통해?)을 보내 파일을 업로드하거나 다운로드할 수 있을까요?