Editing API plugins
You can edit existing API plugins.
To edit an existing API plugin
-
Start your IDE (such as Visual Studio).
-
Open an existing .NET 8 project.
-
Edit the API code.
-
Compile the DLL file in your IDE.
-
Copy the DLL file to the One Identity Manager install directory.
-
Import the DLL file into your One Identity Manager database using the Software Loader. For more information on importing files using the Software Loader, see the One Identity Manager Operational Guide.
-
Restart the API Server and ensure that the <project name>.CompositionApi.Server.Plugin file exists in the bin folder of the API Server install directory.
-
Compile the appropriate TypeScript API client (see Compiling TypeScript API clients).
Compiling TypeScript API clients
After you create an API plugin, you need to compile a corresponding TypeScript API client.
To compile a TypeScript API client
-
Open a command line interface (for example, Windows Powershell).
-
In the command line program, go to the One Identity Manager installation directory.
-
Run the ImxClient's start-update command (see start-update).
Example
imxclient start-update
-
Run the ImxClient's compile-api command (see compile-api).
Example
imxclient compile-api /copyapi imx-api-ccc.tgz /packagename imx-api-ccc
The dialog to select the database connection is opened.
-
In the dialog, perform one of the following actions:
-
to use an existing connection to the One Identity Manager database, select it in the Select a database connection drop-down.
- OR -
-
to create a new connection to the One Identity Manager database, click Add new connection and enter a new connection.
-
Select the authentication method and, under Authentication method, enter the login data for the database.
-
Click Log in.
-
Import the imx-api-ccc npm package into your TypeScript application.
TIP: (Optional) If you want to use another name for the imx-api-ccc packet, extend the remove-local-packages.js by adding a line for the packet in the list. This ensures that your package is not included in package locking and is always updated from the local source.
-
Copy the imx-api-ccc.tgz to the bin\imx-modules subfolder of your IIS installation.
-
Import the TGZ file into your One Identity Manager database using the Software Loader and assign it to the Business API Server machine role. For more information on importing files using the Software Loader, see the One Identity Manager Operational Guide.
-
Restart the API Server and ensure that the imx-api-ccc.tgz file is in the bin\imx-modules folder of your IIS installation.
Adding APIs to One Identity API projects
You can add your own APIs to One Identity API projects to add customized functionality to One Identity HTML applications. To do this, create an API plugin, define the API in it and assign the corresponding One Identity API project to the API plugin.
To add an API to a One Identity API project
-
Create or edit an API plugin (see Creating API plugins or Editing API plugins) and proceed as follows:
-
Create a new class in the API plugin project. This class represents the so-called API provider.
-
Declare the class with the interface that belongs to the API project you want to add your API to.
The following One Identity API projects can be added:
Table 1: Supplied API project
Web Portal |
portal |
IApiProviderFor<QER.CompositionApi.Portal.PortalApiProject> |
Operations Support Web Portal |
opsupport |
IApiProviderFor<QBM.CompositionApi.Operations.OperationsApiProject> |
Administration Portal |
admin |
IApiProviderFor<QBM.CompositionApi.AdminApi.AdminApiProject> |
Password Reset Portal |
passwordreset |
IApiProviderFor<QER.CompositionApi.Password.PasswordPortalApiProject> |
-
Implement the Build method of the IApiProviderFor interface with the desired API functionality.
Example
1 |
public class ExampleApi : IApiProviderFor<QER.CompositionApi.Portal.PortalApiProject> |
2 |
|
3 |
{ |
4 |
public void Build(IApiBuilder builder) |
5 |
{ |
6 |
builder.AddMethod(Method.Define("example") |
7 |
.AllowUnauthenticated() |
8 |
.HandleGet(qr => new DataObject { Message = "Hello world!" })); |
9 |
} |
10 |
} |
Creating API projects
You can create your own API projects to add customized functionality to One Identity HTML applications. To do this, copy the CustomApiProject sample API project (see Examples and help – Software Development Kit), customize it as required, and assign it to an API plugin.
To create your own API project
-
Copy the CustomApiProject sample API project.
-
Make changes to the copied API project as required.
-
Create an API plugin (see Creating API plugins) and proceed as follows: