Understanding the APIs of Anaplan particulary using the Upload API from http client

Options
DivyaHabin
DivyaHabin Member, ALL USERS Posts: 3 New Contributor

I am looking to integrate Oracle SOA with Anaplan, specifically my requirement is to feed data from a Oracle SOA BPEL to Anaplan.

I have gone through the Anaplan API documentation and looking to use Upload and Import APIs.Approach I am planning to follow is write the content from Oracle SOA to a file and then upload that file to the Anaplan server.I have created a sample file from the Anaplan UI.

My questions are:

1.Is it possible to use these APIs from http client, to start with I am testing these APIs using Postman.I could call the Get File ID API to get the file Id of the sample file I have created in Anaplan.But I am not successful in executing  the Upload API to upload the file from local.

2.How to specify the local file path in the Upload API.As I see the format of the API as 'https://api.anaplan.com/1/3/workspaces/workspaceID/models/modelID/files/fileId --upload-file Tests.txt' , how can the upload file name can be specified like this  --upload-file Tests.txt from http client. If I run it, I get error 

<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>
</div>

 

Please help in getting this implemented.

Comments

  • DivyaHabin
    DivyaHabin Member, ALL USERS Posts: 3 New Contributor

    Thanks Nathan for the response.

     

    The link you shared for the incorporated webclient is taking me to the API that lists the workspace ID and not to the information about the webclient.

     

    As I have a little knoweldge about Anaplan and the scripts, I am assuming from your response that when we send the Upload request from Postman, the https://api.anaplan.com/1/3/workspaces/workspaceID/models/modelID/files/fileId  has to be called with the content of file added in some format in the body.

    I would be great if you can share me a sample script which send the content(in the expected format) as the body of the request

     

    Thanks,

    Divya

  • DivyaHabin
    DivyaHabin Member, ALL USERS Posts: 3 New Contributor

    I am currently using Postman to try out these APIs.I have the valid workspace Id and Model ID and using which I could call the GetFileID API and I could see the fileID of the file I am looking to upload.

    As you mentioned ' The body of the request must contain the content you want to upload', this is what I am not clear with, should the file be send as attchment to the Upload API(PUT operation) or if the content has to be in the body what should be the content type and the format of the content.

    As Nathan suggested, I tried to paste the content in body but it threw htpp 415 error, Unsupported Media Type.

     

    Thanks,

    Divya

  • henri.latvanen
    henri.latvanen Member, ALL USERS, Partner Posts: 5 Occasional Contributor

    With binary I got:

    404404

  • henri.latvanen
    henri.latvanen Member, ALL USERS, Partner Posts: 5 Occasional Contributor

    Hi,

     

    aah, you are very perspicacious. So the 112's are Imports and 113's are files. 

    Now I have probably uploaded the file. Next I'll try to import it

    Postman3.JPG

     

     

  • henri.latvanen
    henri.latvanen Member, ALL USERS, Partner Posts: 5 Occasional Contributor

    Hi,

     

    Now the whole path works! To document whole path, here is the Import task. That went trough without any complications. Thank you @ben_speight

      ImportImport