1 Reply Latest reply on Nov 16, 2017 10:05 AM by Tim Cannon

    REST API BMC Discovery - Examples

    Tecio Vivas
      Share This:

      Hi,

       

      I thought about creating this topic so that everyone can contribute with examples of using the REST API. What do you think?

       

      My opnion... the BMC DOC is very poor in examples and the models that are in the Swagger UI also do not help much, so I thought to leave here some examples. I will post 2 examples that I have worked on and then we can complete it.

       

      Retrieve data from the model

       

      My use case (example): verify data from one or more CIs to enrich the automatic provisioning process by another tool.

       

       

       

      • Preview

      [

             {

                  "count": 1,

                  "headings": [

                       "Name",

                       "LastDiscovery"

                  ],

                         "kind": "Host",

                  "offset": 0,

                  "results": [

                       [

                            "hostname.fqdn",

                           "Success"

                       ]

                 ]

             }

      ]

       

       

       

      Create a New Snapshot Discovery Run

       

      My use case (example): After automatic provisioning of an IC, we ran the discovery snapshot for full discovery for that provisioned IC. Our Sync with CMDB is real time, so we have the data published in the CMDB with this action.

       

      {

      "ranges": ["ipAddress"],

      "label": "Your Label for Tracking on BMC Discovery",

      "scan_level": "Full Discovery",

      "company": "Your Company for Sync on CMDB"

      }

       

      • Script

       

      curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Bearer yourAPIkeyAuthorization' -d '{ \

                           "ranges": ["ipAddress"], \

                           "label": "Your Label for Tracking on BMC Discovery", \

                           "scan_level": "Full Discovery", \

                           "company": "Your Company for Sync on CMDB" \

                      }' 'https://yourappliance/api/v1.0/discovery/runs'

       

      • Preview

      {

        "uri": "https://yourappliance/api/v1.0/discovery/runs/9b266458431bb84d5f5595d76e446973636f7665727952756e",

        "uuid": "9b266458431bb84d5f5595d76e446973636f7665727952756e"

      }

       

       

      What use cases and examples can you share?