CA Service Management

 View Only
  • 1.  How to delete records via REST API

    Posted Sep 17, 2020 04:43 PM
    hello,

    it is easy to connect to nr objects via rest api calls to a parent-child relation with new records in the hier object. does anybody know a reason why it is not possible to delete this relationship via rest api call. what is the point of not allowing this method via the api. I think: half an API is not a whole API. it is only an unfinished api, isn't it?

    If i look at the documentation in https://techdocs.broadcom.com/us/en/ca-enterprise-software/business-management/ca-service-management/17-2/reference/ca-service-desk-manager-reference-commands/objects-and-attributes.html allowed operations for any objects are: CREATE, READ and UPDATE .... no DELETE

    best regards from germany
    Oliver

    ------------------------------
    Devops Engineer
    Sycor GmbH
    ------------------------------


  • 2.  RE: How to delete records via REST API

    Posted Sep 18, 2020 10:10 AM
    It IS an unfinished API. 

    Another example:

    Enable adding custom description to activity log created by updating a ticket through the REST API

    J.W.

    ------------------------------
    "No matter where you go, there you are." - TAoBB:AtED
    ------------------------------



  • 3.  RE: How to delete records via REST API

    Posted Sep 21, 2020 01:36 AM
    Hi Oliver.
    Have you tried to add the DELETE Rest Operation to the hier factory definition?
    Regards.
    ....Michael

    ------------------------------
    Principal Services Consultant
    HCL Enterprise Studio
    Germany
    ------------------------------



  • 4.  RE: How to delete records via REST API

    Broadcom Employee
    Posted Sep 21, 2020 02:20 AM
    Hi Oliver,

    According to the below link, there is a DELETE operation from a REST API perspective for SOME objects:

    https://techdocs.broadcom.com/us/en/ca-enterprise-software/business-management/ca-service-management/17-2/using/rest-api.html



    Then the following link mentions that you CANNOT add the DELETE operation to any default object :-(

    https://techdocs.broadcom.com/us/en/ca-enterprise-software/business-management/ca-service-management/17-2/reference/ca-service-desk-manager-reference-commands/technical-reference/rest-http-methods.html

    REST API - Delete Operation



    ------------------------------
    Kind Regards,
    Brian
    ------------------------------



  • 5.  RE: How to delete records via REST API

    Posted Sep 23, 2020 07:16 AM
    Hi Oliver.
    Still struggeling with this challenge?
    In SDM, you can specify which of the REST CRUD operations are allowed per factory.
    For the hier factory , by default , only CREATE , READ, and UPDATE are allowed.
    Well, at least in my understanding, this is a misssing, incomplete default settings.
    I just added a 
    MODIFY FACTORY hier REST_OPERATIONS "CREATE READ UPDATE DELETE";
    to a site/mods/majic/*.mod file and restarted the service
    After this change , I was able to delete hier records through REST.
    Let us know your progress.
    Regards
    ....Michael

    ------------------------------
    Principal Services Consultant
    HCL Enterprise Studio
    Germany
    ------------------------------



  • 6.  RE: How to delete records via REST API

    Posted Sep 25, 2020 03:01 AM
    Hi Micheal,

    Thank you very much for your advice, unfortunately I am not the administrator of the SDM and have to wait if and when my colleagues can make this change. I'll get back to you when I can test it.

    Do you know any reason why it is not allowed by default?

    Regards
    Oliver

    ------------------------------
    Devops Engineer
    Sycor GmbH
    ------------------------------



  • 7.  RE: How to delete records via REST API
    Best Answer

    Posted Sep 27, 2020 09:40 AM
    Edited by Oliver Gaida Sep 28, 2020 04:14 PM
    Hi Oliver.
    Well, a reason...
    I can only assume:
    In general, it is not a common procedure to delete records in sdm, of course with some exceptions...
    Normally you just inactivate records.
    But sure, especially regarding those n-m relationships,  you might think, deletion is an appropriate data change, as a relationship between ci's either exists or not.
    The hier factory, in my understanding is an old way to handle these kind of relationships .
    Nowadays I would suggest to use bmhier instead. They have an additional relationship type attribute. They can be deleted through REST by default, and also be inactivated (set delete_flag=1 ,keeping the history ;) ). Additionally, they get displayed in the CMDB Visualizer. And changes are tracked in the CI versioning !
    The hier factory has no active flag. That means the only way to go, is to delete them .
    I assume it was just forgotten to make the DELETE operation available. 
    Just my 2 cents.

    Beste Grüße aus Köln.

    ....Michael 


    ------------------------------
    Principal Services Consultant
    HCL Enterprise Studio
    Germany
    ------------------------------