.. index:: 
  !DocumentLicense.activateSerialKey Method
  
.. _id3_document_document_license_activate_serial_key_class_method:

===============================================================================
DocumentLicense.activateSerialKey Method
===============================================================================

Module: :ref:`DocumentLicense<id3_document_document_license_class>`

Definition
----------

Activates a license using a serial key and saves the license to a file.


.. tab-set::

    .. tab-item:: Python
      :sync: Python

      .. code:: Python

        @staticmethod
        activate_serial_key(hardware_code: str, serial_key: str, commentary: str, path: str) -> None

      **Parameters**

        .. line-block::

          ``hardware_code`` str
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``serial_key`` str
          :guilabel:`in` The serial key to activate.

          ``commentary`` str
          :guilabel:`in` Commentary associated to this license activation, generally the host name.

          ``path`` str
          :guilabel:`in` Path to the license file.


      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: Dart
      :sync: Dart

      .. code:: Dart

        static void activateSerialKey(String? hardwareCode, String? serialKey, String? commentary, String? path)

      **Parameters**

        .. line-block::

          ``hardwareCode`` String
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``serialKey`` String
          :guilabel:`in` The serial key to activate.

          ``commentary`` String
          :guilabel:`in` Commentary associated to this license activation, generally the host name.

          ``path`` String
          :guilabel:`in` Path to the license file.


      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: C#
      :sync: C#

      .. code:: C#

        public static void ActivateSerialKey(string hardwareCode, string serialKey, string commentary, string path)

      **Parameters**

        .. line-block::

          ``hardwareCode`` string
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``serialKey`` string
          :guilabel:`in` The serial key to activate.

          ``commentary`` string
          :guilabel:`in` Commentary associated to this license activation, generally the host name.

          ``path`` string
          :guilabel:`in` Path to the license file.


      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: Java
      :sync: Java

      .. code:: Java

        public static void activateSerialKey(String hardwareCode, String serialKey, String commentary, String path) throws DocumentException

      **Parameters**

        .. line-block::

          ``hardwareCode`` String
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``serialKey`` String
          :guilabel:`in` The serial key to activate.

          ``commentary`` String
          :guilabel:`in` Commentary associated to this license activation, generally the host name.

          ``path`` String
          :guilabel:`in` Path to the license file.


      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: Swift
      :sync: Swift

      .. code:: Swift

        public static func activateSerialKey(hardwareCode: String, serialKey: String, commentary: String, path: String) throws

      **Parameters**

        .. line-block::

          ``hardwareCode`` String
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``serialKey`` String
          :guilabel:`in` The serial key to activate.

          ``commentary`` String
          :guilabel:`in` Commentary associated to this license activation, generally the host name.

          ``path`` String
          :guilabel:`in` Path to the license file.


      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


    .. tab-item:: C
      :sync: C

      .. code:: C

        int id3DocumentLicense_ActivateSerialKey (
            const char * hardwareCode, 
            const char * serialKey, 
            const char * commentary, 
            const char * path)

      **Parameters**

        .. line-block::

          ``hardwareCode`` const char *
          :guilabel:`in` The hardware code on which the license file will be attached, to be retrieved using the GetHostHardwareCode function.

          ``serialKey`` const char *
          :guilabel:`in` The serial key to activate.

          ``commentary`` const char *
          :guilabel:`in` Commentary associated to this license activation, generally the host name.

          ``path`` const char *
          :guilabel:`in` Path to the license file.


      **Returns**

        .. line-block::

          ``int``
          An error code.
          See :ref:`id3DocumentError<id3_document_document_error_enum>` file for the list of possible error codes.


