New custom API doesn't work on Web Portal

I want to create a new page on the Web Portal to display the AERoles.
I developed a new custom API:
builder.AddMethod(Method
                .Define("ccc/AERole")
                .FromTable("AERole")
                .EnableRead()
                .WithAllColumns()
                .With(
                    m => m.Crud.EntityType = EntityType.Interactive
                 )
                .With(
                    m =>
                    {
                        m.EnableDataModelApi = true;
                        m.EnableGroupingApi = true;
                    }
                )
                .EnableUpdate()
                .EnableCreate()
                .WithWritableAllColumns()
             );


After compilation, I uploaded the API dll file to OneIdentity via Software Loader.
By accessing the API Server I can correctly test the new APIs added.
Using the command "imxclient compile-api /copyapi imx-api-ccc.tgz /packagename imx-api-ccc", I created the new package to import into the Angular project. I installed it with command "npm install ../imx-api-ccc.tgz"
Trying to call the new API to set the DataModel and display the data in the table, I get the error:
Type Error: this.qerClient.client.portal_ccc_AERole_datamodel_get is not a function
But opening the installed package, I can see the method:
V2ApiClientMethodFactory.prototype.portal_ccc_AERole_datamodel_get = function (options) {
            if (options === void 0) { options = {}; }
            return {
                path: '/portal/ccc/AERole/datamodel',
                parameters: imxQbmDbts.MethodDefinition.MakeQueryParameters(options, []),
                method: 'GET',
                headers: {
                    'imx-timezone': imxQbmDbts.TimeZoneInfo.get(),
                },
                credentials: 'include',
                observe: 'response',
                responseType: 'json'
            };
        };

 
Any suggestion? Thank you
 
Parents Reply
  • Hi Niels,

    I created new tgz file with this command (in One Identity Manager directory): imxclient compile-api /copyapi imx-api-ccc.tgz /packagename imx-api-ccc

    Move the new tgz file in your project path, then you can import new custom API package with command: npm install {your_path}/imx-api-ccc.tgz

    Then I created new API service (similar to api-service) with import: import { V2Client, Client, TypedClient } from 'imx-api-ccc';

Children
  • Some great advise I found on github related to this post...

    Changes on the API which are not only affecting the logic within the apicall, but e.g. the columns that are reponsed or e.g. parameters require that you also re-compile the Client of the API ("imx-api-qer " in your case). In my discussions with One Identity I got the statement, that they don't recommend to do so. instead you can add the module "qer" to your ccc-clientApi. .\ImxClient.exe compile-api /copyapi "/imx-modules\imx-api-ccc.tgz" /packagename imx-api-ccc /modules "QER,CCC" /clientmodules "QER,CCC". Then the imx-api-ccc contains also all interfaces for the QER-Api. But this also requires that you add imx-api-ccc as dependency to the qer-project and you need to change the imports in the needed component from imx-api-qer to imx-api-ccc.