Planning Analytics

 View Only
  • 1.  Modify / Create Application entries through REST API

    Posted Fri October 25, 2019 08:56 AM
    @here I have got the following question in one of my support tickets
    *We would like to maintain application entries in PA through the REST API*

    Using the REST API we tested and are able to achieve the following:
    - Delete certain application entries
    - Create new Folders
    - Create and Update Workbooks
    - Create Links (URLs/ref. to external files)

    Additionally, we would like to create/update the following objects as application entries:
    - ProcessReference
    - ChoreReference
    - DimensionReference
    - SubsetReference
    - CubeReference
    - ViewReference

    As I wasn't able to find any documentation on this, could someone please provide us with example REST calls for this second block? Or let me know if that is documented somewhere?

    We are not asking how to create/update these PA objects. This is documented.
    We are asking how to create references to these objects in the application tree folders through the REST API.
    Using the client tools, you can publish views, processes, subsets, and other objects in the application tree.
    We want to maintain them using the REST API. -> Workbooks and external links are working, and we are looking for the rest :)

    Can someone help me out?

    ------------------------------
    Michael Ehrenberger
    ------------------------------

    #PlanningAnalyticswithWatson


  • 2.  RE: Modify / Create Application entries through REST API
    Best Answer

    Posted Tue October 29, 2019 02:53 AM
    All those xxxReference types inherit from the Entry base type. You should be able to use any of the reference types in all the same places as an Entry. Commonly, a Folder.Contents would be the container collection you could POSTPATCHDELETE to

    ------------------------------
    Michael Ehrenberger
    Technical Analyst
    IBM
    Vienna
    ------------------------------



  • 3.  RE: Modify / Create Application entries through REST API

    Posted Mon November 04, 2019 12:39 PM
    Hi Michael,

    Creating those reference entities is just the same as any other type of entity, with the exception perhaps, if you haven't created views for example, that you have to specify the type as well.

    So, using Planning Sample, if you wanted to add a reference to the "Budget Total Input" view from the plan_BudgetPlan cube into the "Planning Sample" folder under application you would POST using a URL similar to:

    http://tm1server:12555/api/v1/Contents('Applications')/Contents('Planning Sample')/Contents

    where the body would describe the 'Entry' you are trying to post to the contents of that folder, in this case, a 'ViewReference' as in:

    {
        "@odata.type":"tm1.ViewReference",
        "Name":"Reference to plan_BudgetPlan's Budget Input Total View",
        "View@odata.bind":"Cubes('plan_BudgetPlan')/Views('Budget Input Total')"
    }

    ------------------------------
    Hubert Heijkers
    ------------------------------



  • 4.  RE: Modify / Create Application entries through REST API

    Posted Mon November 11, 2019 09:45 AM
    Hi Tomasz,

    Please allow me to inject your follow up question here (no worries, I've had my fair share of struggles with this forum myself;-):

    ------------------------------
    ------------------------------

    First off all thank you for sharing reference creation example. This helped me to solve all object reference creation problems.
    The only outstanding issue is the modification/patching of the references.
    Is the renaming of references supported?

    The below PATCH request is not working for me. 
    https://tm1server:8030/api/v1/Contents('Applications')/Contents('Test')/Contents('somedim.dimension')


    Body:
    {
       "Name": "Test"
    }


    Response:


    {
       "error": {
          "code": "278",
          "message": "PATCH not supported on this resource!"
       }
    }
    ------------------------------------------------------------

    Had to quickly look it up but it indeed appears that we haven't implemented support for PATCH on these references just yet. Now keep in mind you'd never be able to change the Name property anyway as the Name property is the Key and key property, following the OData standard, are immutable. 
    As such only the referenced view (read: the View property), in case of a view reference, would have been the only editable property. I'm guessing you are the first to ask and that it was kind of assumed that in these cases references would be deleted and re-added to the containing folder again. I'm sure we'll add support for PATCH at some point in the future, allowing you just to edit the referenced entry, but for now deleting and re-adding would be the way the only way to accomplish changing the referenced entry I'm afraid.



    ------------------------------
    Hubert Heijkers
    ------------------------------



  • 5.  RE: Modify / Create Application entries through REST API

    Posted Mon November 11, 2019 09:54 AM
    Edited by System Fri January 20, 2023 04:38 PM


  • 6.  RE: Modify / Create Application entries through REST API

    Posted Mon November 11, 2019 09:57 AM
    Hi Hubert,

    thank you for sharing this example. This helped me to solve all object reference creation problems.
    The only outstanding issue is the modification/patching of the references.

    Is the renaming of references supported?

    DELETE works as expected, but the below PATCH request isn't working for me. 

    https://tm1server:8030/api/v1/Contents('Applications')/Contents('Planning Sample')/Contents('myDimension.dimension')
    
    Body:
    {
       "Name": "new name"
    }


    Response:
    {
        "error": {
            "code": "278",
            "message": "PATCH not supported on this resource!"
        }
    }


    ------------------------------
    Tomasz Brzoza
    ------------------------------



  • 7.  RE: Modify / Create Application entries through REST API

    Posted Mon November 11, 2019 05:01 PM
    Hi Tomasz,

    Seems your message showed up after all (This community software is even more of an enigma than anything I've ever used before;-), trust you've seen my response to your message above already;-!

    Cheers, -H

    ------------------------------
    Hubert Heijkers
    ------------------------------



  • 8.  RE: Modify / Create Application entries through REST API

    Posted Mon November 11, 2019 06:35 PM
    Hi Hubert,

    Yes, very strange behavior. Let's hope it happened because it was my very first post.

    Thank you once again for checking and explanations.
    It would be great if a limited PATCH could be implemented in the future.
    I can live with it, that the name cannot be changed as it is the key property, but the change of odata.bind for the below objects would be appreciated.

    • Process reference
    • View reference
    • Subset reference
    • Chore reference
    • External Link Reference

    In the actual implementation we will use the delete and recreate approach but the PATCH would look more "elegant" in the coding 😊.

    Cheers,
    Tomasz

    ------------------------------
    Tomasz Brzoza
    München
    +4915110934194
    ------------------------------



  • 9.  RE: Modify / Create Application entries through REST API

    Posted Mon November 11, 2019 09:57 AM
    Edited by System Fri January 20, 2023 04:12 PM