Steps to Create a Provided REST API
This help page contains a short description of the steps to take when creating a new Provided REST API.
For a more detailed description, see the link under each step.
Creation of the REST API in the AMT Developer Studio
- Create a new Provided REST API in the Enterprise Repository view, set the Name and Description of the web service object and fill the Swagger fields if Swagger documentation should be generated for the REST API.
- Open the Controllers screen and do the following.
- Add a new controller and set a Name, Description and Path of the controller. Tick the checkbox to generate
Swagger documentation for this controller.
See Controllers. - Add one or more methods to the created controller and set a Name and Description for the method. Tick the checkbox to add this method to the Swagger documentation (if generated for the controller). Add parameters and routes to the created methods. Generate routines for the method by clicking the 'Generate Lion logic' button. See Methods.
- Add a new controller and set a Name, Description and Path of the controller. Tick the checkbox to generate
Swagger documentation for this controller.
- Open the Implementation screen. Here the Lion code for every created Method can be added.
- After saving the newly created Provided REST API and checking it in, the new Provided REST API can be generated.
Adding Provided REST API Applications
See 'Adding Provided REST API Applications' for more details.
- When generating the Provided REST API the generated files will be placed in the Application folder Common\RestApiProvider\<Provided REST API>\ . This folder should be added as <IIS Application> with its own application pool to IIS to make the Provided REST API reachable.
Configuring Provided REST APIs
See 'Configuring Provided REST APIs' for more details.
- The generated file appsettings.json should be edited to the desired authentication settings.
- Both 'ClientId' and 'ClientSecret' keys should be changed to values unique for each Provided REST API.
- The 'AmtCookieEncryptionKey' should be set to the same key as used in other AMT web applications. See Generating Keys.
- In the BusinessLogic section of the appsettings.json file, the ApplicationCenterWebBL website url should be set as 'Address' and the application name as set in the Control Center should be set in 'ApplicationName'.
- The in the previous step set 'ClientId' and 'ClientSecret' keys of the RestApiProvider appsettings.json file need to be added to the ApplicationCenterWebApi appsettings.json file under the 'ClientsSecrets' section, in the same manner as the ApplicationCenter.
Configuration in the Control Center
- After generation of the Provided REST API it has to be imported into the Control Center, see Control Center -> System Configuration -> Batch & Forms -> Tab REST API Providers.
- Once imported in the Control Center, the Provided REST API can be configured if needed by editing the entries.
- Finally the security settings for every method of the Provided REST API need to be set in the Control Center, see Control Center -> Security -> REST API Providers.
Swagger
- If both Swagger Documentation and Swagger UI are enabled for the Provided REST API in the appsettings, Swagger UI can
be accessed by adding index.html to the IIS Application of the Provided REST API.
E.g. https://amt.example.com/AMT/CustomerAPI/index.html
AMT Provided REST API object are created to the OpenAPI 3.0.1 specification. |
Information on how to debug AMT Provided REST API can be found on 'Debugging Provided REST API'. |