Public/Find-IAMCoreConnectorDataObject.ps1

function Find-IAMCoreConnectorDataObject {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [ValidatePattern("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")] # Is a guid connector object id
        [String] $ConnectorId,

        [Parameter(Mandatory = $true)]
        [String] $ConnectorObjectType,

        [Parameter(Mandatory = $false)]
        [String] $SearchValue
    )

    if (-not $Script:APIRoot -or -not $Script:AccessTokenProfile) {
        throw "Not connected to IAM Core. Please run Connect-IAMCore first."
    }

    $Result = Invoke-RestMethod -Uri "$Script:APIRoot/sync/connectors/$($ConnectorId)/data/search?value=$($SearchValue)&objectType=$($ConnectorObjectType)" -Headers (Get-IAMCoreHeader)

    if ($Result.IsSuccess) {
        return $Result.Data
    }
    else {
        throw "Failed to get IAM Core connector: $($Result.ErrorMessage)"
    }
}