How to get the model size using the API?

Options

I'm currently using the Anaplan API with the Anaplan Client to send and receive API requests. I wanted to get the size of all the models and this is the code I am using:

set Operation=-debug -service %ServiceUrl% -auth %AuthUrl% -models

Output :

Now, the output is displayed directly in cmd. Is there any way to get the output directly as a text file instead?

I understand there is a way to get the whole output in a file then cleanup the file to get the desired output but it seems a bit much, is there any other alternative?

Answers

  • alexpavel
    Options

    @ahemantthere : all the Anaplan Connect commands that you can see on the screen can be directed to be saved in a file. It is a batch command (not Anaplan Connect command) and depends of the operating system usually using " >" character.

    As REST API: there is also the datapoint https://us1a.app.anaplan.com/2/0/models?modelDetails=true

    It returns in JSON format all the models of the default Tenant of the user and contains also the model size in the columns.

    Hope it helps

    Alex

  • Hey @alexpavel,

    Thanks for the response. I saved the output of the anaplan connect command in a file and this is what I get:

    Using Class-Path: C:\Users\ahemantthere\Documents\Anaplan API\anaplan-connect-4.2.1-jar-with-dependencies.jar
    2024-06-24 15:48:24 DEBUG [c.a.client.Program :2322 ] 25844 |-- ======================================================================
    2024-06-24 15:48:24 DEBUG [c.a.client.Program :2323 ] 25844 |-- Anaplan Connect 4.2.1
    2024-06-24 15:48:24 DEBUG [c.a.client.Program :2325 ] 25844 |-- Java HotSpot(TM) Client VM (Oracle Corporation)/ (25.411-b25)/ 1.8.0_411
    2024-06-24 15:48:24 DEBUG [c.a.client.Program :2328 ] 25844 |-- (Windows 10x86)/10.0
    2024-06-24 15:48:24 DEBUG [c.a.client.Program :2331 ] 25844 |-- ======================================================================
    2024-06-24 15:48:26 INFO [c.a.client.Service :102 ] 25844 |-- Initializing Service...
    2024-06-24 15:48:26 INFO [a.BasicAuthenticator:24 ] 25844 |-- Authenticating via Basic...
    2024-06-24 15:48:31 INFO [c.a.client.Program :265 ] 25844 |-- WS_ID WS_NAME WS_ALLOCATED_SIZE WS_SIZE

    I used the '>' operator after calling Anaplan Client. Have pasted the code below:

    @echo off
    setlocal enabledelayedexpansion

    set AnaplanUser=""
    set WorkspaceId=""
    set ModelId=""
    set ServiceUrl="https://api.anaplan.com"
    set AuthUrl="https://auth.anaplan.com"
    set Chunksize=1

    set Operation=-debug -service %ServiceUrl% -auth %AuthUrl% -models

    rem *** End of settings - Do not edit below this line ***

    setlocal enableextensions enabledelayedexpansion || exit /b 1
    cd %~dp0
    if not %AnaplanUser% == "" set Credentials=-user %AnaplanUser%
    set Command=..\..\..\AnaplanClient.bat %Credentials% %Operation%

    cmd /c %Command% > dump.txt

    endlocal
    pause

    I am not using curl as while authenticating, it is giving me as unauthorized user even though I am an integration admin, hence I would like to go with the Anaplan Connect approach, but kindly suggest me if there is another way, or if curl is the way to go.