upload

Upload a local file into a folder; return the new asset id (string).

upload

Upload a local file into a folder; return the new asset id (string).

Upload a single local file into parent_id. Returns the asset id as a string.

Safety class: A · API type: admin · Min version:

📘

Confinement

parent_id must be under your run-root anchor.

Signatures

def upload(sdk, parent_id, file, name=None):
    """Upload `file` into `parent_id`; return the new asset id (str) or None."""
    return sdk.upload_asset(name, None, None, "replace", file, parent_id)
export async function upload(sdk, parentId, file, name = null) {
    // Args: (name, existingAssetId, relatedContentId, uploadOverwriteOption, file, parentId)
    // Use "replace" for a brand-new upload. Returns the new asset id as a string.
    return await sdk.uploadAsset(name, null, null, "replace", file, parentId);
}

Parameters

Parameter (Python)Parameter (JS)TypeRequiredNotes
sdksdkNomad_SDKyes
parent_idparentIdstryesdestination folder
filefilestryesfile path to upload
namenamestr | Nonenodisplay name; defaults to the file name

Returns

str | None — the new asset id as a STRING (not a dict); None on failure.Errors

  • 401 unauthenticated
  • 404 parent not found
  • raises on upload failure path

Notes

The positional args are (name, existing_asset_id, related_content_id, upload_overwrite_option, file, parent_id). Use "replace" for a brand-new upload. The return is a bare id string — do not index it.

See also: Python ↔ JS naming map · Return shapes.