### Install ONLYOFFICE DocSpace Python SDK Source: https://context7.com/onlyoffice/docspace-api-sdk-python/llms.txt Instructions for installing the ONLYOFFICE DocSpace Python SDK using pip from GitHub or via local setup. Requires Python 3.9+. ```bash pip install git+https://github.com/ONLYOFFICE/docspace-api-sdk-python.git python setup.py install --user ``` -------------------------------- ### GET /get_checkout_setup_url Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/PortalPaymentApi.md Retrieves the URL for the checkout setup page. This endpoint is useful for redirecting users to complete payment or subscription setup. ```APIDOC ## GET /get_checkout_setup_url ### Description Retrieves the URL for the checkout setup page. This endpoint is useful for redirecting users to complete payment or subscription setup. ### Method GET ### Endpoint /get_checkout_setup_url ### Parameters #### Query Parameters - **back_url** (str) - Optional - The URL where the user will be redirected after completing the setup. ### Request Example ```python import docspace_api_sdk from docspace_api_sdk.models.string_wrapper import StringWrapper from docspace_api_sdk.rest import ApiException from pprint import pprint configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # Configure Bearer authorization (JWT): Bearer configuration = docspace_api_sdk.Configuration( access_token = os.environ["BEARER_TOKEN"] ) with docspace_api_sdk.ApiClient(configuration) as api_client: api_instance = docspace_api_sdk.PaymentApi(api_client) back_url = 'some text' try: api_response = api_instance.get_checkout_setup_url(back_url=back_url) pprint(api_response) except ApiException as e: print("Exception when calling PaymentApi->get_checkout_setup_url: %s\n" % e) ``` ### Response #### Success Response (200) - **StringWrapper** (StringWrapper) - Contains the checkout setup URL. #### Response Example ```json { "example": "StringWrapper object with URL" } ``` ### Authorization [Basic](../README.md#Basic), [OAuth2](../README.md#OAuth2), [ApiKeyBearer](../README.md#ApiKeyBearer), [asc_auth_key](../README.md#asc_auth_key), [Bearer](../README.md#Bearer), [OpenId](../README.md#OpenId) ``` -------------------------------- ### SetupCode Model Usage (Python) Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/SetupCode.md Demonstrates how to instantiate and manipulate SetupCode objects using Python. It covers creating instances from JSON strings, converting them to dictionaries, and creating instances from dictionaries. This functionality is crucial for interacting with the API's setup code features. ```python from docspace_api_sdk.models.setup_code import SetupCode # TODO update the JSON string below json = "{}" # create an instance of SetupCode from a JSON string setup_code_instance = SetupCode.from_json(json) # print the JSON string representation of the object print(SetupCode.to_json()) # convert the object into a dict setup_code_dict = setup_code_instance.to_dict() # create an instance of SetupCode from a dict setup_code_from_dict = SetupCode.from_dict(setup_code_dict) ``` -------------------------------- ### GET /api/2.0/settings/webplugins Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/SettingsWebpluginsApi.md Retrieves a list of all available web plugins. This endpoint is useful for getting an overview of all installed plugins. ```APIDOC ## GET /api/2.0/settings/webplugins ### Description Get web plugins. ### Method GET ### Endpoint /api/2.0/settings/webplugins ### Parameters This endpoint does not have any parameters. ### Request Body This endpoint does not require a request body. ### Response #### Success Response (200) - **list** of **WebPluginWrapper** (array) - A list containing information about all web plugins. #### Response Example ```json [ { "id": "string", "name": "string", "version": "string", "url": "string", "iconUrl": "string", "title": "string", "description": "string", "permissions": [ "string" ], "isActive": true, "isSystem": true } ] ``` ### Error Handling - **400**: Bad request - **401**: Unauthorized - **403**: Plugins disabled ``` -------------------------------- ### StartEdit Model Usage - Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/StartEdit.md Demonstrates how to use the StartEdit model from the docspace_api_sdk.models.start_edit module. It shows instantiation from a JSON string, conversion to JSON string, conversion to a dictionary, and instantiation from a dictionary. Requires the docspace-api-sdk to be installed. ```python from docspace_api_sdk.models.start_edit import StartEdit # TODO update the JSON string below json = "{}" # create an instance of StartEdit from a JSON string start_edit_instance = StartEdit.from_json(json) # print the JSON string representation of the object print(StartEdit.to_json()) # convert the object into a dict start_edit_dict = start_edit_instance.to_dict() # create an instance of StartEdit from a dict start_edit_from_dict = StartEdit.from_dict(start_edit_dict) ``` -------------------------------- ### Get Checkout Setup URL - Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/PortalPaymentApi.md Retrieves the URL for the checkout setup page. This endpoint requires authentication and accepts an optional back_url parameter for redirection after setup. It returns a StringWrapper object containing the URL. ```python import docspace_api_sdk from docspace_api_sdk.models.string_wrapper import StringWrapper from docspace_api_sdk.rest import ApiException from pprint import pprint configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # Configure Bearer authorization (JWT): Bearer configuration = docspace_api_sdk.Configuration( access_token = os.environ["BEARER_TOKEN"] ) with docspace_api_sdk.ApiClient(configuration) as api_client: api_instance = docspace_api_sdk.PaymentApi(api_client) back_url = 'some text' # str | The URL where the user will be redirected after completing the setup. (optional) try: api_response = api_instance.get_checkout_setup_url(back_url=back_url) print("The response of PaymentApi->get_checkout_setup_url:\n") pprint(api_response) except Exception as e: print("Exception when calling PaymentApi->get_checkout_setup_url: %s\n" % e) ``` -------------------------------- ### Instantiate and Convert SetupCodeWrapper (Python) Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/SetupCodeWrapper.md Demonstrates how to create a SetupCodeWrapper object from a JSON string and convert it back to a dictionary. It also shows how to create an instance from a dictionary. This requires the 'docspace_api_sdk.models.setup_code_wrapper' module. ```python from docspace_api_sdk.models.setup_code_wrapper import SetupCodeWrapper # TODO update the JSON string below json = "{}" # create an instance of SetupCodeWrapper from a JSON string setup_code_wrapper_instance = SetupCodeWrapper.from_json(json) # print the JSON string representation of the object print(SetupCodeWrapper.to_json()) # convert the object into a dict setup_code_wrapper_dict = setup_code_wrapper_instance.to_dict() # create an instance of SetupCodeWrapper from a dict setup_code_wrapper_from_dict = SetupCodeWrapper.from_dict(setup_code_wrapper_dict) ``` -------------------------------- ### Instantiate TenantUserInvitationSettingsDto from JSON - Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/TenantUserInvitationSettingsDto.md Demonstrates how to create an instance of TenantUserInvitationSettingsDto from a JSON string using the `from_json` method. It also shows how to convert the object to its JSON string representation using `to_json` and to a dictionary using `to_dict`. This is useful for serializing and deserializing settings. ```python from docspace_api_sdk.models.tenant_user_invitation_settings_dto import TenantUserInvitationSettingsDto # TODO update the JSON string below json_string = "{}" # create an instance of TenantUserInvitationSettingsDto from a JSON string tenant_user_invitation_settings_dto_instance = TenantUserInvitationSettingsDto.from_json(json_string) # print the JSON string representation of the object print(TenantUserInvitationSettingsDto.to_json()) # convert the object into a dict tenant_user_invitation_settings_dto_dict = tenant_user_invitation_settings_dto_instance.to_dict() # create an instance of TenantUserInvitationSettingsDto from a dict tenant_user_invitation_settings_dto_from_dict = TenantUserInvitationSettingsDto.from_dict(tenant_user_invitation_settings_dto_dict) ``` -------------------------------- ### GET /api/2.0/settings/tfaapp/setup Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/SettingsTFASettingsApi.md Generates a setup code for configuring a TFA application. ```APIDOC ## GET /api/2.0/settings/tfaapp/setup ### Description Generates a setup code for configuring a TFA application. ### Method GET ### Endpoint /api/2.0/settings/tfaapp/setup ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import docspace_api_sdk from docspace_api_sdk.models.tfa_setup_code_wrapper import TFASetupCodeWrapper from docspace_api_sdk.rest import ApiException from pprint import pprint configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # Configure Bearer authorization (JWT): Bearer configuration = docspace_api_sdk.Configuration( access_token = os.environ["BEARER_TOKEN"] ) with docspace_api_sdk.ApiClient(configuration) as api_client: api_instance = docspace_api_sdk.TFASettingsApi(api_client) try: api_response = api_instance.tfa_app_generate_setup_code() pprint(api_response) except Exception as e: print("Exception when calling TFASettingsApi->tfa_app_generate_setup_code: %s\n" % e) ``` ### Response #### Success Response (200) - **TFASetupCodeWrapper** (TFASetupCodeWrapper) - A wrapper object containing the TFA setup code and a QR code URL. #### Response Example ```json { "example": "{\"response\": {\"setupCode\": \"123456\", \"qrCodeUrl\": \"otpauth://totp/...\"}}" } ``` ### Error Handling - **401**: Unauthorized ``` -------------------------------- ### Install Python DocSpace SDK using setuptools Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/README.md Installs the ONLYOFFICE DocSpace SDK for Python using setuptools. This method is useful for development or when installing from a local source. The `--user` flag installs for the current user only, while `sudo` installs system-wide. ```sh python setup.py install --user ``` ```bash sudo python setup.py install ``` -------------------------------- ### Get File History Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/FilesFilesApi.md Retrieves the version history for a specific file. You can filter the history by date range and specify the number of entries and starting index. ```APIDOC ## GET /files/{file_id}/history ### Description Retrieves the version history for a specific file. You can filter the history by date range and specify the number of entries and starting index. ### Method GET ### Endpoint `/files/{file_id}/history` ### Parameters #### Path Parameters - **file_id** (int) - Required - The file ID of the history request. #### Query Parameters - **from_date** (ApiDateTime) - Optional - The start date of the history. - **to_date** (ApiDateTime) - Optional - The end date of the history. - **count** (int) - Optional - The number of history entries to retrieve for the file log. - **start_index** (int) - Optional - The starting index for retrieving a subset of file history entries. ### Request Example ```python import docspace_api_sdk from docspace_api_sdk.models.api_date_time import ApiDateTime from docspace_api_sdk.rest import ApiException from pprint import pprint configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) with docspace_api_sdk.ApiClient(configuration) as api_client: api_instance = docspace_api_sdk.FilesApi(api_client) file_id = 9846 from_date = docspace_api_sdk.ApiDateTime() to_date = docspace_api_sdk.ApiDateTime() count = 1234 start_index = 1234 try: api_response = api_instance.get_file_history(file_id, from_date=from_date, to_date=to_date, count=count, start_index=start_index) pprint(api_response) except ApiException as e: print("Exception when calling FilesApi->get_file_history: %s\n" % e) ``` ### Response #### Success Response (200) - **HistoryArrayWrapper** (HistoryArrayWrapper) - Version history data. #### Response Example ```json { "example": "response body" } ``` #### Error Responses - **403** - You don't have enough permission to perform the operation. - **404** - The required file was not found. ``` -------------------------------- ### Instantiate TenantRoomQuotaSettingsWrapper from JSON (Python) Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/TenantRoomQuotaSettingsWrapper.md Demonstrates how to create an instance of TenantRoomQuotaSettingsWrapper from a JSON string using the from_json method. Requires the TenantRoomQuotaSettingsWrapper class from the SDK. ```python from docspace_api_sdk.models.tenant_room_quota_settings_wrapper import TenantRoomQuotaSettingsWrapper # TODO update the JSON string below json = "{}" # create an instance of TenantRoomQuotaSettingsWrapper from a JSON string tenant_room_quota_settings_wrapper_instance = TenantRoomQuotaSettingsWrapper.from_json(json) ``` -------------------------------- ### Start Filling File - Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/FilesFilesApi.md Initiates the filling process for a specified file. Requires the file ID as input. Returns a FileIntegerWrapper object upon successful execution. Handles potential API exceptions. ```python import docspace_api_sdk from docspace_api_sdk.models.file_integer_wrapper import FileIntegerWrapper from docspace_api_sdk.rest import ApiException from pprint import pprint configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # Enter a context with an instance of the API client with docspace_api_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = docspace_api_sdk.FilesApi(api_client) file_id = 9846 # int | The file ID to start filling. try: api_response = api_instance.start_filling_file(file_id) print("The response of FilesApi->start_filling_file:\n") pprint(api_response) except Exception as e: print("Exception when calling FilesApi->start_filling_file: %s\n" % e) ``` -------------------------------- ### GET /api/2.0/settings/storage/cdn Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/SettingsStorageApi.md Retrieves a list of all configured CDN storages. This endpoint is useful for checking your current CDN storage setup. ```APIDOC ## GET /api/2.0/settings/storage/cdn ### Description Get the CDN storages. ### Method GET ### Endpoint /api/2.0/settings/storage/cdn ### Parameters This endpoint does not require any parameters. ### Request Example ```python import docspace_api_sdk from docspace_api_sdk.rest import ApiException from pprint import pprint configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # Configure Bearer authorization (JWT): Bearer configuration = docspace_api_sdk.Configuration( access_token = os.environ["BEARER_TOKEN"] ) with docspace_api_sdk.ApiClient(configuration) as api_client: api_instance = docspace_api_sdk.StorageApi(api_client) try: api_response = api_instance.get_all_cdn_storages() pprint(api_response) except ApiException as e: print(f"Exception when calling StorageApi->get_all_cdn_storages: {e}") ``` ### Response #### Success Response (200) - **StorageArrayWrapper** (object) - Description of the wrapper object containing storage information. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Get Fill Result with Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/FilesFilesApi.md This example demonstrates how to retrieve the result of a form-filling session using the `FilesApi.get_fill_result` method. It optionally accepts a `filling_session_id` and handles potential API exceptions. ```python import docspace_api_sdk from docspace_api_sdk.models.filling_form_result_integer_wrapper import FillingFormResultIntegerWrapper from docspace_api_sdk.rest import ApiException from pprint import pprint configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # Enter a context with an instance of the API client with docspace_api_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = docspace_api_sdk.FilesApi(api_client) filling_session_id = 'some text' # str | The form-filling session ID. (optional) try: api_response = api_instance.get_fill_result(filling_session_id=filling_session_id) print("The response of FilesApi->get_fill_result:\n") pprint(api_response) except Exception as e: print("Exception when calling FilesApi->get_fill_result: %s\n" % e) ``` -------------------------------- ### Instantiate BackupServiceStateWrapper from JSON and Dict in Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/BackupServiceStateWrapper.md Demonstrates how to create an instance of BackupServiceStateWrapper from a JSON string and a Python dictionary. It also shows how to convert the object to a dictionary and then back to an object. This functionality is useful for data serialization and deserialization when interacting with the DocSpace API. ```python from docspace_api_sdk.models.backup_service_state_wrapper import BackupServiceStateWrapper # TODO update the JSON string below json_string = "{}" # create an instance of BackupServiceStateWrapper from a JSON string backup_service_state_wrapper_instance = BackupServiceStateWrapper.from_json(json_string) # print the JSON string representation of the object print(BackupServiceStateWrapper.to_json()) # convert the object into a dict backup_service_state_wrapper_dict = backup_service_state_wrapper_instance.to_dict() # create an instance of BackupServiceStateWrapper from a dict backup_service_state_wrapper_from_dict = BackupServiceStateWrapper.from_dict(backup_service_state_wrapper_dict) ``` -------------------------------- ### POST /api/2.0/backup/startbackup Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/BackupApi.md Starts the backup process. ```APIDOC ## POST /api/2.0/backup/startbackup ### Description Starts the backup process. ### Method POST ### Endpoint /api/2.0/backup/startbackup ### Response #### Success Response (200) - **BooleanWrapper** (BooleanWrapper) - True if the backup process was started successfully. #### Response Example ```json { "value": true } ``` ``` -------------------------------- ### Get Backup Progress using Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/BackupApi.md This Python code snippet illustrates how to get the progress of a started backup using the docspace_api_sdk. It involves configuring the API client with necessary authentication details, such as a Bearer token, and then invoking the get_backup_progress method from the BackupApi. An optional boolean 'dump' parameter can be provided. ```python import docspace_api_sdk from docspace_api_sdk.models.backup_progress_wrapper import BackupProgressWrapper from docspace_api_sdk.rest import ApiException from pprint import pprint import os configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # Configure Bearer authorization (JWT): Bearer configuration = docspace_api_sdk.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client with docspace_api_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = docspace_api_sdk.BackupApi(api_client) dump = True # bool | Specifies if a dump will be created or not. (optional) try: # Get the backup progress api_response = api_instance.get_backup_progress(dump=dump) print("The response of BackupApi->get_backup_progress:\n") pprint(api_response) except Exception as e: print("Exception when calling BackupApi->get_backup_progress: %s\n" % e) ``` -------------------------------- ### Start Data Reassignment using Python SDK Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/PeopleUserDataApi.md Starts the data reassignment process for a user via the DocSpace API SDK. This function can optionally accept a StartReassignRequestDto object. It uses Bearer token authentication and returns a TaskProgressResponseWrapper. The example includes setting up the API client and handling potential exceptions. ```python import docspace_api_sdk from docspace_api_sdk.models.start_reassign_request_dto import StartReassignRequestDto from docspace_api_sdk.rest import ApiException from pprint import pprint import os configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) configuration = docspace_api_sdk.Configuration( access_token = os.environ["BEARER_TOKEN"] ) with docspace_api_sdk.ApiClient(configuration) as api_client: api_instance = docspace_api_sdk.UserDataApi(api_client) start_reassign_request_dto = StartReassignRequestDto() try: api_response = api_instance.start_reassign(start_reassign_request_dto=start_reassign_request_dto) print("The response of UserDataApi->start_reassign:\n") pprint(api_response) except Exception as e: print("Exception when calling UserDataApi->start_reassign: %s\n" % e) ``` -------------------------------- ### Instantiate TenantDevToolsAccessSettingsWrapper from JSON and Dict in Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/TenantDevToolsAccessSettingsWrapper.md Demonstrates how to create an instance of TenantDevToolsAccessSettingsWrapper from a JSON string and a Python dictionary. It also shows how to convert the object back to JSON and a dictionary. This requires the 'docspace_api_sdk' library. ```python from docspace_api_sdk.models.tenant_dev_tools_access_settings_wrapper import TenantDevToolsAccessSettingsWrapper # TODO update the JSON string below json_string = "{}" # create an instance of TenantDevToolsAccessSettingsWrapper from a JSON string tenant_dev_tools_access_settings_wrapper_instance = TenantDevToolsAccessSettingsWrapper.from_json(json_string) # print the JSON string representation of the object print(TenantDevToolsAccessSettingsWrapper.to_json()) # convert the object into a dict tenant_dev_tools_access_settings_wrapper_dict = tenant_dev_tools_access_settings_wrapper_instance.to_dict() # create an instance of TenantDevToolsAccessSettingsWrapper from a dict tenant_dev_tools_access_settings_wrapper_from_dict = TenantDevToolsAccessSettingsWrapper.from_dict(tenant_dev_tools_access_settings_wrapper_dict) ``` -------------------------------- ### Instantiate TenantWalletServiceSettingsWrapper from JSON and Dictionary (Python) Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/TenantWalletServiceSettingsWrapper.md Demonstrates how to create an instance of TenantWalletServiceSettingsWrapper from a JSON string and a dictionary. It also shows how to convert the object to its dictionary representation and back. This functionality is useful for data serialization and deserialization when interacting with APIs. ```python from docspace_api_sdk.models.tenant_wallet_service_settings_wrapper import TenantWalletServiceSettingsWrapper # TODO update the JSON string below json_string = "{}" # create an instance of TenantWalletServiceSettingsWrapper from a JSON string tenant_wallet_service_settings_wrapper_instance = TenantWalletServiceSettingsWrapper.from_json(json_string) # print the JSON string representation of the object print(TenantWalletServiceSettingsWrapper.to_json()) # convert the object into a dict tenant_wallet_service_settings_wrapper_dict = tenant_wallet_service_settings_wrapper_instance.to_dict() # create an instance of TenantWalletServiceSettingsWrapper from a dict tenant_wallet_service_settings_wrapper_from_dict = TenantWalletServiceSettingsWrapper.from_dict(tenant_wallet_service_settings_wrapper_dict) ``` -------------------------------- ### GET /users/{userid}/remove/progress Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/PeopleUserDataApi.md Returns the progress of the started data deletion for the user with the specified ID. Use this to monitor the status of user data removal. ```APIDOC ## GET /users/{userid}/remove/progress ### Description Returns the progress of the started data deletion for the user with the specified ID. Use this to monitor the status of user data removal. ### Method GET ### Endpoint /users/{userid}/remove/progress ### Parameters #### Path Parameters - **userid** (str) - Required - The user ID. ### Request Example ```python import docspace_api_sdk from pprint import pprint configuration = docspace_api_sdk.Configuration( access_token = os.environ["BEARER_TOKEN"] ) with docspace_api_sdk.ApiClient(configuration) as api_client: api_instance = docspace_api_sdk.UserDataApi(api_client) userid = 'aae1e103-bca5-9fa1-ba8c-42058b4abf28' try: api_response = api_instance.get_remove_progress(userid) pprint(api_response) except Exception as e: print("Exception when calling UserDataApi->get_remove_progress: %s\n" % e) ``` ### Response #### Success Response (200) - **TaskProgressResponseWrapper** - Details about the deletion progress. #### Response Example ```json { "progress": 1.0, "status": "completed" } ``` #### Error Response (401) - **Unauthorized** - Indicates that the request lacks valid authentication credentials. ``` -------------------------------- ### TFASettingsApi - Get TFA Confirm URL Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/SettingsTFASettingsApi.md Retrieves the URL for confirming the two-factor authentication email. This endpoint is useful for initiating the TFA setup process via email. ```APIDOC ## POST /api/v2/tfa/confirm ### Description Retrieves the URL for confirming the two-factor authentication email. This endpoint is useful for initiating the TFA setup process via email. ### Method POST ### Endpoint /api/v2/tfa/confirm ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python # This is a conceptual example, actual request body might be empty or specific pass ``` ### Response #### Success Response (200) - **confirmation_url** (string) - The URL to confirm the TFA email. #### Response Example ```json { "confirmation_url": "https://your-docspace.onlyoffice.com/api/v2/tfa/confirm?token=your_token" } ``` #### Error Response (401) - **message** (string) - Unauthorized access. ``` -------------------------------- ### Instantiate CompanyWhiteLabelSettingsWrapper from JSON - Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/CompanyWhiteLabelSettingsWrapper.md Demonstrates how to create an instance of CompanyWhiteLabelSettingsWrapper by parsing a JSON string. It also shows how to convert the object to a JSON string and a dictionary, and then back from a dictionary. ```python from docspace_api_sdk.models.company_white_label_settings_wrapper import CompanyWhiteLabelSettingsWrapper # TODO update the JSON string below json = "{}" # create an instance of CompanyWhiteLabelSettingsWrapper from a JSON string company_white_label_settings_wrapper_instance = CompanyWhiteLabelSettingsWrapper.from_json(json) # print the JSON string representation of the object print(CompanyWhiteLabelSettingsWrapper.to_json()) # convert the object into a dict company_white_label_settings_wrapper_dict = company_white_label_settings_wrapper_instance.to_dict() # create an instance of CompanyWhiteLabelSettingsWrapper from a dict company_white_label_settings_wrapper_from_dict = CompanyWhiteLabelSettingsWrapper.from_dict(company_white_label_settings_wrapper_dict) ``` -------------------------------- ### Get File History - Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/FilesFilesApi.md Retrieves the version history for a specified file in ONLYOFFICE DocSpace. It accepts optional parameters for date range, count, and starting index. Requires the file ID as a mandatory parameter. ```python import docspace_api_sdk from docspace_api_sdk.models.api_date_time import ApiDateTime from docspace_api_sdk.models.history_array_wrapper import HistoryArrayWrapper from docspace_api_sdk.rest import ApiException from pprint import pprint configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # Enter a context with an instance of the API client with docspace_api_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = docspace_api_sdk.FilesApi(api_client) file_id = 9846 # int | The file ID of the history request. from_date = docspace_api_sdk.ApiDateTime() # ApiDateTime | The start date of the history. (optional) to_date = docspace_api_sdk.ApiDateTime() # ApiDateTime | The end date of the history. (optional) count = 1234 # int | The number of history entries to retrieve for the file log. (optional) start_index = 1234 # int | The starting index for retrieving a subset of file history entries. (optional) try: api_response = api_instance.get_file_history(file_id, from_date=from_date, to_date=to_date, count=count, start_index=start_index) print("The response of FilesApi->get_file_history:\n") pprint(api_response) except Exception as e: print("Exception when calling FilesApi->get_file_history: %s\n" % e) ``` -------------------------------- ### Serialize DuplicateRequestDtoAllOfFileIds to JSON String - Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/DuplicateRequestDtoAllOfFileIds.md Provides an example of how to get the JSON string representation of a DuplicateRequestDtoAllOfFileIds object using the to_json class method. This is useful for logging or sending data to an API. ```python from docspace_api_sdk.models.duplicate_request_dto_all_of_file_ids import DuplicateRequestDtoAllOfFileIds # print the JSON string representation of the object print(DuplicateRequestDtoAllOfFileIds.to_json()) ``` -------------------------------- ### FileEntryBaseDto Instantiation and Conversion (Python) Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/FileEntryBaseDto.md Demonstrates how to create an instance of FileEntryBaseDto from a JSON string, convert it to a dictionary, and create a new instance from a dictionary. It requires the 'docspace_api_sdk' library. ```python from docspace_api_sdk.models.file_entry_base_dto import FileEntryBaseDto # TODO update the JSON string below json = "{}" # create an instance of FileEntryBaseDto from a JSON string file_entry_base_dto_instance = FileEntryBaseDto.from_json(json) # print the JSON string representation of the object print(FileEntryBaseDto.to_json()) # convert the object into a dict file_entry_base_dto_dict = file_entry_base_dto_instance.to_dict() # create an instance of FileEntryBaseDto from a dict file_entry_base_dto_from_dict = FileEntryBaseDto.from_dict(file_entry_base_dto_dict) ``` -------------------------------- ### Get Room Creating Status - Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/RoomsApi.md Retrieves the status of room creation. This function requires no parameters and returns a RoomFromTemplateStatusWrapper object. It's useful for monitoring the progress of room setup. ```python import docspace_api_sdk from docspace_api_sdk.models.room_from_template_status_wrapper import RoomFromTemplateStatusWrapper from docspace_api_sdk.rest import ApiException from pprint import pprint configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # Enter a context with an instance of the API client with docspace_api_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = docspace_api_sdk.RoomsApi(api_client) try: api_response = api_instance.get_room_creating_status() print("The response of RoomsApi->get_room_creating_status:\n") pprint(api_response) except Exception as e: print("Exception when calling RoomsApi->get_room_creating_status: %s\n" % e) ``` -------------------------------- ### FileEntryDtoIntegerAllOfShareSettings: JSON and Dictionary Conversion (Python) Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/FileEntryDtoIntegerAllOfShareSettings.md Demonstrates how to create an instance of FileEntryDtoIntegerAllOfShareSettings from a JSON string and convert it to a dictionary, and vice versa. This is useful for serializing and deserializing sharing settings data. ```python from docspace_api_sdk.models.file_entry_dto_integer_all_of_share_settings import FileEntryDtoIntegerAllOfShareSettings # TODO update the JSON string below json_string = "{}" # create an instance of FileEntryDtoIntegerAllOfShareSettings from a JSON string file_entry_dto_integer_all_of_share_settings_instance = FileEntryDtoIntegerAllOfShareSettings.from_json(json_string) # print the JSON string representation of the object print(FileEntryDtoIntegerAllOfShareSettings.to_json()) # convert the object into a dict file_entry_dto_integer_all_of_share_settings_dict = file_entry_dto_integer_all_of_share_settings_instance.to_dict() # create an instance of FileEntryDtoIntegerAllOfShareSettings from a dict file_entry_dto_integer_all_of_share_settings_from_dict = FileEntryDtoIntegerAllOfShareSettings.from_dict(file_entry_dto_integer_all_of_share_settings_dict) ``` -------------------------------- ### Options Model Usage (Python) Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/Options.md Demonstrates how to create an Options instance from a JSON string, convert it to a dictionary, and create an instance from a dictionary using the docspace_api_sdk.models.options module. It also shows how to convert the object to its JSON string representation. ```python from docspace_api_sdk.models.options import Options # TODO update the JSON string below json = "{}" # create an instance of Options from a JSON string options_instance = Options.from_json(json) # print the JSON string representation of the object print(Options.to_json()) # convert the object into a dict options_dict = options_instance.to_dict() # create an instance of Options from a dict options_from_dict = Options.from_dict(options_dict) ``` -------------------------------- ### Get Time Zones using Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/SettingsCommonSettingsApi.md This example demonstrates how to fetch a list of all available time zones supported by the portal using the Python SDK. It requires authentication and the 'docspace_api_sdk' library. ```python import docspace_api_sdk from docspace_api_sdk.models.timezones_requests_array_wrapper import TimezonesRequestsArrayWrapper from docspace_api_sdk.rest import ApiException from pprint import pprint import os configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # Configure Bearer authorization (JWT): Bearer configuration = docspace_api_sdk.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client with docspace_api_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = docspace_api_sdk.CommonSettingsApi(api_client) try: # Get time zones api_response = api_instance.get_time_zones() print("The response of CommonSettingsApi->get_time_zones:\n") pprint(api_response) except Exception as e: print("Exception when calling CommonSettingsApi->get_time_zones: %s\n" % e) ``` -------------------------------- ### TenantQuotaSettings Model Usage (Python) Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/TenantQuotaSettings.md Demonstrates how to create and manipulate TenantQuotaSettings objects using the docspace_api_sdk.models.tenant_quota_settings module. It covers instantiation from JSON, conversion to dictionary, and vice-versa. Ensure the SDK is installed to run these examples. ```python from docspace_api_sdk.models.tenant_quota_settings import TenantQuotaSettings # TODO update the JSON string below json_string = "{}" # create an instance of TenantQuotaSettings from a JSON string tenant_quota_settings_instance = TenantQuotaSettings.from_json(json_string) # print the JSON string representation of the object print(TenantQuotaSettings.to_json()) # convert the object into a dict tenant_quota_settings_dict = tenant_quota_settings_instance.to_dict() # create an instance of TenantQuotaSettings from a dict tenant_quota_settings_from_dict = TenantQuotaSettings.from_dict(tenant_quota_settings_dict) ``` -------------------------------- ### StartFillingForm Model Usage (Python) Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/StartFillingForm.md Demonstrates how to use the StartFillingForm model from the docspace_api_sdk.models.start_filling_form module. It shows instantiation from JSON, conversion to JSON string, conversion to a dictionary, and instantiation from a dictionary. This model is used to define the properties of a button that starts filling out a form. ```python from docspace_api_sdk.models.start_filling_form import StartFillingForm # TODO update the JSON string below json = "{}" # create an instance of StartFillingForm from a JSON string start_filling_form_instance = StartFillingForm.from_json(json) # print the JSON string representation of the object print(StartFillingForm.to_json()) # convert the object into a dict start_filling_form_dict = start_filling_form_instance.to_dict() # create an instance of StartFillingForm from a dict start_filling_form_from_dict = StartFillingForm.from_dict(start_filling_form_dict) ``` -------------------------------- ### Start File Editing in DocSpace API (Python) Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/FilesFilesApi.md Illustrates how to initiate the editing process for a file using the FilesApi in the DocSpace Python SDK. This function requires the file ID and a StartEdit object containing editing parameters. The API returns a StringWrapper, typically containing a URL or status related to the editing session. ```python import docspace_api_sdk from docspace_api_sdk.models.start_edit import StartEdit from docspace_api_sdk.models.string_wrapper import StringWrapper from docspace_api_sdk.rest import ApiException from pprint import pprint configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # Enter a context with an instance of the API client with docspace_api_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = docspace_api_sdk.FilesApi(api_client) file_id = 9846 # int | The file ID to start editing. start_edit = docspace_api_sdk.StartEdit() # StartEdit | The file parameters to start editing. try: api_response = api_instance.start_edit_file(file_id, start_edit) print("The response of FilesApi->start_edit_file:\n") pprint(api_response) except Exception as e: print("Exception when calling FilesApi->start_edit_file: %s\n" % e) ``` -------------------------------- ### Get Claims - Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/PeopleProfilesApi.md Retrieves the user claims. This endpoint does not require any parameters and is protected by various authorization methods. The response is an ObjectWrapper. Ensure the SDK is installed and configured with appropriate authentication credentials. ```python import docspace_api_sdk from docspace_api_sdk.models.object_wrapper import ObjectWrapper from docspace_api_sdk.rest import ApiException from pprint import pprint configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. ``` -------------------------------- ### Initialize and Use DocSpace API Client (Python) Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/README.md Demonstrates how to initialize the ONLYOFFICE DocSpace API client in Python, configure authentication (Bearer token example), and make a call to create an API key. It includes error handling for API exceptions. ```python import docspace_api_sdk from docspace_api_sdk.rest import ApiException from pprint import pprint import os configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # Configure Bearer authorization (JWT): Bearer configuration = docspace_api_sdk.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client with docspace_api_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = docspace_api_sdk.ApiKeysApi(api_client) create_api_key_request_dto = docspace_api_sdk.CreateApiKeyRequestDto() # CreateApiKeyRequestDto | (optional) try: # Create a user API key api_response = api_instance.create_api_key(create_api_key_request_dto=create_api_key_request_dto) print("The response of ApiKeysApi->create_api_key:\n") pprint(api_response) except ApiException as e: print("Exception when calling ApiKeysApi->create_api_key: %s\n" % e) ``` -------------------------------- ### Get Tenant Developer Tools Access Settings - Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/SettingsAccessToDevToolsApi.md Retrieves the Developer Tools access settings for the portal. This method requires authentication and returns a TenantDevToolsAccessSettingsWrapper object. Ensure the SDK is installed and configured with the correct host and authentication credentials. ```python import docspace_api_sdk from docspace_api_sdk.models.tenant_dev_tools_access_settings_wrapper import TenantDevToolsAccessSettingsWrapper from docspace_api_sdk.rest import ApiException from pprint import pprint configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # Configure Bearer authorization (JWT): Bearer configuration = docspace_api_sdk.Configuration( access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client with docspace_api_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = docspace_api_sdk.AccessToDevToolsApi(api_client) try: # Get the Developer Tools access settings api_response = api_instance.get_tenant_access_dev_tools_settings() print("The response of AccessToDevToolsApi->get_tenant_access_dev_tools_settings:\n") pprint(api_response) except Exception as e: print("Exception when calling AccessToDevToolsApi->get_tenant_access_dev_tools_settings: %s\n" % e) ``` -------------------------------- ### start_filling_file Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/FilesFilesApi.md Initiates the process of filling a file, typically for form filling or document generation workflows. It returns a file key for the Document Service. ```APIDOC ## POST /files/{file_id}/fill ### Description Initiates the process of filling a file, returning a file key for the Document Service. ### Method POST ### Endpoint /files/{file_id}/fill ### Parameters #### Path Parameters - **file_id** (int) - Required - The file ID to start filling. ### Request Body This endpoint does not require a request body. ### Response #### Success Response (200) - **key** (string) - The file key for the Document Service. #### Response Example ```json { "key": "example_file_key" } ``` #### Error Response (403) - **message** (string) - You don't have enough permission to view the file. ``` -------------------------------- ### Get Folder by Folder ID - Python Example Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/FilesFoldersApi.md This Python code snippet demonstrates how to retrieve folder content by its ID using the ONLYOFFICE DocSpace API SDK. It includes setting up the API configuration, importing necessary models, and handling potential API exceptions. The example shows how to instantiate the SDK client and call the `get_folder_by_folder_id` method with various optional parameters. ```python import docspace_api_sdk from docspace_api_sdk.models.apply_filter_option import ApplyFilterOption from docspace_api_sdk.models.filter_type import FilterType from docspace_api_sdk.models.folder_content_integer_wrapper import FolderContentIntegerWrapper from docspace_api_sdk.models.location import Location from docspace_api_sdk.models.search_area import SearchArea from docspace_api_sdk.models.sort_order import SortOrder from docspace_api_sdk.rest import ApiException from pprint import pprint configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com" ) # Enter a context with an open API key with docspace_api_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = docspace_api_sdk.DefaultApi(api_client) folder_id = 123 # int | The folder ID. user_id_or_group_id = "user_id_or_group_id_example" # str | The user or group ID. | [optional] filter_type = FilterType.ALL # FilterType | The filter type. | [optional] room_id = 123 # int | The room ID. | [optional] exclude_subject = False # bool | Specifies whether to exclude search by user or group ID. | [optional] apply_filter_option = ApplyFilterOption.ALL # ApplyFilterOption | Specifies whether to return only files, only folders, or all elements from the specified folder. | [optional] extension = "docx" # str | Specifies whether to search for the specific file extension. | [optional] search_area = SearchArea.ALL # SearchArea | The search area. | [optional] forms_item_key = "forms_item_key_example" # str | The forms item key. | [optional] forms_item_type = "forms_item_type_example" # str | The forms item type. | [optional] count = 100 # int | The maximum number of items to retrieve in the request. | [optional] start_index = 0 # int | The zero-based index of the first item to retrieve in a paginated request. | [optional] sort_by = "name" # str | The property used for sorting the folder request results. | [optional] sort_order = SortOrder.ASC # SortOrder | The order in which the results are sorted. | [optional] filter_value = "document.docx" # str | The text value used as a filter parameter for folder content queries. | [optional] location = Location.DOCUMENTS # Location | The location context of the request, specifying the area where the operation is performed, such as a room, documents, or a link. | [optional] try: # Get folder by folder id api_response = api_instance.get_folder_by_folder_id(folder_id, user_id_or_group_id=user_id_or_group_id, filter_type=filter_type, room_id=room_id, exclude_subject=exclude_subject, apply_filter_option=apply_filter_option, extension=extension, search_area=search_area, forms_item_key=forms_item_key, forms_item_type=forms_item_type, count=count, start_index=start_index, sort_by=sort_by, sort_order=sort_order, filter_value=filter_value, location=location) pprint(api_response) except ApiException as e: print("Exception when calling DefaultApi->get_folder_by_folder_id: %s\n" % e) ``` -------------------------------- ### Get TFA Confirmation Email URL using Python Source: https://github.com/onlyoffice/docspace-api-sdk-python/blob/master/docs/SettingsTFASettingsApi.md Retrieves the confirmation email URL for two-factor authentication setup. This function requires an initialized API client and handles potential exceptions during the API call. ```python import docspace_api_sdk from pprint import pprint # Assuming 'configuration' is already set up # configuration = docspace_api_sdk.Configuration(...) with docspace_api_sdk.ApiClient(configuration) as api_client: api_instance = docspace_api_sdk.TFASettingsApi(api_client) try: api_response = api_instance.get_tfa_confirm_url() print("The response of TFASettingsApi->get_tfa_confirm_url:\n") pprint(api_response) except Exception as e: print("Exception when calling TFASettingsApi->get_tfa_confirm_url: %s\n" % e) ```