How to Dimension ID and Item ID ?

Hi Team , 

 

I'm trying to get Subsidiary module data in a CSV using below API.

 

How to get Dimension ID and Item ID

 

 

API Used :

curl -X GET 'https://api.anaplan.com/2/0/models/{modelId}/views/{viewId}/data?pages=dimensionId:itemId&format=v1&exportType={TABULAR_SINGLE_COLUMN}&moduleId={moduleId}' \ -H 'Authorization: AnaplanAuthToken {anaplan_auth_token}' \ -H 'Accept: text/csv'

 

Can you guys help me to get the Dimension and Item ID

 

Regards,

Vinoth Kumar K.

Answers

  • Have you looked in the apiary? 

    https://anaplanbulkapi20.docs.apiary.io/

     

    For view metadata you could use: 

    curl -X GET 'https://api.anaplan.com/2/0/models/{modelId}/views/{viewId}' \ -H 'Authorization: AnaplanAuthToken {anaplan_auth_token}'\ -H 'Accept: application/json'

     

    For dimension ID you could also use: 

    curl -X GET 'https://api.anaplan.com/2/0/workspaces/{workspaceId}/models/{modelId}/lists' \ -H 'Accept: application/json' \ -H 'Authorization: AnaplanAuthToken {anaplan_auth_token}'

     

    Then for item ID:

    curl -X GET 'https://api.anaplan.com/2/0/workspaces/{workspaceId}/models/{modelId}/lists/{listId}/items?includeAll=true' \ -H 'Accept: application/json' \ -H 'Authorization: AnaplanAuthToken {anaplan_auth_token}'

     

    or 

     

    curl -X GET 'https://api.anaplan.com/2/0/workspaces/{workspaceId}/models/{modelId}/lists/{listId}/items?includeAll=true' \ -H 'Accept: text/csv' \ -H 'Authorization: AnaplanAuthToken {anaplan_auth_token}'

     

    You could also try using postman for doing the API development / testing.

     

    Hope this helps!

    Kind regards,

    Steven

  • By the way, the ?pages part is only used if you want a specific page to be exported, so it's not mandatory to add it. So it is only needed if you want to have a certain item selected from the pages of the view. My previous comment is based on the situation that you do not have line items in the pages. If you do you have to use another API call to get the line item ID.
    Kr,
    Steven

  • Hi @StevenBeerthuizen ,

     

    I'm planning to export subsidiary module data in CSV.

    VinothKumar91_0-1666208036059.png

    Can you please help me to export data in CSV (Using Rest API)

     

    thanks in advance 🙂

     

    Regards,

    Vinoth Kumar K.

     

  • Hi @StevenBeerthuizen ,

     

    I used below API to get the View ID of the Subsidiary Module.

     

    https://api.anaplan.com/2/0/models/{modelId}/views?includesubsidiaryviews=true

     

    Screenshot Attached :

    VinothKumar91_0-1666209175854.png

     

    How can i download "Tec Dev Caso 0" Subsidiary Module Data in CSV.

     

    Regards,

    Vinoth Kumar K.

     

    Regards,

    Vinoth Kumar 

     

  • It depends on the size, but if it is less than 1000000 cells, the apiary says the following: 

     

    • You can replace the viewId with any valid lineItemId. If the line item has a subsidiary view, the response returns the data as seen in that subsidiary view.

    curl -X GET 'https://api.anaplan.com/2/0/models/{modelId}/views/{viewId}/data?pages=dimensionId:itemId&format=v1&exportType={TABULAR_SINGLE_COLUMN}&moduleId={moduleId}' \ -H 'Authorization: AnaplanAuthToken {anaplan_auth_token}' \ -H 'Accept: text/csv'

     

    And to get the lineitem id for Tec dev caso 0 you should use: 

    curl -X GET 'https://api.anaplan.com/2/0/models/{modelId}/modules/{moduleId}/lineItems' \ -H 'Authorization: AnaplanAuthToken {anaplan_auth_token}' \ -H 'Accept: application/json'

     

    Let me know if this works.

    Kind regards,

    Steven

  • Hi @StevenBeerthuizen ,

     

    Thanks for the reply.

    I get below response , when I use the API shared by you.

     

    VinothKumar91_0-1666246034883.png

     

    Regards,

    Vinoth Kumar K.

     

  • So again, if you are not using the pages, then let it out of your API call.....

     

    curl -X GET 'https://api.anaplan.com/2/0/models/{modelId}/views/{viewId=your line item id}/data?format=v1&exportType={TABULAR_SINGLE_COLUMN}&moduleId={moduleId}' \ -H 'Authorization: AnaplanAuthToken {anaplan_auth_token}' \ -H 'Accept: text/csv'

  • @VinothKumar91 Did you manage to get it working? Would be nice to know the outcome so other users might also benefit.

    Kr,

    Steven

  • Hi @StevenBeerthuizen 


    can we use the request header Accept: text/csv;escaped=true, i read in article that in some cases it throws error for the request header Accept: text/csv.

     

     

    curl -X GET 'https://api.anaplan.com/2/0/models/{modelId}/views/{viewId}/data?pages=dimensionId:itemId&format=v1&exportType={TABULAR_SINGLE_COLUMN}&moduleId={moduleId}' \ -H 'Authorization: AnaplanAuthToken {anaplan_auth_token}' \ -H 'Accept: text/csv;escaped=true'

     

    I am relatively new to this Anaplan API, I just want to know that after using these cURL to get the data, either by bulk api or transactional api through postman, how are we going to automate it by scheduler? what are the scheduler we can use to automate it?

     

    Thanks,
    Manjunath

  • Hi Manjunath,

    I guess you can indeed use the escaped=true.

     

    For automation you can probably use various solutions, but I use Power Automate. You can do the API call and use the response for further actions and it can also be scheduled. It might require additional licenses to use Power Automate though.

     

    Kind regards,

    Steven