Advanced Reporting with APIs

Additional Resources

6 Likes

Hi Colin,
Thanks for sharing this.

  • List item

Was that a typo in the script for uncorrelated accounts ? filters: ā€˜uncorrelated eq trueā€™ā€™
I was unable to export sourceName from account.source but it exports if we donā€™t choose the columns.
Could you please help on that ?

1 Like

Welcome to the developer community Antony.

Iā€™m having trouble identifying the line of code that is giving you issues. Do you mind opening an issue for this and referencing the exact portion of code that is causing you issues? Issues Ā· colin-mckibben-sp/api-reporting-examples Ā· GitHub

1 Like

Hey Colin
Not a issue but I would like to know how to export column ā€œsourceNameā€ ?
Intellisense is not showing accounts.sourceName but only sourceId

  let accounts = val.data.map(account => {
            return{
                name: account.name,
                email: account.attributes!["e-mail"],
                manager: account.attributes!["manager"],
                uncorrelated: account.uncorrelated,
                source: account.sourceId //working
                sourceName: account.sourceName //not working <----------
             }

Looks like the list accounts endpoint has a documentation issue. It doesnā€™t list sourceName as a field that is returned by the API, but I just ran the endpoint and it does indeed return sourceName. Since the SDK is built from the spec, Iā€™ll have to fix the spec first. Once itā€™s fixed in the spec and the new SDK version is built, you should be able to upgrade your SDK and see sourceName in intellisense then.

2 Likes

Thanks for the quick response, Colin.
This will be really helpful. Please let us know once the spec is fixed. :slight_smile:

1 Like

Weā€™re excited that youā€™re using the SDK, Antony. I canā€™t wait to hear what you think and see what you build!

1 Like

@antony_petson The latest SDK version is live. It should now show sourceName in intellisense. sailpoint-api-client - npm

2 Likes

Great, thanks for the quick fix Colin.
Similarly externalId: source.connectorAttributes?.cloudExternalId is not working but cluster: source.cluster?.name is working just fine.

        let sources = val.data.map(source => {
            return{
                name: source.name,
                id: source.id,
                externalId: source.connectorAttributes?.cloudExternalId,
                connectionType:source.type,
                isAuthorative: source.authoritative,
                cluster: source.cluster?.name,
                threshold: source.deleteThreshold,
                status: source.status,
             }
        })

Appreciate your work! :slight_smile:
@derek_putnam I am starting with essential reports for audit team. Also, looking forward to build a dashboard to track our certification campaigns (for now, we are trying to build on Power BI but if SP has some recommendations or any OOTB in pipeline, that would be best)
Many Thanks,
Antony.

1 Like

@antony_petson connector attributes vary by source type, so we canā€™t feasibly model them in the API specification. This means the SDK will represent connectorAttributes as the type object, which doesnā€™t have any information about the properties that it could contain. If you ever come across a type of object in the SDK, you can quickly get past this by casting the property into a type of any and then manually specifying the path to the child property.

(source.connectorAttributes as any)['cloudExternalId']

You can see a full example below.

export const sources = async () => {
    let apiConfig = new Configuration()
    let api = new SourcesApi(apiConfig)

    const val = await Paginator.paginate(api, api.listSources, undefined, 250)

    let sources = val.data.map(source => {
        return {
            name: source.name,
            externalId: (source.connectorAttributes as any)['healthCheckTimeout']
        }
    })

    return sources
}
1 Like

Hi @colin_mckibben
I was trying to pull all the entitlements with tags using TaggedObjectsBetaApi and then finding the entitlements within the result as privileged or not.
I was able to get tagged object but while calling the EntitlementsBetaApi, I am getting

Function used

export const checkPriv = async(entId:any) => {
    let apiConfig = new Configuration()
    let apiEnt = new EntitlementsBetaApi(apiConfig)
    const val = await apiEnt.getEntitlement({id:entId})
    let priv = val.data.privileged
    console.log(priv,entId)
    return priv

Response

Paginating call, offset = 0
{
  tagName: [ 'SOX' ],
  objectId: 'abcfresponse5c5aedited6e898ec',
  privileged: Promise { <pending> },
  objectType: 'ENTITLEMENT'
}

However, console.log is giving correct value after few seconds of executing the code.