AMT Help Files

Configuring Provided REST APIs

As part of setting up a Provided REST API, it is necessary to change the encryption keys and authentication settings in the appsettings.json files. Before we can change the keys required in these files, we need to generate the keys with the Setup tool. Learn how to generate these keys on the Generating Keys page.

The generated keys can be copied to replace the default keys in the appsettings.json file. Please generate and use a unique key for each such setting. Note that it is necessary for the "AmtCookieEncryptionKey" key to be the same as the other cookie encryption keys in your AMT environment found in the appsettings.json file of the Application Center.

A setting files needs to be configured when a new Provided REST API is created.

  1. appsettings.json in the folder <AMT Environment>\Apps\<Application>\Binaries\Common\RestApiProvider\<Name of the Rest API>\

 

REST API appsettings.json

When configuring the Provided REST API it is important to retrieve the AmtCookieEncryptionKey from your existing environment. This key is required to be the same across the entire AMT environment.

  1. Navigate to the following directory: ..\<AMT_Environment>\Apps\<APPLICATION>\Binaries\Common\RestApiProvider\<Name of the Rest API>\.
  2. Copy the appsettings_default.json file found in this directory and rename the copied file to appsettings.json (overwrite the previous exiting file if required).
  3. Open the appsettings.json file in a text editor and configure the settings listed below.

    • In the Amt section:
      • AmtCookieEncryptionKey (the AMT environment cookie key)
      • BusinessLogic {
        •  ApplicationName (the name of the AMT application)


       {
         "Amt": {
           "AmtCookieEncryptionKey": "YGQ9zlT4noYK3O3+SnsbuNyalJMhGpXvZ3Zr82xgE8I=",
               ...
           "Businesslogic": {
              "ApplicationName": "CUSTOMER_MANAGEMENT"
           },
               ...

    • Authentication: Also in the Amt section there are two authentication sections, Windows authentication and cookie authentication.
      Depending on the chosen authentication method one of these sections needs to be uncommented while the unused method section needs to be commented out by adding double slashes (//) in front of the lines.

      • Windows Authentication:
        To use Windows Authentication, uncomment the following lines by removing the double forward slashes (//):

         "AuthenticationType": "Windows",
         "WindowsAuthentication": {
           "Cookie": {
             "Name": ".Amt.AC.Auth"
            }
         },

      • Cookie Authentication:
        To use Cookie authentication, uncomment the following lines by removing the double forward slashes (//):

         "AuthenticationType": "Cookies",
         "CookieAuthentication": {
           "Cookie": {
             "Name": ".Amt.AC.Auth"
            }
         },


  4. Save the file.
Ensure to also comment out the Windows authentication settings if switching from Windows authentication to cookie authentication by adding two forward slashes in front of each line.

When cookie authentication is used for Provided REST APIs, ensure that a password is set for the users in the Control Center. In AMT environments where OpenID Connect Authentication is used these are generally not set.

 

Recycling Application Pools

In order to apply the new settings, a restart of the application pools is needed for all Provided REST APIs to function properly.
It is possible to only restart the individual application pools of the applications where the appsettings.json file was modified.
Which, in this case, is the application pool of the newly created Provided REST API.

Click on the application pool that needs to be recycled and select Recycle....

 

Alternatively, it is also possible to restart the whole IIS which also recycles every Application Pool.
The downside is that this will affect every Web Application hosted on the IIS instance.