1. Data integration
  2. Anaplan API Guide and Reference
  3. Use the bulk APIs
  4. Perform an import action
  5. Upload a text or CSV file
  6. Set the chunk count

When you import a file in chunks, you need to tell the API what to expect in terms of the number of chunks in a file.

We recommend you set the chunk count to -1 rather than specify the exact count. You will later send a call to mark the upload as complete.  This API call requires the file ID you obtained in the Get the list of files step.

Method and endpoint

https://api.anaplan.com/2/0/workspaces/{workspaceID}/models/{modelID}/files/{fileID}

POST

Parameters

ParameterDescription
AnaplanAuthToken:{token}Your Anaplan authentication token value.
content typeSet to Content-Type:application/json
fileIDThe file ID obtained previously.
file nameThe name of the file.
chunkCountThe number of chunks in the file.  Set to -1.
firstDataRowThe first data row in the file.  If the first data row in your file is the second row (other than the header), set to '2'.
headerRowThe header row in the file.  If the first line in your file is the header row, set this to '1'.

Curl example

curl -X POST \
https://api.anaplan.com/2/0/workspaces/{workspaceId}/models/{modelId}/files/{fileId} \
-H 'Authorization: AnaplanAuthToken auth_token' \
-H 'Content-Type: application/json' \
-d '{"chunkCount":1}'

Response

{

   "meta":{

      "schema":"https://api.anaplan.com/2/0/models/F1111111C11111111B11111F1111E11F/objects/file"

   },

   "status":{

      "code":200,

      "message":"Success"

   },

   "file":{

      "id":"113000000000",

      "name":"Organization.txt",

      "chunkCount":0,

      "delimiter":"\"",

      "encoding":"ISO-8859-1",

      "firstDataRow":2,

      "format":"txt",

      "headerRow":1,

      "separator":"\t"

   }

}