Skip to content

Latest commit

 

History

History
359 lines (262 loc) · 17.2 KB

SettingsLicenseApi.md

File metadata and controls

359 lines (262 loc) · 17.2 KB

docspace_api_sdk.LicenseApi

All URIs are relative to https://your-docspace.onlyoffice.com

Method HTTP request Description
accept_license POST /api/2.0/settings/license/accept Activate a license
get_is_license_required GET /api/2.0/settings/license/required Check if a license is required
refresh_license GET /api/2.0/settings/license/refresh Refresh the license
upload_license POST /api/2.0/settings/license Upload a license

accept_license

StringWrapper accept_license()

Activates the license staged by POST api/2.0/settings/license on this self-hosted Enterprise installation: it records that the license was accepted, promotes the staged file to the active one and rewrites the portal-wide quota and tariff from it. Upload a file first: with nothing staged and no license on disk there is nothing to activate. The caller only has to be signed in, and the activation is recorded in the audit trail. Repeating the call is safe: the acceptance stamp is written only once and the same license is simply applied again. Read the outcome from the body rather than the status code - an empty string means the license is now active, and any other string is a message explaining why it is not: no license key was found, the key is not correct, the installed edition does not match the license type, or the license is expired or too small for the current user count. The acceptance stamp survives a failed activation, so a corrected file needs nothing extra. An installation with no license path configured answers that its pricing plan does not support the option and changes nothing. The operation stays reachable while the portal is unpaid.

For more information, see api.onlyoffice.com.

Parameters

This endpoint does not need any parameter.

Return type

StringWrapper

Authorization

Basic, OAuth2, ApiKeyBearer, asc_auth_key, Bearer, OpenId

Example

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"
)

# 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.LicenseApi(api_client)

    try:
        # Activate a license
        api_response = api_instance.accept_license()
        print("The response of LicenseApi->accept_license:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling LicenseApi->accept_license: %s\n" % e)

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 An empty string when the license is now active, or a localized sentence explaining why it was not activated * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-RateLimit-Reset -
401 Unauthorized -
429 Too Many Requests. * Retry-After -
500 Internal Server Error. -
502 Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON. -
503 Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_is_license_required

BooleanWrapper get_is_license_required()

Reports whether this installation still has to be given a license file before it can be used, which is the question the setup wizard asks before offering its license upload step. No authentication is needed, so it can be called on a portal nobody has signed in to yet, and the call is read-only. The answer is true only for a self-hosted Enterprise build whose license file is not on disk yet; an open-source or SaaS portal, a portal configured to let anyone in without an account, an installation whose configuration hides the pricing section, and one that takes its setup from cloud-image metadata all answer false. A false answer therefore does not mean the portal is licensed - it also covers every build that needs no license at all. Nothing here describes a license already in place, neither its due date nor whether the editing service still accepts it, and the answer turns to false only once a staged file has been activated by POST api/2.0/settings/license/accept, not when it is uploaded. The operation stays reachable while the portal is unpaid.

For more information, see api.onlyoffice.com.

Parameters

This endpoint does not need any parameter.

Return type

BooleanWrapper

Authorization

Basic, OAuth2, ApiKeyBearer, asc_auth_key, Bearer, OpenId

Example

import docspace_api_sdk
from docspace_api_sdk.models.boolean_wrapper import BooleanWrapper
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.LicenseApi(api_client)

    try:
        # Check if a license is required
        api_response = api_instance.get_is_license_required()
        print("The response of LicenseApi->get_is_license_required:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling LicenseApi->get_is_license_required: %s\n" % e)

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 true when this Enterprise installation still needs a license file, false when one is already active or the build needs none * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-RateLimit-Reset -
429 Too Many Requests. * Retry-After -
500 Internal Server Error. -
502 Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON. -
503 Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

refresh_license

BooleanWrapper refresh_license()

