Import using Python api insert not happening only update

Hello Team,

I am trying to import csv data into Anaplan using API 2. but whenever I import new data is not being inserted 

old values are being updated correctly. 

When I import new data using browser it works perfect.

 

dataFile = open(data.csv, 'r').read().encode('utf-8')
fileUpload = requests.put(uploadURL = ("https://api.anaplan.com/2/0/workspaces/" + {WorkspaceID} + "/models/" + {ModelID}+ "/" + f'files/{fileData["id"]}'), headers=getputHeaders(), data=(dataFile),proxies= configs.proxies)

postImport = requests.post(

"https://api.anaplan.com/2/0/workspaces/" + {WorkspaceID} + "/models/" + {ModelID}+ "/" + f'imports/' + d['anaplanparameters']['importid'] + '/tasks' , headers=postHeaders, data=json.dumps({'localeName': 'en_US'}),proxies= configs.proxies)

 

Above code update old data properly but doesn't insert new data in Anaplan

Answers

  • Hi there,

     

    You might want to check your import definition to see if there's missing mapping especially with the new data. Perhaps new list members that were not yet added before updating the module data. Also ensure that you run a process in the sequence that runs the actions which will add new list members before updating the module data.

     

    Hope that helps.