Disable Optimization on aggregation / correlation - Does this Python logic look correct?

I tried testing this on an AD connector but didn’t find a way to confirm that the setting took place. My lab doesn’t currently have a non-csv based authoritative system.

How do I confirm that aggregation is not optimized on a source?
Once I do set it on the right source, do I need to remove it afterwards by setting it to false?

Below is an example of code to run, the URL includes the 5 digit source ID.

import requests
import json


# Connection specific configuration
client_id = ""
client_secret = ""
base_url = f"https://example.api.identitynow.com"
url = f"{base_url}//cc/api/source/loadAccounts/21859"

# Get an access token
auth_url = f"{base_url}/oauth/token"
auth_data = {
    "grant_type": "client_credentials",
    "client_id": client_id,
    "client_secret": client_secret,
}
auth_response = requests.post(auth_url, data=auth_data)
print(auth_response)

#Extract the access token from the response
access_token = auth_response.json()["access_token"]
print(access_token)

# Payload 
payload = "disableOptimization=true"

headers = {
    'Authorization': f'Bearer {access_token}',
	'Content-Type': 'application/json'
}

response = requests.request("POST",url, headers=headers, data=payload)

if response.status_code == 200:
    data = response.json()
  
else:
    print(f"Request for sources failed with status code: {response.status_code}")
    print("Response content:", response.text)

Your request is configured with Content-Type application/json, but your body is not JSON.
Try using this for your payload instead:

payload = '{"disableOptimization":true}'

You can confirm that it worked by checking that the aggregation entry in the UI contains the following after the aggregation is completed:
image

I modified the payload line to: payload = '{"disableOptimization":=true}'

I don’t get an error, but I still don’t see Optimization as being disabled.

You’ll need to remove that = and just have the : in your payload, if that wasn’t a copy/paste error.

1 Like

Thanks Nathan! That worked.

Any ideas on why manager correlation would not have worked? We didn’t actually change a value, but the manager didn’t correlate. All other managers correlated previously.

do we actually have to change the manager id in the source in order for correlations to work?

I haven’t had any issues with manager correlation in the past, but I frequently use optimization disabled aggregations to reevaluate account correlation. You could try this on your authoritative source to see if it reevaluates manager correlation.

Yeah, I was hoping it would fix it.

I have a few users that wouldn’t correlate. My assumption is that the manager employee ID was possibly populated before the manager was populated in the system. The manager went from a contractor to an employee.

It looks like if the correlation doesn’t work, it will keep a null value or the same manager they had. Currently my only thought is that if it requires a change for HR to change them to a different manager, aggregate and then change them back and aggregate again.

As it is not a delimited text connector, I don’t see a way to change the manager ID value through API on the source account value within IDN.

Hi Fred, You might be interested in this python library:

If you have questions, email the author, and I will be happy to respond. :slight_smile:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.