Files Service

The Files Service lets you upload files so they can be referenced in Altium 365 API requests. The typical use case is uploading a file (such as a component library export) and then passing the returned file ID to an API mutation that accepts file input.

Uploading a File

Send a multipart/form-data POST request to the files endpoint with your access token in the Authorization header. The response body is the file ID.

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)

Pass file_id to the relevant API mutation as the file reference. See the API schema for which mutations accept file IDs.

  • File IDs are temporary. An uploaded file is available for 24 hours from the last time it was accessed. After that, the file must be re-uploaded.

  • Treat the file ID as opaque. Its format may change — do not parse or construct it.

Endpoints

The upload path is /File/Upload appended to the files service base URL. See Altium 365 API Endpoints for the full list of Workspace and regional base URLs.

如您发现任何问题,请选中相关文本/图片,并按 Ctrl + Enter 键向我们提交反馈。
Content