### Server Bundles Information Example Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Example output for server bundles, showing bundle names, creation dates, installer versions, addon information, and dependency packages. ```json { "bundles": [ { "name": "my_bundle", "createdAt": "2023-06-12T15:37:02.420260", "installerVersion": "1.0.0", "addons": { "core": "1.2.3" }, "dependencyPackages": { "windows": "a_windows_package123.zip", "linux": "a_linux_package123.zip", "darwin": "a_mac_package123.zip" }, "isProduction": False, "isStaging": False } ], "productionBundle": "my_bundle", "stagingBundle": "test_bundle" } ``` -------------------------------- ### Installer Functions Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Functions for retrieving installer information. ```APIDOC ## Installer Functions Functions for retrieving installer information. ### Functions * `get_installers()` ``` -------------------------------- ### Bundle Settings Example Output Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Example output structure for bundle settings, including addon configurations and site-specific settings. ```json { "addons": [ { "name": "addon-name", "version": "addon-version", "settings": {...}, "siteSettings": {...} } ] } ``` -------------------------------- ### Installer Management Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Functions for creating, downloading, and deleting installers. ```APIDOC ## Installer Management ### Description APIs for managing software installers, including creation, download, and deletion. ### Methods - `create_installer(project_name: str, installer_name: str, version: str, files: list[dict])`: Creates a new installer package. - `delete_installer(installer_id: str)`: Deletes an installer. - `download_installer(installer_id: str, destination_path: str)`: Downloads an installer to a specified path. ``` -------------------------------- ### Get Server Bundles Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Retrieves information about available server bundles, including production and staging bundle names. The response contains details about each bundle's creation date, installer version, addons, and dependency packages. ```python from ayon_api import get_bundles get_bundles() ``` -------------------------------- ### Installer Operations Source: https://docs.ayon.dev/ayon-python-api/modules.html Operations for creating, downloading, and managing installers. ```APIDOC ## Installer Operations ### Description Provides functions for creating, downloading, and managing installers. ### Methods - `create_installer(installer_data)`: Creates a new installer. - `delete_installer(installer_id)`: Deletes an installer. - `download_installer(installer_id)`: Downloads an installer. - `get_installers()`: Retrieves a list of available installers. ``` -------------------------------- ### create_installer Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Creates metadata for a new installer on the server. This function should be used in conjunction with `upload_installer` to fully register an installer. ```APIDOC ## create_installer ### Description Creates metadata for a new installer on the server. This function should be used in conjunction with `upload_installer` to fully register an installer. ### Method POST (assumed based on creating a resource) ### Endpoint /api/installers ### Parameters #### Request Body - **filename** (str) - Required - Installer filename. - **version** (str) - Required - Version of installer. - **python_version** (str) - Required - Version of Python. - **platform_name** (str) - Required - Name of platform. - **python_modules** (dict[str, str]) - Required - Python modules that are available in installer. - **runtime_python_modules** (dict[str, str]) - Required - Runtime python modules that are available in installer. - **checksum** (str) - Required - Installer file checksum. - **checksum_algorithm** (str) - Required - Type of checksum used to create checksum. - **file_size** (int) - Required - File size. - **sources** (list[dict[str, Any]]) - Optional - List of sources that can be used to download file. ### Response #### Success Response (200) - (No specific response body detailed, likely returns success status or None) ### Error Handling - (Specific error handling not detailed in source) ``` -------------------------------- ### create_installer Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Creates metadata for a new installer on the server. This function only creates the information; the actual installer file must be uploaded separately using the 'upload_installer' method. It details the installer's filename, version, Python version, platform, required Python modules (both for general use and runtime), checksum, and file size. Optional sources for downloading the file can also be provided. ```APIDOC ## create_installer ### Description Create new installer information on server. This step will create only metadata. Make sure to upload installer to the server using ‘upload_installer’ method. Runtime python modules are modules that are required to run AYON desktop application, but are not added to PYTHONPATH for any subprocess. ### Parameters * **filename** (`str`) – Installer filename. * **version** (`str`) – Version of installer. * **python_version** (`str`) – Version of Python. * **platform_name** (`str`) – Name of platform. * **python_modules** (`dict[str, str]`) – Python modules that are available in installer. * **runtime_python_modules** (`dict[str, str]`) – Runtime python modules that are available in installer. * **checksum** (`str`) – Installer file checksum. * **checksum_algorithm** (`str`) – Type of checksum used to create checksum. * **file_size** (`int`) – File size. * **sources** (`Optional[list[dict[str, Any]]]`) – List of sources that can be used to download file. ``` -------------------------------- ### get_started() Source: https://docs.ayon.dev/ayon-python-api/ayon_api.utils.html Checks if a transfer has been started. ```APIDOC ## get_started() ### Description Checks if a transfer has been started. ### Returns - **bool**: True if transfer started. ``` -------------------------------- ### Installer and Addon Management Source: https://docs.ayon.dev/ayon-python-api/ayon_api.exceptions.html Functions for uploading and updating installers and dependency packages. ```APIDOC ## Installer and Addon Management ### Description Upload and manage installers, addon zip files, and dependency packages. ### Functions - `update_installer()` - `upload_addon_zip()` - `upload_dependency_package()` - `upload_installer()` ``` -------------------------------- ### Install AYON Python API from GitHub Sources Source: https://docs.ayon.dev/ayon-python-api/index.html Alternatively, clone the repository from GitHub and install the API locally. This is useful for development or when needing the latest unreleased features. ```bash git clone git@github.com:ynput/ayon-python-api.git cd ayon-python-api pip install . ``` -------------------------------- ### File and Installer Management Source: https://docs.ayon.dev/ayon-python-api/index.html Functions for downloading and managing project files and installers. ```APIDOC ## download_file(project_id: str, file_id: str) ### Description Downloads a file associated with a project. ### Method GET ### Endpoint /api/v1/projects/{project_id}/files/{file_id}/download ### Parameters #### Path Parameters - **project_id** (str) - Required - The ID of the project. - **file_id** (str) - Required - The ID of the file to download. ### Response #### Success Response (200) - **file_content** (binary) - The content of the downloaded file. ``` ```APIDOC ## download_file_to_stream(project_id: str, file_id: str) ### Description Downloads a file associated with a project as a stream. ### Method GET ### Endpoint /api/v1/projects/{project_id}/files/{file_id}/download_stream ### Parameters #### Path Parameters - **project_id** (str) - Required - The ID of the project. - **file_id** (str) - Required - The ID of the file to download. ### Response #### Success Response (200) - **stream** (stream) - A stream of the file content. ``` ```APIDOC ## download_installer(project_id: str, installer_id: str) ### Description Downloads an installer package for a project. ### Method GET ### Endpoint /api/v1/projects/{project_id}/installers/{installer_id}/download ### Parameters #### Path Parameters - **project_id** (str) - Required - The ID of the project. - **installer_id** (str) - Required - The ID of the installer to download. ### Response #### Success Response (200) - **installer_content** (binary) - The content of the installer package. ``` ```APIDOC ## download_project_file(project_id: str, file_path: str) ### Description Downloads a project file using its path. ### Method GET ### Endpoint /api/v1/projects/{project_id}/files/download_by_path ### Parameters #### Path Parameters - **project_id** (str) - Required - The ID of the project. #### Query Parameters - **path** (str) - Required - The path to the file within the project. ### Response #### Success Response (200) - **file_content** (binary) - The content of the downloaded file. ``` ```APIDOC ## download_project_file_to_stream(project_id: str, file_path: str) ### Description Downloads a project file as a stream using its path. ### Method GET ### Endpoint /api/v1/projects/{project_id}/files/download_stream_by_path ### Parameters #### Path Parameters - **project_id** (str) - Required - The ID of the project. #### Query Parameters - **path** (str) - Required - The path to the file within the project. ### Response #### Success Response (200) - **stream** (stream) - A stream of the file content. ``` -------------------------------- ### download_installer Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Downloads an installer file from the Ayon server. ```APIDOC ## download_installer ### Description Download installer file from server. ### Method (Not specified, assumed to be a Python function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **filename** (`str`) - Name of the installer file to download. * **dst_filepath** (`str`) - The local path where the installer file will be saved. * **chunk_size** (`Optional[int]`) - Size of chunks that are received in single loop. * **progress** (`Optional[TransferProgress]`) - Object that gives ability to track download progress. ### Returns TransferProgress object. ### Return type `TransferProgress` ``` -------------------------------- ### Installer and Bundle Operations Source: https://docs.ayon.dev/ayon-python-api/ayon_api.graphql.html Functions for updating bundles and installers. ```APIDOC ## Installer and Bundle Operations Manage installers and update bundles. ### Functions - `update_bundle()` - `update_installer()` - `upload_installer()` ``` -------------------------------- ### Install AYON Python API from PyPI Source: https://docs.ayon.dev/ayon-python-api/index.html Use this command to install the latest stable version of the AYON Python API from the Python Package Index. ```bash pip install ayon-python-api ``` -------------------------------- ### get_installers Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Fetches information about desktop application installers available on the server. This can be filtered by version and platform name to find specific installer details. ```APIDOC ## get_installers ### Description Fetches information about desktop application installers available on the server. This can be filtered by version and platform name to find specific installer details. ### Method GET (assumed based on retrieving information) ### Endpoint /api/installers ### Parameters #### Query Parameters - **version** (str) - Optional - Filter installers by version. - **platform_name** (str) - Optional - Filter installers by platform name. ### Response #### Success Response (200) - **InstallersInfoDict** - Information about installers known for the server. ### Error Handling - (Specific error handling not detailed in source) ``` -------------------------------- ### set_started() Source: https://docs.ayon.dev/ayon-python-api/ayon_api.utils.html Marks that the transfer has started. ```APIDOC ## set_started() ### Description Marks that transfer started. ### Raises - **ValueError**: If transfer was already started. ``` -------------------------------- ### _started (property) Source: https://docs.ayon.dev/ayon-python-api/ayon_api.utils.html Checks if the transfer was started. ```APIDOC ## _started (property) ### Description Checks if transfer was started. ### Returns - **bool**: True if transfer started. ``` -------------------------------- ### Get Server Configuration Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Retrieves the current server configuration settings. ```python from ayon_api import get_server_config config = get_server_config() ``` -------------------------------- ### Get Project Anatomy Presets Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Retrieves a list of available anatomy presets on the server, including their names, primary status, and versions. Provides an example of the expected output structure. ```python def get_project_anatomy_presets() -> list[AnatomyPresetDict]: """Anatomy presets available on server. Content has basic information about presets. Example output:: [ { "name": "netflix_VFX", "primary": false, "version": "1.0.0" }, { ... }, ... ] Returns: list[dict[str, str]]: Anatomy presets available on server. """ con = get_server_api_connection() return con.get_project_anatomy_presets() ``` -------------------------------- ### Mark Transfer as Started Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/utils.html Marks the transfer as started and sets the attempt counter to 1. Raises ValueError if the transfer was already started. ```python def set_started(self) -> None: """Mark that transfer started. Raises: ValueError: If transfer was already started. """ if self._started: raise ValueError("Progress already started") self._started = True self._attempt = 1 ``` -------------------------------- ### Create Ayon Bundle Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Creates a new bundle on the server with specified addon versions, installer version, and dependency packages. Supports configuration for production, staging, or development bundles, including custom addon configurations for development bundles. ```python def create_bundle( name: str, addon_versions: dict[str, str], installer_version: Union[str, None] = None, dependency_packages: Optional[dict[str, str]] = None, is_production: Optional[bool] = None, is_staging: Optional[bool] = None, is_dev: Optional[bool] = None, dev_active_user: Optional[str] = None, dev_addons_config: Optional[dict[str, Any]] = None, ) -> None: """Create bundle on server. Bundle cannot be changed once is created. Only isProduction, isStaging and dependency packages can change after creation. In case dev bundle is created, it is possible to change anything, but it is not possible to mark bundle as dev and production or staging at the same time. Development addon config can define custom path to client code. It is used only for dev bundles. Example of 'dev_addons_config':: ```json { "core": { "enabled": true, "path": "/path/to/ayon-core/client" } } ``` Args: name (str): Name of bundle. addon_versions (dict[str, str]): Addon versions. installer_version (Union[str, None]): Installer version. dependency_packages (Optional[dict[str, str]]): Dependency package names. Keys are platform names and values are name of packages. is_production (Optional[bool]): Bundle will be marked as production. is_staging (Optional[bool]): Bundle will be marked as staging. is_dev (Optional[bool]): Bundle will be marked as dev. dev_active_user (Optional[str]): Username that will be assigned to dev bundle. Can be used only if 'is_dev' is set to 'True'. dev_addons_config (Optional[dict[str, Any]]): Configuration for dev addons. Can be used only if 'is_dev' is set to 'True'. """ con = get_server_api_connection() return con.create_bundle( name=name, addon_versions=addon_versions, installer_version=installer_version, dependency_packages=dependency_packages, is_production=is_production, is_staging=is_staging, is_dev=is_dev, dev_active_user=dev_active_user, dev_addons_config=dev_addons_config, ) ``` -------------------------------- ### Create Product Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Creates a new product entity on the server. Requires project name, product name, and product type. Optional parameters include folder ID, attributes, data, tags, status, active state, and product base type. ```python con = get_server_api_connection() return con.create_product( project_name=project_name, name=name, product_type=product_type, folder_id=folder_id, attrib=attrib, data=data, tags=tags, status=status, active=active, product_base_type=product_base_type, product_id=product_id, ) ``` -------------------------------- ### get Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Performs a GET request to a specified entrypoint. ```APIDOC ## get ### Description Performs a GET request to a specified entrypoint. ### Parameters #### Path Parameters - **entrypoint** (str) - Required - The API entrypoint. - **kwargs** - Additional keyword arguments to pass to the request. ``` -------------------------------- ### upload_installer Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Uploads an installer file from a local source filepath to the server. Progress can be tracked during the upload. ```APIDOC ## upload_installer ### Description Uploads an installer file from a local source filepath to the server. Progress can be tracked during the upload. ### Method POST ### Endpoint /api/installers/{dst_filename}/upload ### Parameters #### Path Parameters - **dst_filename** (str) - Required - The desired filename for the installer on the server. #### Query Parameters - **progress** (TransferProgress) - Optional - An object that provides the ability to track the upload progress. #### Request Body - **src_filepath** (str) - Required - The local filepath of the installer file to upload. ### Request Example ```json { "src_filepath": "/path/to/local/installer.zip" } ``` ### Response #### Success Response (200) - **response** (requests.Response) - The response object from the requests library, indicating the status of the upload. #### Response Example ```json { "status_code": 200, "reason": "OK" } ``` ``` -------------------------------- ### Raw Get Function Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Function for performing raw GET requests. ```APIDOC ## Raw Get Function Function for performing raw GET requests. ### Functions * `raw_get()` ``` -------------------------------- ### download_installer Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Downloads an installer file from the server to a specified local filepath. Supports chunked downloads and progress tracking. ```APIDOC ## download_installer ### Description Downloads an installer file from the server to a specified local filepath. Supports chunked downloads and progress tracking. ### Method GET ### Endpoint /api/installers/{filename}/download ### Parameters #### Path Parameters - **filename** (str) - Required - The name of the installer file to download. #### Query Parameters - **chunk_size** (int) - Optional - The size of chunks to download the file in. ### Response #### Success Response (200) - **file_content** (bytes) - The content of the installer file. - **progress** (TransferProgress) - An object that provides progress information about the download. #### Response Example ```json { "file_content": "...binary content...", "progress": { "total_size": 102400, "downloaded_size": 102400 } } ``` ``` -------------------------------- ### create_product Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Create a new product within a specified project and folder. ```APIDOC ## create_product ### Description Create new product. ### Method POST (conceptual) ### Endpoint (Not explicitly defined, assumed to be internal API call) ### Parameters #### Path Parameters - **project_name** (str) - Required - Project name. - **name** (str) - Required - Product name. - **product_type** (str) - Required - Product type. - **folder_id** (str) - Required - Parent folder id. #### Request Body - **attrib** (Optional[dict[str, Any]]) - Optional - Product attributes. - **data** (Optional[dict[str, Any]]) - Optional - Product data. - **tags** (Optional[Iterable[str]]) - Optional - Product tags. - **status** (Optional[str]) - Optional - Product status. - **active** (Optional[bool]) - Optional - Product active state. - **product_base_type** (Optional[str]) - Optional - Product base type. - **product_id** (Optional[str]) - Optional - Product id. If not passed new id is generated. ### Response #### Success Response (200) - **str** - Product id. #### Response Example (Not provided in source) ``` -------------------------------- ### GET Request Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/server_api.html Sends a GET request with query parameters to a specified server endpoint. ```APIDOC ## get ### Description Sends a GET request to a specified Ayon server endpoint, passing the provided keyword arguments as query parameters. ### Method GET ### Endpoint [entrypoint] ### Parameters #### Path Parameters None #### Query Parameters - **kwargs** - Key-value pairs that will be sent as query parameters in the URL. ### Request Example ```python server_api.get("your/endpoint", param1="value1", param2="value2") ``` ### Response Returns the response from the server. ``` -------------------------------- ### Create Bundle Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Creates a new bundle on the Ayon server. Requires a name, addon versions, and installer version. Optional parameters allow specifying dependency packages and production/staging/dev status. ```python from ayon_api import create_bundle create_bundle( name="my_bundle", addon_versions={ "core": "1.2.3", "my_addon": "0.1.0" }, installer_version="1.0.0", is_production=True, ) ``` -------------------------------- ### Initialize VersionEntity Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/entity_hub.html Initializes a VersionEntity instance with version details, product and task IDs, status, tags, attributes, data, thumbnail, and active status. ```python def __init__( self, version: int, product_id: Union[str, None, _CustomNone] = UNKNOWN_VALUE, task_id: Union[str, None, _CustomNone] = UNKNOWN_VALUE, status: Union[str, _CustomNone] = UNKNOWN_VALUE, tags: Optional[Iterable[str]] = None, attribs: Optional[dict[str, Any]] = None, data: Union[dict[str, Any], None, _CustomNone] = UNKNOWN_VALUE, thumbnail_id: Union[str, None, _CustomNone] = UNKNOWN_VALUE, active: Union[bool, _CustomNone] = UNKNOWN_VALUE, entity_id: Optional[str] = None, created: Optional[bool] = None, entity_hub: EntityHub = None, ) -> None: super().__init__( parent_id=product_id, status=status, tags=tags, attribs=attribs, data=data, thumbnail_id=thumbnail_id, active=active, entity_id=entity_id, created=created, entity_hub=entity_hub, ) self._version = version self._task_id = task_id self._orig_version = version self._orig_task_id = task_id ``` -------------------------------- ### Raw GET Request Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/server_api.html Executes a raw GET request to a specified server endpoint. ```APIDOC ## raw_get ### Description Sends a raw HTTP GET request to a specified Ayon server endpoint. This method is a low-level interface for making GET requests. ### Method GET ### Endpoint [entrypoint] ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **entrypoint** (str) - Required - The specific API endpoint to send the GET request to. - **kwargs** - Additional keyword arguments to be passed to the underlying request, such as `params`. ### Request Example ```python server_api.raw_get("your/endpoint", params={"query": "value"}) ``` ### Response Returns the raw response object from the server. ``` -------------------------------- ### GET Request Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Performs a GET request to a specified API entrypoint with additional keyword arguments. ```python from ayon_api import get response = get("/api/v1/some_endpoint", params={'query': 'test'}) ``` -------------------------------- ### Attribute Schema Example Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Example structure for an attribute schema, detailing common fields and type-specific options. ```json { "type": "integer", "title": "Clip Out", "description": null, "example": 1, "default": 1, "gt": null, "ge": null, "lt": null, "le": null, "minLength": null, "maxLength": null, "minItems": null, "maxItems": null, "regex": null, "enum": null } ``` -------------------------------- ### Download Server Configuration File Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/server_api.html Downloads a server configuration file (e.g., login background, studio logo) to a specified filepath. It validates if the file exists on the server first. ```python return self.download_file( f"api/config/files/{file_type}", filepath, chunk_size=chunk_size, progress=progress, ) ``` -------------------------------- ### create_project Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Create project using AYON settings. ```APIDOC ## POST /api/projects ### Description Create project using AYON settings. ### Method POST ### Endpoint /api/projects ### Request Body - **projectName** (str) - Required - Name of project. - **projectCode** (str) - Required - Project code. - **library_project** (bool) - Optional - Whether the project is a library project. Defaults to False. - **preset_name** (Optional[str]) - Optional - Name of the preset to use for project creation. - **data** (dict[str, Any] | None) - Optional - Additional data for the project. - **skeleton** (bool) - Optional - Whether to create the project as a skeleton. Defaults to False. ### Response #### Success Response (200) - **ProjectDict** - The created project entity. ``` -------------------------------- ### Raw GET Request Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Performs a raw GET request to a specified API entrypoint with additional keyword arguments. ```python from ayon_api import raw_get response = raw_get("/api/v1/some_endpoint", params={'query': 'test'}) ``` -------------------------------- ### AttributeValue Get and Set Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/entity_hub.html Provides methods to get and set the current value of an AttributeValue, aliased by the 'value' property. ```python def get_value(self) -> AttributeValueType: return self._value ``` ```python def set_value(self, value: AttributeValueType) -> None: self._value = value ``` ```python value = property(get_value, set_value) ``` -------------------------------- ### Create Project Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Creates a new project using AYON settings. Allows specifying project name, code, library status, preset, custom data, and skeleton status. ```python def create_project( project_name: str, project_code: str, library_project: bool = False, preset_name: Optional[str] = None, data: dict[str, Any] | None = None, skeleton: bool = False, ) -> ProjectDict: """Create project using AYON settings. ``` -------------------------------- ### update_installer Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Updates an existing installer file on the server with new source information. This function replaces all existing sources for the specified installer. ```APIDOC ## update_installer ### Description Updates an existing installer file on the server with new source information. This function replaces all existing sources for the specified installer. ### Method POST ### Endpoint /api/installers/{filename} ### Parameters #### Path Parameters - **filename** (str) - Required - The name of the installer file to update. #### Request Body - **sources** (list[dict[str, Any]]) - Required - A list of dictionaries, where each dictionary contains information about a source for the installer file. This list fully replaces the existing sources. ### Request Example ```json { "sources": [ { "url": "http://example.com/path/to/installer.zip", "type": "url" } ] } ``` ### Response #### Success Response (200) - **message** (str) - Indicates that the installer was updated successfully. #### Response Example ```json { "message": "Installer updated successfully." } ``` ``` -------------------------------- ### Create and Get Server API Connection Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Demonstrates how to create a new server API connection or retrieve an existing one. Ensures a connection is established before returning it. ```python cls._connection = GlobalServerAPI(*args, **kwargs) return cls._connection ``` ```python if cls._connection is None: cls.create_connection() return cls._connection ``` -------------------------------- ### Example Dependency Package Data Structure Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Illustrates the expected data structure for dependency packages returned by the API. ```json { "packages": [ { "filename": str, "platform": str, "checksum": str, "checksumAlgorithm": str, "size": int, "sources": list[dict[str, Any]], "supportedAddons": dict[str, str], "pythonModules": dict[str, str] } ] } ``` -------------------------------- ### Get User (REST) Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Retrieves user information using a REST endpoint. Useful for getting the currently authenticated user if username is omitted. ```python from ayon_api import get_user user_data = get_user("testuser") # or get current user # current_user = get_user() ``` -------------------------------- ### Verify AYON Python API Installation Source: https://docs.ayon.dev/ayon-python-api/index.html Run this Python command to confirm that the AYON Python API has been installed correctly by printing its version number. ```python python -c "import ayon_api ; print(ayon_api.__version__)" ``` -------------------------------- ### Get All Addons Studio Settings Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Retrieves settings for all addons within a bundle, optionally including site-specific overrides. Useful for bulk configuration retrieval. ```python from ayon_api.settings import get_addons_studio_settings get_addons_studio_settings( bundle_name="my_bundle", project_bundle_name="my_project_bundle", variant="production", site_id="site_a", use_site=True, only_values=True, ) ``` -------------------------------- ### Performing Raw GET Request Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/server_api.html Executes a raw HTTP GET request to a specified server entrypoint. This method is used for retrieving data from the server. ```python def raw_get(self, entrypoint: str, **kwargs): url = self._endpoint_to_url(entrypoint) self.log.debug(f"Executing [GET] {url}") return self._do_rest_request( RequestTypes.get, url, **kwargs ) ``` -------------------------------- ### Download Server Config File Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Downloads a server configuration file, such as a studio logo or login background. Validates file existence first. ```python from ayon_api import download_server_config_file # Download studio logo download_server_config_file( file_type="studio_logo", filepath="/path/to/save/logo.png" ) # Download login background download_server_config_file( file_type="login_background", filepath="/path/to/save/background.jpg" ) ``` -------------------------------- ### Create Project Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Creates a new project on the server. Requires a unique project name and code. Optional parameters allow for specifying library status, anatomy preset, initial data, and skeleton status. ```python from ayon_api.utils import get_server_api_connection def create_project( project_name: str, project_code: str, library_project: Optional[bool] = None, preset_name: Optional[str] = None, data: dict[str, Any] | None = None, skeleton: bool = False, ) -> ProjectDict: """Create project entity on server. This project creation function is not validating project entity on creation. It is because project entity is created blindly with only minimum required information about project which is name and code. Entered project name must be unique and project must not exist yet. Note: This function is here to be OP v4 ready but in v3 has more logic to do. That's why inner imports are in the body. Args: project_name (str): New project name. Should be unique. project_code (str): Project's code should be unique too. library_project (Optional[bool]): Project is library project. preset_name (Optional[str]): Name of anatomy preset. Default is used if not passed. data (dict[str, Any]): Project data. skeleton (bool): Project is skeleton project. Raises: ValueError: When project name already exists. Returns: ProjectDict: Created project entity. """ con = get_server_api_connection() return con.create_project( project_name=project_name, project_code=project_code, library_project=library_project, preset_name=preset_name, data=data, skeleton=skeleton, ) ``` -------------------------------- ### Convenience GET Request Method Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/server_api.html A convenience method for performing GET requests, automatically passing keyword arguments as URL query parameters. It simplifies fetching data with query parameters. ```python def get(self, entrypoint: str, **kwargs): return self.raw_get(entrypoint, params=kwargs) ``` -------------------------------- ### Initialize Service Context Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Initializes the service context using provided arguments or environment variables. Raises an error if the server URL or token is not set. ```python token = token or os.environ.get("AYON_API_KEY") server_url = server_url or os.environ.get("AYON_SERVER_URL") if not server_url: raise FailedServiceInit("URL to server is not set") if not token: raise FailedServiceInit( "Token to server {} is not set".format(server_url) ) addon_name = addon_name or os.environ.get("AYON_ADDON_NAME") addon_version = addon_version or os.environ.get("AYON_ADDON_VERSION") service_name = service_name or os.environ.get("AYON_SERVICE_NAME") cls.token = token cls.server_url = server_url cls.addon_name = addon_name cls.addon_version = addon_version cls.service_name = service_name or socket.gethostname() # Make sure required environments for GlobalServerAPI are set GlobalServerAPI.set_environments(cls.server_url, cls.token) if connect: print("Connecting to server \"{}\".format(server_url)) con = GlobalContext.get_server_api_connection() user = con.get_user() print("Logged in as user \"{}\".format(user["name"])) ``` -------------------------------- ### Get Addon Settings Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Fetches general addon settings, which can include studio-wide settings if no project is specified. Site overrides can be applied. ```python from ayon_api.settings import get_addon_settings get_addon_settings( addon_name="my_addon", addon_version="1.0.0", project_name="my_project", variant="production", site_id="site_a", use_site=True, ) ``` -------------------------------- ### get_projects Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Get projects. ```APIDOC ## GET /api/projects ### Description Get projects. ### Method GET ### Endpoint /api/projects ### Query Parameters - **active** (Optional[bool]) - Optional - Filter active or inactive projects. Filter is disabled when 'None' is passed. - **library** (Optional[bool]) - Optional - Filter library projects. Filter is disabled when 'None' is passed. - **include_skeleton** (bool) - Optional - Include skeleton projects. - **fields** (Optional[Iterable[str]]) - Optional - fields to be queried for project. - **own_attributes** (Optional[bool]) - Optional - Attribute values that are not explicitly set on entity will have 'None' value. ### Response #### Success Response (200) - **Generator[ProjectDict, None, None]** - Queried projects. ``` -------------------------------- ### FolderEntity Initialization Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/entity_hub.html Initializes a FolderEntity instance. Autofills the project name as the parent if the folder was just created and no parent is set. ```python def __init__( self, name: str, folder_type: str, parent_id: Union[str, None, _CustomNone] = UNKNOWN_VALUE, label: Optional[str] = None, path: Optional[str] = None, status: Union[str, _CustomNone] = UNKNOWN_VALUE, tags: Optional[Iterable[str]] = None, attribs: Optional[dict[str, Any]] = None, data: Union[dict[str, Any], _CustomNone] = UNKNOWN_VALUE, thumbnail_id: Union[str, None, _CustomNone] = UNKNOWN_VALUE, active: Union[bool, _CustomNone] = UNKNOWN_VALUE, entity_id: Optional[str] = None, created: Optional[bool] = None, entity_hub: EntityHub = None, ) -> None: super().__init__( entity_id=entity_id, parent_id=parent_id, attribs=attribs, data=data, active=active, created=created, entity_hub=entity_hub, name=name, label=label, tags=tags, status=status, thumbnail_id=thumbnail_id, ) # Autofill project as parent of folder if is not yet set # - this can be guessed only if folder was just created if self.created and self._parent_id is UNKNOWN_VALUE: self._parent_id = self.project_name self._folder_type = folder_type self._orig_folder_type = folder_type # Know if folder has any products # - is used to know if folder allows hierarchy changes self._has_published_content = False self._path = path ``` -------------------------------- ### create_product Source: https://docs.ayon.dev/ayon-python-api/ayon_api.operations.html Creates a new product within a specified folder. Products represent assets or deliverables. ```APIDOC ## create_product ### Description Create new product. ### Parameters * **project_name** (`str`) – Project name. * **name** (`str`) – Product name. * **folder_id** (`str`) – Parent folder id. * **attrib** (`Optional[dict[str, Any]]`) – Product attributes. * **data** (`Optional[dict[str, Any]]`) – Product data. * **tags** (`Optional[Iterable[str]]`) – Product tags. * **status** (`Optional[str]`) – Product status. * **active** (`Optional[bool]`) – Product active state. * **product_base_type** (`Optional[str]`) – Product base type. * **product_id** (`Optional[str]`) – Product id. If not passed new id is generated. ### Returns Object of create operation. ### Return type CreateOperation ``` -------------------------------- ### create_bundle Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/_api.html Create bundle on server. ```APIDOC ## create_bundle ### Description Create bundle on server. ### Method POST ### Endpoint /api/bundles ### Parameters #### Request Body - **name** (str) - Required - The name of the bundle. - **addon_versions** (dict[str, str]) - Required - Dictionary of addon names and their versions. - **installer_version** (str) - Required - The version of the installer. - **dependency_packages** (Optional[dict[str, str]]) - Optional - Dictionary of OS names and their corresponding package zip files. - **is_production** (Optional[bool]) - Optional - Whether this bundle is for production. - **is_staging** (Optional[bool]) - Optional - Whether this bundle is for staging. - **is_dev** (Optional[bool]) - Optional - Whether this bundle is for development. - **dev_active_user** (Optional[str]) - Optional - The active user for development bundles. - **dev_addons_config** (Optional[dict[str, DevBundleAddonInfoDict]]) - Optional - Configuration for development addons. ### Response #### Success Response (200) - **message** (str) - Confirmation message indicating the bundle was created successfully. ### Response Example ```json { "message": "Bundle 'my_new_bundle' created successfully." } ``` ``` -------------------------------- ### Validate URL with Example Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/utils.html Validates a server URL, checking if it's parsable and has a scheme. It attempts to auto-fix the URL and returns the validated version if a connection is successful. Includes an example of how to use it within a try-except block. ```python my_url = "my.server.url" try: # Store new url validated_url = validate_url(my_url) except UrlError: # Handle invalid url ... ``` -------------------------------- ### Create Product in Ayon Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/operations.html Use this function to create a new product entity. If product_id is not provided, a new one will be generated. Raises UnsupportedServerVersion if product base type is not supported. ```python def create_product( self, project_name: str, name: str, product_type: str, folder_id: str, attrib: Optional[dict[str, Any]] = None, data: Optional[dict[str, Any]] = None, tags: Optional[list[str]] = None, status: Optional[str] = None, active: Optional[bool] = None, product_base_type: Optional[str] = None, product_id: Optional[str] = None, ) -> CreateOperation: """Create new product. Args: project_name (str): Project name. name (str): Product name. folder_id (str): Parent folder id. attrib (Optional[dict[str, Any]]): Product attributes. data (Optional[dict[str, Any]]): Product data. tags (Optional[Iterable[str]]): Product tags. status (Optional[str]): Product status. active (Optional[bool]): Product active state. product_base_type (Optional[str]): Product base type. product_id (Optional[str]): Product id. If not passed new id is generated. Returns: CreateOperation: Object of create operation. """ if not product_id: product_id = create_entity_id() create_data = { "id": product_id, "name": name, "productType": product_type, "folderId": folder_id, } if ( product_base_type and not self._con.is_product_base_type_supported() ): raise UnsupportedServerVersion( "Product base type is not supported for your server version." ) for key, value in ( ("attrib", attrib), ("data", data), ("tags", tags), ("status", status), ("active", active), ("productBaseType", product_base_type) ): if value is not None: create_data[key] = value return self.create_entity( project_name, "product", create_data ) ``` -------------------------------- ### next_attempt() Source: https://docs.ayon.dev/ayon-python-api/ayon_api.utils.html Starts a new attempt for the progress. ```APIDOC ## next_attempt() ### Description Starts a new attempt of progress. ``` -------------------------------- ### Get URL Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Retrieves the server URL. ```APIDOC ## get_rest_url ### Description Get server URL. ``` -------------------------------- ### init_service Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Initializes the current connection from the service. ```APIDOC ## init_service ### Description Initialize current connection from service. The service expect specific environment variables. The variables must all be set to make the connection work as a service. ### Parameters #### Path Parameters - **args** (*args) - **kwargs** (**kwargs) ### Returns None ``` -------------------------------- ### Get Name Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/entity_hub.html Retrieves the name of the status. ```APIDOC ## get_name ### Description Status name. ### Method `get_name() -> str` ### Parameters None ### Returns * str - Status name. ``` -------------------------------- ### Convert VersionEntity to creation body Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/entity_hub.html Prepares a dictionary representing the VersionEntity for creation. Raises ValueError if the 'product_id' is not set. ```python def to_create_body_data(self) -> dict[str, Any]: if self.parent_id is UNKNOWN_VALUE: raise ValueError("Version does not have set 'product_id'") ``` -------------------------------- ### get_default_settings_variant() Source: https://docs.ayon.dev/ayon-python-api/ayon_api.utils.html Gets the default settings variant. ```APIDOC ## get_default_settings_variant() ### Description Gets the default settings variant. ### Returns - **str**: Settings variant from environment variable or ‘production’. ``` -------------------------------- ### Get Addon Studio Settings Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Fetches all addon settings in a single bulk request. Behavior changed in AYON server version 0.3.0. ```python get_addons_studio_settings(_bundle_name : Optional[str] = None_, _project_bundle_name : Optional[str] = None_, _variant : Optional[str] = None_, _site_id : Optional[str] = None_, _use_site : bool = True_, _only_values : bool = True_) → dict[str, Any] ``` -------------------------------- ### Create Dev Bundle with Custom Addon Config Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Use this to create a development bundle with custom paths for client code in specific addons. This configuration is only applied to development bundles. ```json { "core": { "enabled": true, "path": "/path/to/ayon-core/client" } } ``` -------------------------------- ### Get All Secrets Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Retrieves a list of all available secrets. ```APIDOC ## get_secrets ### Description Get all secrets. Example output: ```json [ { "name": "secret_1", "value": "secret_value_1" }, { "name": "secret_2", "value": "secret_value_2" } ] ``` ### Returns list[SecretDict] - List of secret entities. ``` -------------------------------- ### Get Secret by Name Source: https://docs.ayon.dev/ayon-python-api/ayon_api.html Retrieves a secret by its name. ```APIDOC ## get_secret ### Description Get secret by name. Example output: ```json { "name": "secret_name", "value": "secret_value" } ``` ### Parameters * **secret_name** (`str`) - Required - Name of secret. ### Returns SecretDict - Secret entity data. ``` -------------------------------- ### add_product Source: https://docs.ayon.dev/ayon-python-api/_modules/ayon_api/entity_hub.html Creates a product entity and adds it to the entity hub. ```APIDOC ## add_product ### Description Creates a product entity and adds it to the entity hub. ### Method `add_product(product: ProductDict) -> ProductEntity` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **product** (ProductDict) - Required - Product entity data. ### Request Example ```json { "example": "product data" } ``` ### Response #### Success Response (200) - **ProductEntity**: The added product entity. #### Response Example ```json { "example": "ProductEntity object" } ``` ```