How to upload a file via API and get it's URL?

Hello, I want to upload a file(not an image) via the API and get the URL back. How can I accomplish this?
I tried the solution provided here: https://meta.discourse.org/t/using-the-discourse-api-to-post-with-uploaded-files/29833/23 but it seems that it is no longer up to date.

See Reverse engineer the Discourse API

이 질문에도 관심이 있습니다.
API를 통해 파일 업로드를 지원하지 않는 것 같습니다.
누군가 방법을 제안해 주실 수 있을까요?

UPD:
해결했습니다. 문서에 해당 방법이 설명되어 있으며 정상적으로 작동합니다.

  1. "/uploads.json"을 사용하여 파일을 업로드합니다. 응답으로 업로드된 파일의 Short URL을 받게 되며, 예: “upload://ueNyWDEgHhXIuIdB472fy9T6.txt”
  2. 두 번째 API 요청으로 게시물을 업데이트합니다. post[raw]의 맨 끝에 다음과 같은 줄을 추가합니다:
    [filename.txt|attachment](upload://ueNyWlEgHhXIuIdB472fy9T6.txt) (1.83 KB)