Adding Tenants via Rest Methods
  • 19 Aug 2024
  • 2 Minutes to read
  • Dark
    Light

Adding Tenants via Rest Methods

  • Dark
    Light

Article summary

Feature Details

Introduced in Version

8.10

Modified in Version

8.20

Modification Details

Added three new service methods

Overview

Decisions allow adding, hosting, and deleting the Tenant Instance via Rest API without interacting with the portal.

API Methods

  1. Log in to the Control Instance. Navigate to  System > Administration > Features > All Services.

  2. Scroll down or search for MultiTenancyAdministrationService, right-click on the service, and select View Integration Details.

  3. The service includes the following methods, and the next section explains each.

The methods CreateInstanceAndHostLocally & DeleteInstance can only be accessed in version 8.18 or later.

[REST Method] CreateInstance

This method will only create a new Tenant Instance but will not host it. Users need a manual intervention to host the tenant instance.

  • URL: [PostalBaseURL]/Primary/REST/MultiTenancyAdministrationService/CreateInstance

  • HTTP Method: GET/POST

  • Request Body: The request Body requires the following parameters:

    • instanceName: Name to give to the Tenant Instance

    • instanceBaseURL: Portal Base URL of the Tenant Instance

    • authenticationKey: User-defined string to encrypt the communication with Control Instance

[REST Method] CreateInstanceAndHostLocally

This method creates and hosts the Tenant Instance on the IIS only.

  • URL: [PostalBaseURL]/Primary/REST/MultiTenancyAdministrationService/CreateInstanceAndHostLocally

  • HTTP Method: POST

  • Request Body: The request body requires the following parameters:

    • InstanceName: Specify the name of the instance

    • InstanceBaseURL: Specify the base URL of the instance (for example, "http://localhost/decisions/Tenant1)

    • AuthenticationKey: Required to encrypt/decrypt communication between the tenant and control instance

    • AdminAccountEmailAddress: Provide the email address of the account to assign as admin

    • InternalInstanceBaseUrl: Only in v8.20+

    • SiteName: Specify the website name. Needed when hosting the instance on IIS

    • InternalControlInstanceURL: Only in v8.20+

    • ForceBaseURI: Only in v8.20+

    • DatabaseType: Specify the Database type. (MSSQL = 0, POSTGRES = 1, AZURE = 2)

    • DBConnectionString: Specify the database connection string

[REST Method] DeleteInstance

This method is responsible for deleting the instance by taking the tenant's name.

  • URL: [PostalBaseURL]/Primary/REST/MultiTenancyAdministrationService/DeleteInstance

  • HTTP Method: GET/POST

  • Request Body: It takes only one parameter

    • instanceName: Specify the name of the instance

[REST Method] GetAllInstanceNames

This method is responsible for retrieving all the available tenant Instances.

  • URL: [PostalBaseURL]/Primary/REST/MultiTenancyAdministrationService/GetAllInstanceNames

  • HTTP Method: GET/POST

  • POST Results:

    • GetAllInstanceNamesResult: List of Tenants


Example

Creating the Instance

  1. Navigate to the CreateInstance Service method.

  2. Under the Credentials, select the appropriate Authentication Type. Ensure that you click on Store Credentials to update the parameters.

  3. Under the Options, select the desired Service type, Rest Options, and Output Type.

  4. Navigate to the Test Page. Select Post and provide all the Parameters. Click on RUN.

    • instanceName: Give the desired instance Name

    • instanceBaseURL: Give the Instance Base URL for the Tenant

    • authenticationKey: User-defined string to encrypt the communication with Control Instance

In the following example, the instanceName is defined as THIS IS TENANT.

Verifying the Instance

  1. Navigate to the GetAllInstanceNames Service method.

  2. Follow steps 2 to 4 from the above topic, Creating the Instance.

  3. To verify the same in the Decisions Portal, navigate to System > Hosting.


Related Articles

To host the tenant, refer to Adding and Setting up a Tenant Instance.

To host the tenant as a Container, refer to Multi-Tenant Containers.


Feature Changes

Description

Version

Release Date

Developer Task

Added three new parameters - InternalInstanceBaseUrl, InternalControlInstanceURL, ForceBaseURI

8.20

June 5, 2024

[DT-040739]


Was this article helpful?