Use the command line interface to create and update services or relationships

  • Freigeben Version: Australia
  • Aktualisiert 12. März 2026
  • 1 Minute Lesedauer
  • Use the command line interface (CLI) to perform operations on services and relationships using a single command instead of navigating to the SR Ops workspace.

    Vorbereitungen

    Ensure that the CLI client is connected to the instance where both the Site Reliability Operations and ServiceNow CLI store apps are installed.

    Role required: sro_manager or sro_admin

    Warum und wann dieser Vorgang ausgeführt wird

    Currently, deletion of services or relationships is not supported.

    Prozedur

    1. Open the Terminal, type snc sro and press Enter.

      The command group sro lets you perform the create, update, and delete operations on services and relationships for SR Ops. Under the list of available commands, the build command is displayed.

      Under available commands, the build command is listed.

      Hinweis:
      The build command accepts .json file name as its input.
    2. Ensure that the json payload is in the correct format.
      For example, services-payload.json has the following payload:
      {
        "services": [
          {
            "name": "Email Enterprise",
            "description": "Email Enterprise service",
            "$class": "cmdb_ci_service"
          },
          {
            "name": "Email Premium",
            "description": "Email Service for Office 365 accounts",
            "$class": "cmdb_ci_service_discovered"
          }
        ],
        "relationships": [
          {
            "parent": "Email Enterprise",
            "child": "Email Premium"
          }
        ]
      }
    3. Type snc sro build --data <filename>.json and press Enter.
      For example, snc sro build --data services-payload.json.

    Ergebnisse

    Based on the json payload, services and relationships are created or updated on the instance.