Getting an error when trying to run an Import Action using Python3



I’m new to Anaplan and am trying to automate the process of refreshing data from a file that has been previously uploaded and imported to a module.

I’m referring to the Apiary and this github repo

I’ve created a certificate file and am able to connect to Anaplan and do things like getting a list of all workspaces, models, files, actions, etc. However, I get an error (404) when I try to run the action of importing a file. Following is the code snippet:

url = (f'{wGuid}/models/{mGuid}/' +



action =, data='{"localeName": "en_US"}', headers=postHeaders)


print('Action status code: ' + str(action.status_code))

with open('postAction.json', 'wb') as f:



Following is the response returned b yAnaplan:

<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width = 960">
<link rel="shortcut icon" href="lib/anaplan/themes/original/images/favicon.ico">
<style type="text/css">
@import "lib/dojo/resources/dojo.css";
html {
overflow: auto;
<div id="pageWrap" class="pageWrap">
<div class="banner"><h1>An error has occurred whilst processing your request:</h1></div>

<div><pre class="original">Not Found</pre></div>
<div>Please close your browser window and try again.</div>
<div>If the problem persists then please contact Anaplan Support.</div>

Has anyone else faced this kind of issue? Any pointers on troubleshooting this error would be greatly appreciated.

Best Answer

  • ben_speight
    Answer ✓

    If you're running an import the correct endpoint to use is


    . You need to substitute your workspace Id, model Id and import Id for {workspaceId}, {modelId} and {importId} respectively. You can get the Ids by querying the API (eg /1/3/workspaces, .../models, .../imports).


  • Thank you so much for this. I was into this issue and tired to tinker around to check if its possible but couldnt get it done. Now that i have seen the way you did it, thanks guys with regards