Re-reads the license file of this self-hosted Enterprise installation and rewrites the portal-wide quota and tariff from it, so a file replaced on disk or a renewal issued by the vendor takes effect without a restart. A license staged by POST api/2.0/settings/license is promoted to the active one here as well, but the usual first-time order is upload and then POST api/2.0/settings/license/accept; this operation is for later refreshes. The caller only has to be signed in - no administrator right is checked. Despite the GET, the call rewrites stored data, and it is idempotent: repeating it applies the same license again. The editing service is asked to confirm the license as part of the check, and the license it reports must match the file. The answer is true when the license was applied and false on an installation with no license path configured at all, such as a SaaS or open-source portal, where nothing is read and nothing changes. A missing or unreadable file, a mismatched customer or edition, and an editing service that rejects the license all fail the call instead of answering false. The operation stays reachable while the portal is unpaid.

For more information, see api.onlyoffice.com.

Parameters

This endpoint does not need any parameter.

Return type

BooleanWrapper

Authorization

Basic, OAuth2, ApiKeyBearer, asc_auth_key, Bearer, OpenId

Example

import docspace_api_sdk
from docspace_api_sdk.models.boolean_wrapper import BooleanWrapper
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.LicenseApi(api_client)

    try:
        # Refresh the license
        api_response = api_instance.refresh_license()
        print("The response of LicenseApi->refresh_license:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling LicenseApi->refresh_license: %s\n" % e)

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 true when the license file was re-read and the portal quota and tariff rewritten from it, false on an installation that has no license path configured * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-RateLimit-Reset -
400 The license file does not start until a later date -
402 No license file is on disk, the file cannot be read as a license or carries no customer id or signature, it was issued for the other edition, or the editing service does not confirm it -
401 Unauthorized -
429 Too Many Requests. * Retry-After -
500 Internal Server Error. -
502 Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON. -
503 Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

upload_license

StringWrapper upload_license(files)

Takes the license file of this self-hosted Enterprise installation as multipart/form-data and stages it for activation; only the first entry of Files is read and the rest are ignored. The file is validated but not put in force here - follow with POST api/2.0/settings/license/accept to activate it, and until then the portal keeps the license it already had. The caller must be a DocSpace administrator, or hold a wizard or administrator confirmation link while the setup wizard is still unfinished; after the wizard is complete such a link alone is refused. An earlier staged file is overwritten, so the upload can be repeated safely. The answer is a localized sentence, not a structured result: Uploaded successfully on its own, or the same words plus the date since when support and updates are not covered, because a file already past its due date is still accepted. A request carrying no file, and a license whose start date has not arrived yet, are rejected as invalid; a file that cannot be read as a license, carries no customer id or signature, or was issued for the other edition fails the call. Whether the editing service accepts it is only checked at activation.

For more information, see api.onlyoffice.com.

Parameters

Name Type Description Notes
files List[bytes] The license file, sent as multipart/form-data. Only the first entry is read and the rest are ignored, and a request carrying none is refused with 400. A file that cannot be read as a license, that carries no customer id or signature, or that was issued for the other edition fails the call; one whose start date has not arrived yet is refused, while one already past its due date is still accepted. Staging only stores the file - POST api/2.0/settings/license/accept puts it in force - and a file staged earlier is overwritten.

Return type

StringWrapper

Authorization

Basic, OAuth2, ApiKeyBearer, asc_auth_key, Bearer, OpenId

Example

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"
)

# 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.LicenseApi(api_client)
    files = None # List[bytes] | The license file, sent as `multipart/form-data`. Only the first entry is read and the rest are ignored, and a  request carrying none is refused with 400. A file that cannot be read as a license, that carries no customer  id or signature, or that was issued for the other edition fails the call; one whose start date has not  arrived yet is refused, while one already past its due date is still accepted. Staging only stores the file -  `POST api/2.0/settings/license/accept` puts it in force - and a file staged earlier is overwritten.

    try:
        # Upload a license
        api_response = api_instance.upload_license(files)
        print("The response of LicenseApi->upload_license:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling LicenseApi->upload_license: %s\n" % e)

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 A localized confirmation that the file was staged, carrying the date support and updates ended when the license is already overdue * X-RateLimit-Limit -
* X-RateLimit-Remaining -
* X-RateLimit-Reset -
400 The request carried no license file, or the license does not start until a later date -
403 The caller is not a DocSpace administrator, or a confirmation link was used after the setup wizard had already been completed -
415 The installation has no license path configured, so it cannot be given a license file -
500 The file cannot be read as a license, carries no customer id or signature, or was issued for the other edition -
401 Unauthorized -
429 Too Many Requests. * Retry-After -
502 Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON. -
503 Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]