4 Replies Latest reply on Aug 28, 2019 4:56 PM by Thad Esser

    Using graphwalk REST API

    Jaffer Mahsoob
      Share This:

      I am trying to use the CMDB API graphwalk via REST, I would like to know how to use it properly....

       

      For Example, I have a BMC_ComputerSystem with InstanceId OI-123456789, I want to return all of the child objects like BMC_IPEndpoint, BMC_LANEndpoint, BMC_CPU, etc.

       

      How would I construct such a request?

       

      Thanks,

      Jaffer

        • 1. Re: Using graphwalk REST API
          Jigisha Pandya

          Hi Jaffer,

          Please find following example, I have used multiple relationship and multiple classes for your reference:

           

          {

          "start_node": {

          "class_name_key": {

          "name": "BMC_ComputerSystem",

          "namespace": "BMC.CORE"

          },

          "instance_id": "$<ciId_0>$"

          },

          "dataset_id": "$<graphwalkDatasetId>$",

          "dataset_mask": 0,

          "num_levels_to_traverse": 1,

          "query_mode": "STOP_IF_NO_MATCH_FOUND",

          "default_return_relationship_ci_attributes": "ALL",

          "default_return_class_ci_attributes": "NONE",

          "default_return_class_cis": "NONE",

          "relationship_selectors_filters": [{

          "class_name_key": {

          "name": "BMC_Dependency",

          "namespace": "BMC.CORE"

          },

          "return_attributes": [

          "InstanceId",

          "Name",

          "HasImpact",

          "ImpactWeight",

          "ImpactPropagationModel",

          "ImpactWeight",

          "ImpactDirection",

          "ImpactSourceId",

          "ImpactDestinationId",

          "Source.InstanceId",

          "Destination.InstanceId"

          ],

          "direction_to_walk": "BOTH",

          "is_impact_graph_walk": "false",

          "qualification": "1=1"

          }, {

          "class_name_key": {

          "name": "BMC_HostedAccessPoint",

          "namespace": "BMC.CORE"

          },

          "return_attributes": [

          "InstanceId",

          "Name",

          "HasImpact",

          "ImpactWeight",

          "ImpactPropagationModel",

          "ImpactWeight",

          "ImpactDirection",

          "ImpactSourceId",

          "ImpactDestinationId",

          "Source.InstanceId",

          "Destination.InstanceId"

          ],

          "direction_to_walk": "BOTH",

          "is_impact_graph_walk": "false",

          "qualification": "1=1"

          }, {

          "class_name_key": {

          "name": "BMC_HostedSystemComponents",

          "namespace": "BMC.CORE"

          },

          "return_attributes": [

          "InstanceId",

          "Name",

          "HasImpact",

          "ImpactWeight",

          "ImpactPropagationModel",

          "ImpactWeight",

          "ImpactDirection",

          "ImpactSourceId",

          "ImpactDestinationId",

          "Source.InstanceId",

          "Destination.InstanceId"

          ],

          "direction_to_walk": "BOTH",

          "is_impact_graph_walk": "false",

          "qualification": "1=1"

          }],

          "class_selectors_filters": [{

          "class_name_key": {

          "name": "BMC_IPEndpoint",

          "namespace": "BMC.CORE"

          },

          "return_attributes": [

          "InstanceId",

          "Name",

          "ShortDescription",

          "PermanentAddress",

          "SystemName",

          "Speed",

          "FullDuplex",

          "LinkTechnology",

          "Category",

          "Type",

          "Item"

          ],

          "qualification": "1=1"

          }, {

          "class_name_key": {

          "name": "BMC_LANEndpoint",

          "namespace": "BMC.CORE"

          },

          "return_attributes": [

          "InstanceId",

          "Name",

          "ShortDescription",

          "PermanentAddress",

          "SystemName",

          "Speed",

          "FullDuplex",

          "LinkTechnology",

          "Category",

          "Type",

          "Item"

          ],

          "qualification": "1=1"

          }, {

          "class_name_key": {

          "name": "BMC_NetworkPort",

          "namespace": "BMC.CORE"

          },

          "return_attributes": [

          "InstanceId",

          "Name",

          "ShortDescription",

          "PermanentAddress",

          "SystemName",

          "Speed",

          "FullDuplex",

          "LinkTechnology",

          "Category",

          "Type",

          "Item"

          ],

          "qualification": "1=1"

          }]

          }

           

          Thanks

          -Jigisha

          1 of 1 people found this helpful
          • 2. Re: Using graphwalk REST API
            Thad Esser

            Jigisha Pandya,

             

            Is there any documentation that explains what each of this things are?  In particular, what the range of options are for each setting.  For example:

            • The "query_mode" option in the examples I can find all have "STOP_IF_NO_MATCH_FOUND", but are there other options?
            • On the 'default_return_relationship_ci_attributes' setting, your example uses "ALL" and the Swagger UI example uses 'NONE'.  Are there in-between options?
            • Are the "qualification" settings your basic Remedy advanced qualifications?
            • "direction_to_walk":  You have "BOTH", the SwaggerUI example uses "OUT".  I'd guess that IN is also an option, but that'd only be a guess.

            and so on, for all the settings.

             

            I haven't found any helpful documentation yet on how to use the /api/cmdb/v1.0/graphwalk endpoint, so any guidance you can provide is appreciated.

             

            Thanks,

            Thad

            • 4. Re: Using graphwalk REST API
              Thad Esser

              Gustavo,

               

              Appreciate the link.  After looking through the REST API docs, which reference the Java API Docs, which then reference the C-API docs, which amounts to "look at our C examples in your installation and figure it out", I didn't have much hope that the Web-Services API docs would provide any more detail.  In everything I've looked through, I'm not finding where anything is actually explained.  They all just reference each other, or the information just sort of dead-ends.

               

              For example, in Jigisha's example above, there is an option "dataset_mask": 0 that I can't find an explanation for.  In the web services API link you provided, there's an item in the table for "datasetMask" (different than the REST API, but close enough).  The link there takes you to details about "GetMask" (GetMask - Documentation for BMC Atrium Core 9.1 - BMC Documentation ), which has two options.  Neither of the options are numeric and the doc doesn't say which one correlates to a value of '0'.  I can make assumptions and guesses (first one is zero maybe), or do trial and error (maybe something like, "dataset_mask": "DATASET_MODE_CURRENT" would work for the REST API), but that has proven to be rather time consuming.

               

              Anyway, I do appreciate the response.