Dịch vụ Tệp
Updated: May 21, 2026
Dịch vụ Files cho phép bạn tải tệp lên để có thể tham chiếu chúng trong các yêu cầu API của Altium 365. Trường hợp sử dụng điển hình là tải lên một tệp (chẳng hạn như bản xuất thư viện linh kiện) rồi truyền ID tệp được trả về vào một API mutation chấp nhận đầu vào là tệp.
Tải lên một tệp
Gửi một yêu cầu multipart/form-data POST đến endpoint files với access token của bạn trong Authorization header. Phần thân phản hồi là ID tệp.
curl:
curl --location 'https://{workspace-domain}/svc/napi/files/File/Upload' \
--header 'Authorization: Bearer {your-access-token}' \
--form 'file=@"components.zip"'
Python:
import requests
token = "your-access-token"
file_path = "components.zip"
with open(file_path, "rb") as f:
response = requests.post(
"https://{workspace-domain}/svc/napi/files/File/Upload",
files={"file": (file_path, f, "application/zip")},
headers={"Authorization": f"Bearer {token}"}
)
file_id = response.text
print(file_id)
Truyền file_id vào API mutation liên quan làm tham chiếu tệp. Xem lược đồ API để biết mutation nào chấp nhận ID tệp.
Endpoint
Đường dẫn tải lên là /File/Upload được nối vào URL cơ sở của dịch vụ files. Xem Altium 365 API Endpoints để biết danh sách đầy đủ các URL cơ sở theo Workspace và khu vực.