9 Replies Latest reply on Jul 13, 2017 5:25 AM by Sayan Roy

    Retrieving information about the services running in the resource list of CLM UI

    Sayan Roy

      Hi

       

      Can someone help me what would be the POST API (URL and the body) to fetch the information about the list of services running under Resource List of CLM UI? I want to retrieve HTTP response to this POST request that includes the JSON response for the list of current running services which are provisioned from the CLM UI.

       

      Thanks in advance.

       

      Regards,

      Sayan

        • 2. Re: Retrieving information about the services running in the resource list of CLM UI
          Sayan Roy

          Thanks Manoj very much. This gives what I need. 

           

          But I need one more question. How would the REST URI look like if I need to get the information of only the names of ServiceOfferingInstances? I mean the JSON response would be just the names of services.

          • 3. Re: Retrieving information about the services running in the resource list of CLM UI
            Rahul Wagh..

            Sayan Roy can you please let us know what exactly that you are trying to achieve from this ??

            As we have some filter criteria where you can filter out on the basis on "Hostname Prefix",..

             

            Thanks,

            Rahul

            • 4. Re: Retrieving information about the services running in the resource list of CLM UI
              Phil Betts

              You can have a json like this in the body of the POST call to /csm/serviceofferinginstance/search:

               

              {

                "callbackURL":"",

                "operationParams":[

                  {

                    "multiplicity":"1",

                    "name":"fillFields",

                    "type":"java.lang.String",

                    "value":"name"

                  }

                ],

                "postCallout":"",

                "preCallout":"",

                "timeout":-1

              }

               

              This will reduce the fields returned to include only the name and a couple of other standard fields....You can also modify the value to start traversing the relationships...so for example you could make a call to /csm/serviceofferinginstance/search with the following json:

               

              {

                "callbackURL":"",

                "operationParams":[

                  {

                    "multiplicity":"1",

                    "name":"fillFields",

                    "type":"java.lang.String",

                    "value":"name,resourceSets.compute.name"

                  }

                ],

                "postCallout":"",

                "preCallout":"",

                "timeout":-1

              }

               

              ...and this will return the name of each SOI and also the name of each computecontainer in that SOI.....so you only need to make one call and not multiple ones....

              • 5. Re: Retrieving information about the services running in the resource list of CLM UI
                Sayan Roy

                Hi Rahul,

                 

                What I am trying to achieve is, use these API calls to feed in the basic details of each running SOIs into a csv file using AO. My logic was if I could do a first POST API call to fetch just the names of SOIs like "service1", "service2" ...etc. Then for each SOI name I would run a for loop to do one more API call which would return me the values of common fields like - owner, status, location, resources, provisioned date etc. 

                Now why I want to granulate this because the normal API call for  http://10.203.60.188:8080/csm/ServiceOfferingInstance/search without any body, gives me a huge JSON response which includes big values of provisionedDeployementModel etc which I don't want to capture. Even the transformation is becoming hugely complex in AO side.

                 

                I could achieve similar using the CLM Python SDK . But I wanted to know if there was a way to do so using the APIs.

                 

                Regards,

                Sayan

                 

                • 6. Re: Retrieving information about the services running in the resource list of CLM UI
                  Phil Betts

                  Hopefully the fillfields json above will give you what you want....just add in all the fields you want (comma separated) to the value

                  • 7. Re: Retrieving information about the services running in the resource list of CLM UI
                    Sayan Roy

                    Hello Phill,

                     

                    Firstly, thank you so much for this solution. It does give some filtered data as response, but not as I am looking for.  Is there a way I get the values of just specific fields, like name, isMonitoringEnabled, owner, provisionDate. I tried to pass these in array form like .. "value": ["name","isMonitoringEnabled","owner","provisionDate"] . Didn't work.

                     

                    I tried your way too, like .. "value":"name,isMonitoringEnabled,owner,provisionDate" . Didn't work either.

                     

                    Regards,

                    Sayan

                    • 8. Re: Retrieving information about the services running in the resource list of CLM UI
                      Phil Betts

                      Hi Sayan

                       

                      So I have just tried in my environment....if i leave the body of the post call blank, and run against /csm/serviceofferinginstance/search i get a response like this for one of my SOIs:

                       

                      [{

                        "cloudClass" : "com.bmc.cloud.model.beans.SearchResults",

                        "guid" : "146e345f-cdd3-492a-b597-d0804d4a647e",

                        "pageNo" : 0,

                        "pageSize" : 0,

                        "results" : [ {

                          "cloudClass" : "com.bmc.cloud.model.beans.ServiceOfferingInstance",

                          "blueprintReference" : "/blueprintreference/7fb783fb-8862-4949-9163-01c411545ba4",

                          "contractLine" : "/contractline/57560a85-477b-4ef9-8e2b-d88b243238e5",

                          "deploymentModel" : "/deploymentmodel/65fbe4d0-0080-4050-ae6b-9d2502db7352",

                          "deploymentParameterValue" : [ ],

                          "description" : " ",

                          "functionalComponents" : [ "/functionalcomponent/09469b83-e10a-44e4-9207-2fe134dfcd27" ],

                          "functionalModel" : "/functionalmodel/ae4bf535-2963-43ce-9ac2-bea6483cf7df",

                          "guid" : "1d38af3f-db89-4673-996f-cf5d3594cefe",

                          "hostnamePrefix" : "Dictu",

                          "isMonitoringEnabled" : false,

                          "isMonitoringPoliciesEnabled" : false,

                          "isOpsEvalEnabled" : false,

                          "modifiedDate" : 1488357474000,

                          "name" : "Post 4.6 upgrade Windows-1",

                          "owner" : "CloudAdmin",

                          "provisionDate" : 1488292348000,

                          "provisionedDeploymentModel" : "<removed this bit as its massive>",

                          "reconciliationID" : "OI-cde22d708e0a494b8c047f23388ef40c",

                          "resourceSets" : [ "/resourceset/91640f04-d168-40fe-9207-3c0685dcf6e4" ],

                          "serviceOfferingContractLine" : "/serviceofferingcontractline/57560a85-477b-4ef9-8e2b-d88b243238e5",

                          "serviceRequest" : "/servicerequest/645d92d0-a761-4067-8f7a-9dfe6c3c0f25",

                          "state" : "Running",

                          "tags" : [ {

                            "cloudClass" : "com.bmc.cloud.model.beans.Tag",

                            "guid" : "666207af-acb3-404f-a45b-e2cde388508c",

                            "label" : "Austin Environment",

                            "modifiedDate" : 1462796502000,

                            "name" : "Austin Environment",

                            "tagGroup" : {

                              "cloudClass" : "com.bmc.cloud.model.beans.TagGroup",

                              "guid" : "33a2fb30-9f37-452e-aec4-c2f9999d3f97",

                              "modifiedDate" : 1462796501000,

                              "name" : "QS_Environments",

                              "ownedTags" : [ "/tag/Austin Environment" ],

                              "tagScope" : "User_Defined"

                            },

                            "tagGroupObject" : {

                              "cloudClass" : "com.bmc.cloud.model.beans.TagGroup",

                              "description" : "@circular-reference-placeholder@",

                              "guid" : "33a2fb30-9f37-452e-aec4-c2f9999d3f97",

                              "tagScope" : "User_Defined"

                            }

                          } ],

                          "tenant" : "/organization/ORHAA5V0GEYXWANCZ6MFMET76WEHMQ",

                          "tokenID" : "1d38af3f-db89-4673-996f-cf5d3594cefe"

                        }

                       

                      ...like you say...really big ....if i now use the following json in the body of the POST call:

                       

                      {

                        "callbackURL":"",

                        "operationParams":[

                          {

                            "multiplicity":"1",

                            "name":"fillFields",

                            "type":"java.lang.String",

                            "value":"name,isMonitoringEnabled,owner,provisionDate"

                          }

                        ],

                        "postCallout":"",

                        "preCallout":"",

                        "timeout":-1

                      }

                       

                       

                      ...i get the response:

                      [{

                        "cloudClass" : "com.bmc.cloud.model.beans.SearchResults",

                        "guid" : "efea8e7b-5116-46bf-8c04-3c7fd4514aa4",

                        "pageNo" : 0,

                        "pageSize" : 0,

                        "results" : [ {

                          "cloudClass" : "com.bmc.cloud.model.beans.ServiceOfferingInstance",

                          "guid" : "1d38af3f-db89-4673-996f-cf5d3594cefe",

                          "isMonitoringEnabled" : false,

                          "isMonitoringPoliciesEnabled" : false,

                          "isOpsEvalEnabled" : false,

                          "modifiedDate" : 1488357474000,

                          "name" : "Post 4.6 upgrade Windows-1",

                          "owner" : "CloudAdmin",

                          "provisionDate" : 1488292348000,

                          "provisionedServiceOfferingModel" : "<removed this bit as its massive>"

                        }

                       

                      ...so that includes the name, isMonitoringEnabled, owner and provisionDate and leaves the rest....as per your requirements

                       

                      You can also add an ignoreFields section to the json body so it would look like this:

                      {

                        "callbackURL":"",

                        "operationParams":[

                          {

                            "multiplicity":"1",

                            "name":"fillFields",

                            "type":"java.lang.String",

                            "value":"name,isMonitoringEnabled,owner,provisionDate"

                            },{

                            "multiplicity":"1",

                            "name":"ignoreFields",

                            "type":"java.lang.String",

                            "value":"modifiedDate"

                          }

                        ],

                        "postCallout":"",

                        "preCallout":"",

                        "timeout":-1

                      }

                       

                      That gets rid of the modifiedDate, and returns the others, but seems that by default cloudClass, guid, isMonitoringPoliciesEnabled, isOpsEvalEnabled and provisionedServiceOfferingModel are always included....so doesn't look like you can remove them

                      1 of 1 people found this helpful