Error during API call to upload new csv files for Delimited File sources

Hello Collin,

Thanks a lot, seems it’s working correctly !
Do you know if it is possible to disable the account deletion threshold through this API call ?

Regards

Try this:

import requests

url = "https://{tenant}.api.identitynow.com/cc/api/source/loadAccounts/{sourceId}"

payload={}
files=[
  ('file',('employees.csv',open('/path/to/employees.csv','rb'),'text/csv'))
]
headers = {
  'Authorization': 'Bearer {token}'
}

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

print(response.text)
1 Like

Hello,

This solution was working correctly but since yesterday, I’m not able to make it work. I am getting the following error :

{'msg_template': 'status code: 500, reason phrase: Internal Server Error', 'slpt_error_code': 'SLPT-1009', 'formatted_msg': 'status code: 500, reason phrase: Internal Server Error', 'exception_id': '18779CCE567', 'error_code': 1009, 'exception_class': 'groovyx.net.http.HttpResponseException', 'exception_detail': {'file': 'RESTClient.java', 'method': 'defaultFailureHandler', 'line_number': 240, 'class': 'groovyx.net.http.RESTClient'}, 'http_response_code': 500, 'timestamp': '2023-04-13 08:48:03.943', 'exception_message': 'status code: 500, reason phrase: Internal Server Error'}

Regarding my function, it is :

print("Aggregation des comptes dans IdentityNow")
    identifiant = get_source_id_by_name(tenant_id, token, "Source Name")
    url = "https://" + tenant_id + ".identitynow.com/cc/api/source/loadAccounts/" + identifiant
    payload={}
    files=[
      ('file',('accounts.csv',open(account_file,'rb'),'text/csv'))
    ]
    headers = {
      'Authorization': 'Bearer ' + token
    }
    print(url)
    print(files)
    r = requests.request("POST", url, headers=headers, data=payload, files=files, verify=False)
    return json.loads(r.text)

Do you have any idea of why I’m getting this error ?

Has anything about the source or the file you are uploading changed? Are you attempting to delete more accounts than the threshold allows?

Hello,

Finally it was an issue on the rights of our service account.

So solution is working !

Regards