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

**URL:** https://meta.discourse.org/t/how-to-upload-a-file-via-api-and-get-its-url/123732
**Category:** Development
**Tags:** rest-api
**Created:** [7월 23, 2019, 1:50오후 UTC](https://meta.discourse.org/t/how-to-upload-a-file-via-api-and-get-its-url/123732 "2019-07-23T13:50:39Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![Daniil\_Bazhenov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daniil_bazhenov/32/201247_2.png) [@Daniil\_Bazhenov](https://meta.discourse.org/u/Daniil_Bazhenov)
#### Post date: [1월 1, 2021, 5:33오후 UTC](https://meta.discourse.org/t/how-to-upload-a-file-via-api-and-get-its-url/123732/3 "2021-01-01T17:33:42Z")

</div>

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

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

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

---

_[View the full topic](https://meta.discourse.org/t/how-to-upload-a-file-via-api-and-get-its-url/123732)._
