Service Operations Insight

 View Only
  • 1.  How to Get the Alert Definition (Version 2) using REST API

    Posted May 13, 2020 12:22 PM
    hello,

    we are facing issue while fetching alert from SOI using REST API. we are able to fetch v1 of alert definition but not v2. need your expertise in solving this.


    ------------------------------
    Senior Analyst
    HCL technologies
    Noida,India
    ------------------------------


  • 2.  RE: How to Get the Alert Definition (Version 2) using REST API

    Broadcom Employee
    Posted May 13, 2020 01:16 PM
    Hi Amit,
    Your update is not clear on what exactly you are getting in the REST response and what exactly you are expecting to see. I am guessing that you are not getting the userAttribute properties and their values. Here is an article to help you get the v2 definition
    https://ca-broadcomcsm.wolkenservicedesk.com/wolken/esd/knowledgebase_search?articleId=142073

    Thanks
    Shaheen


  • 3.  RE: How to Get the Alert Definition (Version 2) using REST API

    Posted May 14, 2020 03:56 AM
    HI Shaheen,


    I am not able access the KB article as i am getting below error message while accessing it.



    ------------------------------
    Senior Analyst
    HCL technologies
    Noida,India
    ------------------------------



  • 4.  RE: How to Get the Alert Definition (Version 2) using REST API
    Best Answer

    Broadcom Employee
    Posted May 14, 2020 09:23 AM
    Hi Amit,

    On the REST call header the "Content-Type" and "Accept" key should have value of "application/vnd.ca.soi.api.v2+xml" (see the screen shot below)

    Thanks
    Shaheen


  • 5.  RE: How to Get the Alert Definition (Version 2) using REST API

    Posted May 14, 2020 11:13 AM
    Hi Shaheen,


    i am using powershell to interact with SOI. when i use headers as you suggested i got below error.

    Invoke-RestMethod : Not AcceptableNot Acceptable
    At line:19 char:13
    + $getAlert = Invoke-RestMethod -Headers $head -Method GET 'https://cac ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand


    however when i don't use heders it is running perfectly fine.
    i am using below script.

    $head = @{"content-type" = "application/vnd.ca.soi.api.v2+xml";"Accept"="application/vnd.ca.soi.api.v2+xml" }
    $getAlert = Invoke-RestMethod -Headers $head -Method GET 'https://servername:7403/rest/alert' -Credential $SNowCreds
     



    ------------------------------
    Senior Analyst
    HCL technologies
    Noida,India
    ------------------------------



  • 6.  RE: How to Get the Alert Definition (Version 2) using REST API

    Broadcom Employee
    Posted May 14, 2020 11:25 AM
    Hi Amit,
    Use Postman or SOAP UI. I know it works because I have tested it.
    Thanks
    Shaheen


  • 7.  RE: How to Get the Alert Definition (Version 2) using REST API

    Posted May 14, 2020 11:58 AM
    is their a way that we can enable it from application side or powersheell. we are not allowed to use these 2 tools on client's servers. we can use powershell to do that. if you are aware of it please let me know.

    ------------------------------
    Senior Analyst
    HCL technologies
    Noida,India
    ------------------------------



  • 8.  RE: How to Get the Alert Definition (Version 2) using REST API

    Broadcom Employee
    Posted May 14, 2020 03:01 PM
    Hi Amit,
    Sorry I can't help you with your powershell script!!
    Thanks
    Shaheen