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 Children
  • Hello Fabio,

    How did you import your imx-api-ccc inside the project?
    so you could access the custom API's like: this.qerClient.client.portal_ccc_AERole_datamodel_get

    Did you create a new api.service.ts or create an alias for V2Client?

    OOTB config:

    /imxweb/projects/qer/src/lib/qer-api-client.service.ts
    ...
    import { V2Client, Client, TypedClient } from 'imx-api-qer';
    ...
    export class QerApiService {...}
    
    /imxweb/projects/qer/src/lib/identities/identities.service.ts
    ...
    import { QerApiService } from '../qer-api-client.service';
    ...
    constructor(
    private readonly qerClient: QerApiService,
    ...
    this.qerClient.client.portal_...


     
    I think we solved this, but maybe you are willing to share your solution/work-around.
    APIServer: How to make custom typed client accessible via the QerApiService

    Regards,
    Niels

  • 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';