I have used the scripts set out here: Solved: API Python Workspace and Model IDs - Anaplan Community to successfully extract a basic model and workspace list. Thanks to @abhay.kanik for the good start.
I have added the ?modelDetails=true switch to the Model JSON so the API send more details about models. The JSON then contains the following information:
'id' |
'name' |
'activeState' |
'lastSavedSerialNumber' |
'lastModifiedByUserGuid' |
'memoryUsage' |
'currentWorkspaceId' |
'currentWorkspaceName' |
'modelUrl' |
'categoryValues' |
'isoCreationDate' |
'lastModified' |
I can refer to and extract lastModified and ActiveState with no issues. However, when I try to include the model 'memoryUsage' in my export Python returns a "KeyError".
The code I have modified is:
for mdl in model_json['models']:
model_writer.writerow(['{}'.format(mdl['id']), '{}'.format(mdl['name']), '{}'.format(mdl['activeState']), '{}'.format(mdl['memoryUsage']), '{}'.format(mdl['lastModified']), '{}'.format(wsp['id']),'{}'.format(wsp['name'])])
If I remove the memory usage request the script runs fine and gives me the other results.
Any suggestions on what I may be doing wrong here?