create_share

Create a share that exposes one or more (confined) assets via a shared link.

create_share

Create a share that exposes one or more (confined) assets via a shared link.

Create a share exposing confined assets. Delete it in teardown (global object).

Safety class: C · API type: portal · Min version:

📘

Confinement

Class C: a share is a GLOBAL object (not under the run-root folder). Only expose confined asset ids, and delete the share in teardown (cleanup registry).

Signatures

def create_share(sdk, name, shared_contents=None, shared_duration_in_hours=None, expiration_date=None):
    """Create a share over shared_contents; return the share dict (carries its id)."""
    return sdk.share(
        name=name,
        shared_contents=shared_contents,
        shared_duration_in_hours=shared_duration_in_hours,
        expiration_date=expiration_date,
    )
export async function createShare(sdk, name, sharedContents = null, sharedDurationInHours = null, expirationDate = null) {
    // Positional: (id, name, sharedContents, sharedDuration, sharedPermissions, sharedType,
    //              sharedStatus, sharedDurationInHours, sharedLink, ownerId, expirationDate, assetId, sharedUsers)
    return await sdk.share(null, name, sharedContents, null, null, null, null,
        sharedDurationInHours, null, null, expirationDate, null, null);
}

Parameters

Parameter (Python)Parameter (JS)TypeRequiredNotes
sdksdkNomad_SDKyes
namenamestryese.g. docs-ai share
shared_contentssharedContentslist[str] | Nonenocontent ids to expose
shared_duration_in_hourssharedDurationInHoursint | Nonenoe.g. 1
expiration_dateexpirationDatestr | Noneno

Returns

dict | None — the new share (carries its id); None on failure.

Errors

  • 401 unauthenticated
  • 404 content not found

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