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

  • Versão de lançamento: Australia
  • Atualizado 12 de mar. de 2026
  • 1 min. de leitura
  • 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.

    Antes de Iniciar

    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

    Por Que e Quando Desempenhar Esta Tarefa

    Currently, deletion of services or relationships is not supported.

    Procedimento

    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.

      Nota:
      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.

    Resultado

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