{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":2367,"path":"application-development/servicenow-cli/cmdb-cli-commands.md","title":"Commands installed with CMDB Application CLI and API","bundle":null,"doc_type":null,"release":"australia","body":"\n# Commands installed with CMDB Application CLI and API\n\nCommands and command groups available to the ServiceNow CLI when the app-cmdb-api-cli plugin is installed.\n\n## Request apps on the Store\n\nVisit the [ServiceNow Store](https://store.servicenow.com/sn_appstore_store.do#!/store/home) to view all the available apps, and for information about submitting requests to the store. For cumulative release notes information for all released apps, see the [ServiceNow Store version history release notes](https://www.servicenow.com/docs/r/store-release-notes/sn-store-release-notes.html).\n\nTo script critical operations which support automation across the enterprise, you can leverage APIs or run command line operations that the CMDB Application CLI and API store app provide instead of using the user interface. The CMDB Application CLI and API store app provides a robust framework which consolidates all the APIs that are related to application services and the command lines that let you access the interface to those APIs.\n\nCMDB Application CLI and API commands enable the following tasks:\n\n-   Registering and creating an application service and establishing upstream relationships\n-   Getting details of a given application service and its upstream relationships\n-   Connecting higher level constructs such as business applications and business service offerings\n-   Populating an application service with a given population type\n-   Changing the state of an application service\n\nFor the REST API solution, see [SG Services API](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/api-reference/sg_services-api.md).\n\n## Convert Application Service\n\nConverts a manual or empty type application service to a calculated application service. During conversion, the application service record moves into the \\[cmdb\\_ci\\_service\\_calculated\\] table with the newly assigned class.\n\nCommand group:\n\n-   Parent group: service-graph\n-   Child group: app-service\n\n-   **Roles required**\n\n    app\\_service\\_admin\n\n    If using a service mapping related service, the user must have the required roles for that service mapping related service.\n\n-   **Command structure for Mac OS**\n\n    ```\n    snc service-graph app-service convert --data '{JSON}'\n    ```\n\n-   **Command structure for Windows OS**\n\n    ```\n    snc service-graph app-service convert --data \"{JSON}\"\n    ```\n\n-   **Arguments**\n\n    This command passes a JSON object using the **data** parameter.\n\n    The following properties for identifying a CI take precedence as follows:\n\n    1.  sys\\_id – If sys\\_id, the system only uses the sys\\_id and ignores any additional values.\n    2.  number – If provided without the sys\\_id, the system only uses the number and ignores any additional values.\n    3.  &lt;IRE field name&gt; – The system only uses these values if the sys\\_id or number are not provided.\n<table id=\"table_lhc_n2d_3qb\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\n&lt;IRE field name&gt;\n\n</td><td>\n\nOne or more IRE fields identifying the application service. For example, name or version. Data type: String\n\n</td></tr><tr><td>\n\nlevels\n\n</td><td>\n\nNumber of levels to include in the conversion.Data type: String\n\n</td></tr><tr><td>\n\nnumber\n\n</td><td>\n\nUnique number that identifies the application service. Data type: String\n\n</td></tr><tr><td>\n\nsys\\_id\n\n</td><td>\n\nSys\\_id of the application service.Data type: String\n\n</td></tr></tbody>\n</table>-   **Example on Mac OS**\n\n    ```\n    snc service-graph app-service convert --data '{\"name\":\"Test Register\",\"environment\":\"Test\",\"version\":\"1.0\",\"levels\":8}'\n    ```\n\n-   **Example on Windows OS**\n\n    ```\n    snc service-graph app-service convert --data \"{\"name\":\"Test Register\",\"environment\":\"Test\",\"version\":\"1.0\",\"levels\":8}\"\n    ```\n\n-   **Return value**\n\n    ```\n    {\n      \"result\": {\n      \"status\": \"success\"\n      }\n    }\n    ```\n\n\n## Create Application Service Relationship\n\nConstructs upstream relations such as business applications, business service offerings, and other application services. Running this command creates a relationship, taking input with a single parent and a corresponding child object.\n\nCommand group:\n\n-   Parent group: service-graph\n-   Child group: app-service\n\n-   **Roles required**\n\n    app\\_service\\_admin\n\n    If using a service mapping related service, the user must have the required roles for that service mapping related service.\n\n-   **Command structure for Mac OS**\n\n    ```\n    snc service-graph app-service create-relationship --data '{JSON}'\n    ```\n\n-   **Command structure for Windows OS**\n\n    ```\n    snc service-graph app-service create-relationship --data \"{JSON}\"\n    ```\n\n-   **Arguments**\n\n    This command passes a JSON object using the **data** parameter.\n\n    The following properties for identifying a CI take precedence as follows:\n\n    1.  sys\\_id – If sys\\_id, the system only uses the sys\\_id and ignores any additional values.\n    2.  number – If provided without the sys\\_id, the system only uses the number and ignores any additional values.\n    3.  &lt;IRE field name&gt; – The system only uses these values if the sys\\_id or number are not provided.\n<table id=\"table_ty2_q2d_3qb\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nchild\n\n</td><td>\n\nInformation identifying the child application service with which to create a relationship. The child is located in the Service Instance \\[cmdb\\_ci\\_service\\_auto\\] table.A dynamic CI group can be added as a child but cannot be parent.\n\n Data type: Object\n\n ```\n\"child\": {\n  \"<IRE field name>\": \"String\",\n  \"number\": \"String\",\n  \"sys_id\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nchild.&lt;IRE field name&gt;\n\n</td><td>\n\nOne or more IRE fields identifying the child application service. For example, name or version.Data type: String\n\n</td></tr><tr><td>\n\nchild.number\n\n</td><td>\n\nUnique number that identifies the child application service.Data type: String\n\n</td></tr><tr><td>\n\nchild.sys\\_id\n\n</td><td>\n\nSys\\_id of the child application service listed in the Service Instance \\[cmdb\\_ci\\_service\\_auto\\].Data type: String\n\n</td></tr><tr><td>\n\nparent\n\n</td><td>\n\nDetails identifying the parent application service with which to create a relationship.Data type: Object\n\n ```\n\"parent\": {\n  \"<IRE field name>\": \"String\",\n  \"number\": \"String\",\n  \"sys_id\": \"String\",\n  \"class_name\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nparent.&lt;IRE field name&gt;\n\n</td><td>\n\nOne or more IRE fields identifying the application service. For example, name or version.Data type: String\n\n</td></tr><tr><td>\n\nparent.number\n\n</td><td>\n\nUnique number that identifies the application service.Data type: String\n\n</td></tr><tr><td>\n\nparent.sys\\_id\n\n</td><td>\n\nSys\\_id of the application service listed in the Service Instance \\[cmdb\\_ci\\_service\\_auto\\].Data type: String\n\n</td></tr><tr><td>\n\nparent.class\\_name\n\n</td><td>\n\nName of the class that contains the application service.The parent class name should be from one of the following tables:\n\n-   cmdb\\_ci\\_service\\_auto\n-   cmdb\\_ci\\_service\\_discovered\n-   cmdb\\_ci\\_service\\_by\\_tags\n-   cmdb\\_ci\\_service\\_calculated\n-   service\\_offering\n-   cmdb\\_ci\\_business\\_app\n Default: cmdb\\_ci\\_service\\_auto\n\n Data type: String\n\n</td></tr></tbody>\n</table>-   **Example on Mac OS**\n\n    ```\n    snc service-graph app-service create-relationship --data '{\"child\":{\"name\":\"wdfsdf\",\"environment\":\"Test\",\"version\":\"1.0\"},\"parent\":{\"sys_id\":\"abcdefg\",\"name\":\"business App1\",\"class_name\":\"service_offering\"}}'\n    ```\n\n-   **Example on Windows OS**\n\n    ```\n    snc service-graph app-service create-relationship --data \"{\"child\":{\"name\":\"wdfsdf\",\"environment\":\"Test\",\"version\":\"1.0\"},\"parent\":{\"sys_id\":\"abcdefg\",\"name\":\"business App1\",\"class_name\":\"service_offering\"}}\"\n    ```\n\n-   **Return value**\n\n    ```\n    {\n      \"result\": {\n      \"status\": \"success\"\n      }\n    }\n    ```\n\n\n## Delete Application Service\n\nDeletes an application service.\n\nCommand group:\n\n-   Parent group: service-graph\n-   Child group: app-service\n\n-   **Roles required**\n\n    app\\_service\\_admin\n\n    If using a service mapping related service, the user must have the required roles for that service mapping related service.\n\n-   **Command structure for Mac OS**\n\n    ```\n    snc service-graph app-service delete --data '{JSON}'\n    ```\n\n-   **Command structure for Windows OS**\n\n    ```\n    snc service-graph app-service delete --data \"{JSON}\"\n    ```\n\n-   **Arguments**\n\n    This command passes a JSON object using the **data** parameter.\n\n    The following properties for identifying a CI take precedence as follows:\n\n    1.  sys\\_id – If sys\\_id, the system only uses the sys\\_id and ignores any additional values.\n    2.  number – If provided without the sys\\_id, the system only uses the number and ignores any additional values.\n    3.  &lt;IRE field name&gt; – The system only uses these values if the sys\\_id or number are not provided.\n<table id=\"table_icm_q2d_3qb\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\n&lt;IRE field name&gt;\n\n</td><td>\n\nOne or more IRE fields identifying the application service. For example, name or version. Data type: String\n\n</td></tr><tr><td>\n\nnumber\n\n</td><td>\n\nUnique number that identifies the application service. Data type: String\n\n</td></tr><tr><td>\n\nsys\\_id\n\n</td><td>\n\nSys\\_id of the application service listed in the Service Instance \\[cmdb\\_ci\\_service\\_auto\\] table. Data type: String\n\n</td></tr></tbody>\n</table>-   **Example on Mac OS**\n\n    ```\n    snc service-graph app-service delete --data '{\"name\":\"Test Register\",\"environment\":\"Test\",\"version\":\"1.0\"}'\n    ```\n\n-   **Example on Windows OS**\n\n    ```\n    snc service-graph app-service delete --data \"{\"name\":\"Test Register\",\"environment\":\"Test\",\"version\":\"1.0\"}\"\n    ```\n\n-   **Return value**\n\n    ```\n    {\n      \"result\": {\n      \"status\": \"success\"\n      }\n    }\n    ```\n\n\n## Delete Application Service Relationship\n\nDeletes an application service upstream relationship.\n\nCommand group:\n\n-   Parent group: service-graph\n-   Child group: app-service\n\n-   **Roles required**\n\n    app\\_service\\_admin\n\n    If using a service mapping related service, the user must have the required roles for that service mapping related service.\n\n-   **Command structure for Mac OS**\n\n    ```\n    snc service-graph app-service delete-relationship --data '{JSON}'\n    ```\n\n-   **Command structure for Windows OS**\n\n    ```\n    snc service-graph app-service delete-relationship --data \"{JSON}\"\n    ```\n\n-   **Arguments**\n\n    This command passes a JSON object using the **data** parameter.\n\n    The following properties for identifying a CI take precedence as follows:\n\n    1.  sys\\_id – If sys\\_id, the system only uses the sys\\_id and ignores any additional values.\n    2.  number – If provided without the sys\\_id, the system only uses the number and ignores any additional values.\n    3.  &lt;IRE field name&gt; – The system only uses these values if the sys\\_id or number are not provided.\n<table id=\"table_mwt_q2d_3qb\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nchild\n\n</td><td>\n\nInformation describing the child relationship to be deleted from the service application.Data type: Object\n\n ```\n\"child\": {\n  \"<IRE field name>\": \"String\",\n  \"number\": \"String\",\n  \"sys_id\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nchild.&lt;IRE field name&gt;\n\n</td><td>\n\nOne or more IRE fields identifying the child application service. For example, name or version.Data type: String\n\n</td></tr><tr><td>\n\nchild.number\n\n</td><td>\n\nUnique number that identifies the child application service.Data type: String\n\n</td></tr><tr><td>\n\nchild.sys\\_id\n\n</td><td>\n\nSys\\_id of the child application service listed in the Service Instance \\[cmdb\\_ci\\_service\\_auto\\].Data type: String\n\n</td></tr><tr><td>\n\nparent\n\n</td><td>\n\nDetails identifying the parent application service from which to remove a relationship.Data type: Object\n\n ```\n\"parent\": {\n  \"<IRE field name>\": \"String\",\n  \"number\": \"String\",\n  \"sys_id\": \"String\",\n  \"class_name\": \"String\"\n}\n```\n\n</td></tr><tr><td>\n\nparent.&lt;IRE field name&gt;\n\n</td><td>\n\nOne or more IRE fields identifying the application service. For example, name or version.Data type: String\n\n</td></tr><tr><td>\n\nparent.number\n\n</td><td>\n\nUnique number that identifies the application service.Data type: String\n\n</td></tr><tr><td>\n\nparent.sys\\_id\n\n</td><td>\n\nSys\\_id of the application service listed in the Service Instance \\[cmdb\\_ci\\_service\\_auto\\] table. Data type: String\n\n</td></tr><tr><td>\n\nparent.class\\_name\n\n</td><td>\n\nName of the class that contains the application service.The parent class name should be from one of the following tables:\n\n-   cmdb\\_ci\\_service\\_auto\n-   cmdb\\_ci\\_service\\_discovered\n-   cmdb\\_ci\\_service\\_by\\_tags\n-   cmdb\\_ci\\_service\\_calculated\n-   service\\_offering\n-   cmdb\\_ci\\_business\\_app\n Default: cmdb\\_ci\\_service\\_auto\n\n Data type: String\n\n</td></tr></tbody>\n</table>-   **Example on Mac OS**\n\n    ```\n    snc service-graph app-service delete-relationship --data '{\"child\":{\"name\":\"Test Register\",\"environment\":\"Test\",\"version\":\"1.0\"},\"parent\":{\"name\":\"business Service Offering1\",\"class_name\":\"service_offering\"}}'\n    ```\n\n-   **Example on Windows OS**\n\n    ```\n    snc service-graph app-service delete-relationship --data \"{\"child\":{\"name\":\"Test Register\",\"environment\":\"Test\",\"version\":\"1.0\"},\"parent\":{\"name\":\"business Service Offering1\",\"class_name\":\"service_offering\"}}\"\n    ```\n\n-   **Return value**\n\n    ```\n    {\n      \"result\": {\n      \"status\": \"success\"\n      }\n    }\n    ```\n\n\n## Find Application Service\n\nFinds the details of a given application service and its upstream relationships.\n\nCommand group:\n\n-   Parent group: service-graph\n-   Child group: app-service\n\n-   **Roles required**\n\n    app\\_service\\_admin – This role provides unlimited viewing of application services.\n\n    app\\_service\\_user – This role only provides viewing application services in Operational status.\n\n    If using a service mapping related service, the user must have the required roles for that service mapping related service.\n\n-   **Command structure for Mac OS**\n\n    ```\n    snc service-graph app-service find --data '{JSON}'\n    ```\n\n-   **Command structure for Windows OS**\n\n    ```\n    snc service-graph app-service find --data \"{JSON}\"\n    ```\n\n-   **Arguments**\n\n    This command passes a JSON object using the **data** parameter.\n\n    The following properties for identifying a CI take precedence as follows:\n\n    1.  sys\\_id – If sys\\_id, the system only uses the sys\\_id and ignores any additional values.\n    2.  number – If provided without the sys\\_id, the system only uses the number and ignores any additional values.\n    3.  &lt;IRE field name&gt; – The system only uses these values if the sys\\_id or number are not provided.\n<table id=\"table_wb1_r2d_3qb\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\n&lt;IRE field name&gt;\n\n</td><td>\n\nOne or more IRE fields identifying the application service. For example, name or version. Data type: String\n\n</td></tr><tr><td>\n\nnumber\n\n</td><td>\n\nUnique number that identifies the application service. Data type: String\n\n</td></tr><tr><td>\n\nsys\\_id\n\n</td><td>\n\nSys\\_id of the application service listed in the Service Instance \\[cmdb\\_ci\\_service\\_auto\\] table. Data type: String\n\n</td></tr></tbody>\n</table>-   **Example on Mac OS**\n\n    ```\n    snc service-graph app-service find --data '{\"name\" : \"Test App Service1\"}'\n    ```\n\n-   **Example on Windows OS**\n\n    ```\n    snc service-graph app-service find --data \"{\"name\" : \"Test App Service1\"}\"\n    ```\n\n-   **Return value**\n\n    ```\n    {\n      \"result\": {\n        \"aliases\": null,\n        \"asset\": null,\n        \"asset_tag\": null,\n        \"assigned\": \"\",\n        \"assigned_to\": null,\n        \"assignment_group\": null,\n        \"attestation_score\": null,\n        \"attested\": \"0\",\n        \"attested_by\": null,\n        \"attested_date\": \"\",\n        \"attributes\": null,\n        \"bucket\": null,\n        \"business_contact\": null,\n        \"business_need\": null,\n        \"business_relation_manager\": null,\n        \"business_unit\": null,\n        \"busines_criticality\": \"4 - not critical\",\n        \"can_print\": \"0\",\n        \"category\": null,\n        \"change_control\": null,\n        \"checked_in\": \"\",\n        \"checked_out\": \"\",\n        \"checkout\": null,\n        \"comments\": null,\n        \"company\": null,\n        \"compatibility_dependencies\": null,\n        \"consumer_type\": \"internal\",\n        \"correlation_id\": null,\n        \"cost\": null,\n        \"cost_cc\": \"USD\",\n        \"cost_center\": null,\n        \"delivery_date\": \"\",\n        \"delivery_manager\": null,\n        \"department\": null,\n        \"discovery_source\": \"Manual Entry\",\n        \"dns_domain\": null,\n        \"due\": \"\",\n        \"due_in\": null,\n        \"duplicate_of\": null,\n        \"end_date\": \"\",\n        \"environment\": null,\n        \"fault_count\": \"0\",\n        \"first_discovered\": \"2021-07-19 20:09:48\",\n        \"fqdn\": null,\n        \"gl_account\": null,\n        \"hide_from_dashboard\": \"0\",\n        \"install_date\": \"\",\n        \"install_status\": \"1\",\n        \"invoice_number\": null,\n        \"ip_address\": null,\n        \"justification\": null,\n        \"last_discovered\": \"2021-07-19 20:09:48\",\n        \"last_review_date\": \"\",\n        \"layer\": null,\n        \"lease_id\": null,\n        \"life_cycle_stage\": null,\n        \"life_cycle_stage_status\": null,\n        \"location\": null,\n        \"mac_address\": null,\n        \"maintenance_schedule\": null,\n        \"managed_by\": null,\n        \"managed_by_group\": null,\n        \"manufacturer\": null,\n        \"model_id\": null,\n        \"model_number\": null,\n        \"monitor\": \"0\",\n        \"monitoring_requirements\": null,\n        \"name\": \"Test App Service1\",\n        \"number\": \"SNSVC0001014\",\n        \"operational_status\": \"2\",\n        \"order_date\": \"\",\n        \"owned_by\": null,\n        \"parent\": null,\n        \"portfolio_status\": \"pipeline\",\n        \"po_number\": null,\n        \"prerequisites\": null,\n        \"price_model\": \"per_unit\",\n        \"price_unit\": null,\n        \"published_ref\": null,\n        \"purchase_date\": \"\",\n        \"schedule\": null,\n        \"serial_number\": null,\n        \"service_classification\": \"Application Service\",\n        \"service_level_requirement\": null,\n        \"service_owner_delegate\": null,\n        \"service_status\": \"requirements\",\n        \"severity\": null,\n        \"short_description\": null,\n        \"skip_sync\": \"0\",\n        \"sla\": null,\n        \"spm_service_portfolio\": null,\n        \"spm_taxonomy_node\": null,\n        \"stakeholders\": null,\n        \"start_date\": \"\",\n        \"state\": null,\n        \"subcategory\": null,\n        \"supported_by\": null,\n        \"support_group\": null,\n        \"sys_class_name\": \"cmdb_ci_service_auto\",\n        \"sys_class_path\": \"/!!/!7/!(\",\n        \"sys_created_by\": \"admin\",\n        \"sys_created_on\": \"2021-07-19 20:09:48\",\n        \"sys_domain\": \"global\",\n        \"sys_domain_path\": \"/\",\n        \"sys_id\": \"a2f0618040697410f87713b656474255\",\n        \"sys_mod_count\": \"0\",\n        \"sys_updated_by\": \"admin\",\n        \"sys_updated_on\": \"2021-07-19 20:09:48\",\n        \"unit_description\": null,\n        \"unverified\": \"0\",\n        \"used_for\": \"Production\",\n        \"user_group\": null,\n        \"vendor\": null,\n        \"version\": null,\n        \"view_service\": \"61e1cb757f23220002d31ccebefa9120\",\n        \"warranty_expiration\": \"\",\n        \"relationships\": [\n          {\n            \"name\": \"Test Biz App1\",\n            \"sys_id\": \"0250a94040697410f87713b656474250\",\n            \"number\": \"APM0001001\",\n            \"class_name\": \"cmdb_ci_business_app\",\n            \"relationship\": \"Consumes::Consumed by\"\n          },\n          {\n            \"name\": \"Tech Service Offering1\",\n            \"sys_id\": \"98d0ed4040697410f87713b6564742ef\",\n            \"number\": \"BSN0001005\",\n            \"class_name\": \"service_offering\",\n            \"relationship\": \"Contains::Contained by\"\n          }\n        ]\n      }\n    }\n    ```\n\n\n## Populate Application Service\n\nPopulates an application service with a service population method.\n\nCommand group:\n\n-   Parent group: service-graph\n-   Child group: app-service\n\n-   **Roles required**\n\n    app\\_service\\_admin\n\n    If using a service mapping related service, the user must have the required roles for that service mapping related service.\n\n-   **Command structure for Mac OS**\n\n    ```\n    snc service-graph app-service populate --data '{JSON}'\n    ```\n\n-   **Command structure for Windows OS**\n\n    ```\n    snc service-graph app-service populate --data \"{JSON}\"\n    ```\n\n-   **Arguments**\n\n    This command passes a JSON object using the **data** parameter.\n\n    The following properties for identifying a CI take precedence as follows:\n\n    1.  sys\\_id – If sys\\_id, the system only uses the sys\\_id and ignores any additional values.\n    2.  number – If provided without the sys\\_id, the system only uses the number and ignores any additional values.\n    3.  &lt;IRE field name&gt; – The system only uses these values if the sys\\_id or number are not provided.\n<table id=\"table_acn_r2d_3qb\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\n&lt;IRE field name&gt;\n\n</td><td>\n\nOne or more IRE fields identifying the application service. For example, name or version. Data type: String\n\n</td></tr><tr><td>\n\nnumber\n\n</td><td>\n\nUnique number that identifies the application service. Data type: String\n\n</td></tr><tr><td>\n\npopulation\\_method\n\n</td><td>\n\nRequired. Identifies the population method and its accompanying property to identify the content for population.Only one accompanying object is valid per type.\n\n Data type: Object\n\n</td></tr><tr><td>\n\npopulation\\_method.group\\_id\n\n</td><td>\n\nGroup ID of the CMDB group configured with the cmdb\\_group population type.Data type: \"String\"\n\n ```\n\"population_method\": {\n  \"group_id\": \"String\",\n  \"type\": \"cmdb_group\"\n}\n```\n\n Associated population type: cmdb\\_group\n\n</td></tr><tr><td>\n\npopulation\\_method.levels\n\n</td><td>\n\nNumber of levels to use in building the service. If the level value is not provided, the system checks the sys\\_property for the value. If svc.manual.convert.levels.default\\_value is not populated, a default value of 3 is used.Data type: Number\n\n ```\n\"population_method\": {\n  \"levels\": Number,\n  \"type\": \"dynamic_service\"\n}\n```\n\n Associated population type: dynamic\\_service\n\n Default: 3 if no level value is set for the sys\\_property\n\n</td></tr><tr><td>\n\npopulation\\_method.service\\_candidate\n\n</td><td>\n\nUnique identifier of the service candidate.\n\n Data type: String\n\n ```\n\"population_method\": {\n  \"service_candidate\": \"String\",\n  \"type\": \"tag_based_service_family\"\n}\n```\n\n Associated population type: tag\\_based\\_service\\_family\n\n</td></tr><tr><td>\n\npopulation\\_method.service\\_relations\n\n</td><td>\n\nList of objects containing hierarchy data for the CIs within the application service. All CIs form pairs with a parent and child CI. The top-level CI, referred to as the entry point of an application service, does not have a parent CI.Data type: Array\n\n ```\n\"population_method\": {\n\n  \"service_relations\":[\n     {\n      \"child\": \"String\",\n      \"parent\": \"String\"\n     }\n  ],\n\n  \"type\": \"service_hierarchy\"   \n}\n```\n\n Associated population type: service\\_hierarchy\n\n</td></tr><tr><td>\n\npopulation\\_method.service\\_relations.child\n\n</td><td>\n\nName of a child CI related to the CI.Data type: String\n\n</td></tr><tr><td>\n\npopulation\\_method.service\\_relations.parent\n\n</td><td>\n\nName of a parent CI related to the CI.Data type: String\n\n</td></tr><tr><td>\n\npopulation\\_method.tags\n\n</td><td>\n\nList of objects containing tags to associate with the CI. This information is located in the Key Values \\[cmdb\\_key\\_value\\] table.Data type: Array\n\n ```\n\"population_method\": {\n\n  \"tags\": [\n     {\n      \"tag\": \"String\",\n      \"value\": \"String\"\n     }\n  ],\n\n  \"type\": \"tag_list\"  \n}\n```\n\n Associated population type: tag\\_list\n\n</td></tr><tr><td>\n\npopulation\\_method.tags.tag\n\n</td><td>\n\nTag name.Data type: String\n\n</td></tr><tr><td>\n\npopulation\\_method.tags.value\n\n</td><td>\n\nTag value.Data type: String\n\n</td></tr><tr><td>\n\npopulation\\_method.type\n\n</td><td>\n\nRequired. Population type to add to the application service.Data type: Object\n\n Valid values:\n\n-   cmdb\\_group\n-   service\\_hierarchy\n-   dynamic\\_service\n-   tag\\_list\n-   tag\\_based\\_service\\_family\n\n\n</td></tr><tr><td>\n\nsys\\_id\n\n</td><td>\n\nSys\\_id of the application service listed in the Service Instance \\[cmdb\\_ci\\_service\\_auto\\] table. Data type: String\n\n</td></tr></tbody>\n</table>-   **Example on Mac OS**\n\n    ```\n    snc service-graph app-service populate --data '{\"name\":\"Test Register\",\"environment\":\"Test\",\"version\":\"1.0\",\"population_method\":{\"group_id\":\"String\",\"type\":\"cmdb_group\"}}'\n    ```\n\n-   **Example on Windows OS**\n\n    ```\n    snc service-graph app-service populate --data \"{\"name\":\"Test Register\",\"environment\":\"Test\",\"version\":\"1.0\",\"population_method\":{\"group_id\":\"String\",\"type\":\"cmdb_group\"}}\"\n    ```\n\n-   **Return value**\n\n    ```\n    {\n      \"result\": {\n      \"status\": \"success\"\n      }\n    }\n    ```\n\n\n## Register Application Service\n\nCreates an application service, tags and constructs upstream relationships such as business applications, business service offerings, and other application services.\n\nCommand group:\n\n-   Parent group: service-graph\n-   Child group: app-service\n\n-   **Roles required**\n\n    app\\_service\\_admin\n\n    If using a service mapping related service, the user must have the required roles for that service mapping related service.\n\n-   **Command structure for Mac OS**\n\n    ```\n    snc service-graph app-service register --data '{JSON}'\n    ```\n\n-   **Command structure for Windows OS**\n\n    ```\n    snc service-graph app-service register --data \"{JSON}\"\n    ```\n\n-   **Arguments**\n\n    This command passes a JSON object using the **data** parameter.\n\n    The following properties for identifying a CI take precedence as follows:\n\n    1.  sys\\_id – If sys\\_id, the system only uses the sys\\_id and ignores any additional values.\n    2.  number – If provided without the sys\\_id, the system only uses the number and ignores any additional values.\n    3.  &lt;IRE field name&gt; – The system only uses these values if the sys\\_id or number are not provided.\n<table id=\"table_mrr_r2d_3qb\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\n&lt;IRE field name&gt;\n\n</td><td>\n\nOne or more IRE fields identifying the application service. For example, name or version. Data type: String\n\n</td></tr><tr><td>\n\nnumber\n\n</td><td>\n\nUnique number that identifies the application service. Data type: String\n\n</td></tr><tr><td>\n\nrelationships\n\n</td><td>\n\nUpstream relationships categorized by type.Data type: Object\n\n ```\n\"relationships\": {\n \"business_app\": [Array],\n \"business_service_offering\": [Array],\n \"parent_app_service\": [Array],\n \"technical_service_offering\": [Array]\n}\n```\n\n Maximum number of relationships is 25.\n\n</td></tr><tr><td>\n\nrelationships.business\\_app\n\n</td><td>\n\nList of objects representing Business Application relationship types. These values can be defined using one of the following items as key-value pairs.\n\n-   &lt;IRE field name&gt;\n-   number\n-   sys\\_id\n Data type: Array\n\n</td></tr><tr><td>\n\nrelationships.business\\_service\\_offering\n\n</td><td>\n\nList of objects representing Business Service Offering relationship types. These values can be defined using the following items as key-value pairs.\n\n-   &lt;IRE field name&gt;\n-   number\n-   sys\\_id\n Data type: Array\n\n</td></tr><tr><td>\n\nrelationships.parent\\_app\\_service\n\n</td><td>\n\nList of objects representing Application Service relationship types. These values can be defined using the following items as key-value pairs.\n\n-   &lt;IRE field name&gt;\n-   number\n-   sys\\_id\n Data type: Array\n\n</td></tr><tr><td>\n\nrelationships.technical\\_service\\_offering\n\n</td><td>\n\nList of objects representing technology management offering \\(formerly technical service offering\\)relationship types. These values can be defined using the following items as key-value pairs.\n\n-   &lt;IRE field name&gt;\n-   number\n-   sys\\_id\n Data type: Array\n\n</td></tr><tr><td>\n\nsys\\_id\n\n</td><td>\n\nSys\\_id of the application service listed in the Service Instance \\[cmdb\\_ci\\_service\\_auto\\] table. Data type: String\n\n</td></tr><tr><td>\n\ntags\n\n</td><td>\n\nList of objects containing tag definitions as key-value pairs.```\n\"tags\": [\n {\n  \"key\": \"String\",\n  \"value\": \"String\"\n }]\n```\n\n Data type: Array\n\n</td></tr><tr><td>\n\ntags.key\n\n</td><td>\n\nTag category name.Data type: String\n\n</td></tr><tr><td>\n\ntags.value\n\n</td><td>\n\nTag value.Data type: String\n\n</td></tr></tbody>\n</table>-   **Example on Mac OS**\n\n    ```\n    snc service-graph app-service register --data '{\"name\":\"Test Register\",\"environment\":\"Test\",\"version\":\"1.0\",\"number\":\" SNSVC0001014\",\"relationships\":{\"business_application\":[{\"sys_id\":\"0250a94040697410f87713b656474250\"},{\"number\":\"APM0001002\"},{\"name\":\"Test Biz App1\"}],\"business_service_offering\":[{\"sys_id\":\"ed32e98040697410f87713b656474259\"}],\"technical_service_offering\":[{\"sys_id\":\"80e12d8040697410f87713b65647421c\"},{\"number\":\"BSN0001005\"},{\"name\":\"Tech Service Offering2\"}],\"parent_app_service\":[{\"sys_id\":\"a2f0618040697410f87713b656474255\"}]},\"tags\":[{\"key\":\"key1\",\"value\":\"value1\"},{\"key\":\"key2\",\"value\":\"value2\"}]}'\n    ```\n\n-   **Example on Windows OS**\n\n    ```\n    snc service-graph app-service register --data \"{\"name\":\"Test Register\",\"environment\":\"Test\",\"version\":\"1.0\",\"number\":\" SNSVC0001014\",\"relationships\":{\"business_application\":[{\"sys_id\":\"0250a94040697410f87713b656474250\"},{\"number\":\"APM0001002\"},{\"name\":\"Test Biz App1\"}],\"business_service_offering\":[{\"sys_id\":\"ed32e98040697410f87713b656474259\"}],\"technical_service_offering\":[{\"sys_id\":\"80e12d8040697410f87713b65647421c\"},{\"number\":\"BSN0001005\"},{\"name\":\"Tech Service Offering2\"}],\"parent_app_service\":[{\"sys_id\":\"a2f0618040697410f87713b656474255\"}]},\"tags\":[{\"key\":\"key1\",\"value\":\"value1\"},{\"key\":\"key2\",\"value\":\"value2\"}]}\"\n    ```\n\n-   **Return value**\n\n    ```\n    {\n      \"result\": {\n        \"app_service\": {\n          \"sys_id\": \"99b2a54040697410f87713b6564742ad\",\n          \"name\": \"Test Register\",\n          \"number\": \"SNSVC0001014\"\n        },\n        \"message\": \"Service registered successfully\",\n        \"status\": \"INSERT\"\n      }\n    }\n    ```\n\n\n## Update Application Service\n\nUpdates an existing application service provided and creates tags for the given application service.\n\nCommand group:\n\n-   Parent group: service-graph\n-   Child group: app-service\n\n-   **Roles required**\n\n    app\\_service\\_admin\n\n    If using a service mapping related service, the user must have the required roles for that service mapping related service.\n\n-   **Command structure for Mac OS**\n\n    ```\n    snc service-graph app-service update --data '{JSON}'\n    ```\n\n-   **Command structure for Windows OS**\n\n    ```\n    snc service-graph app-service update --data \"{JSON}\"\n    ```\n\n-   **Arguments**\n\n    This command passes a JSON object using the **data** parameter.\n\n    The following properties for identifying a CI take precedence as follows:\n\n    1.  sys\\_id – If sys\\_id, the system only uses the sys\\_id and ignores any additional values.\n    2.  number – If provided without the sys\\_id, the system only uses the number and ignores any additional values.\n    3.  &lt;IRE field name&gt; – The system only uses these values if the sys\\_id or number are not provided.\n<table id=\"table_vyz_r2d_3qb\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\n&lt;fields or tags to update&gt;\n\n</td><td>\n\nUse key-value pairs to identify each field or tag to be updated.Only basic information can be updated, no upstream relationships can be updated.\n\n Data type: String\n\n</td></tr><tr><td>\n\n&lt;IRE field name&gt;\n\n</td><td>\n\nOne or more IRE fields identifying the application service. For example, name or version.Data type: String\n\n</td></tr><tr><td>\n\nnumber\n\n</td><td>\n\nUnique number that identifies the application service.Data type: String\n\n</td></tr><tr><td>\n\nsys\\_id\n\n</td><td>\n\nSys\\_id of the application service listed in the Service Instance \\[cmdb\\_ci\\_service\\_auto\\].Data type: String\n\n</td></tr></tbody>\n</table>-   **Example on Mac OS**\n\n    ```\n    snc service-graph app-service update --data '{\"name\": \"Test Register\", \"version\": \"2.0\"}'\n    ```\n\n-   **Example on Windows OS**\n\n    ```\n    snc service-graph app-service update --data \"{\"name\": \"Test Register\", \"version\": \"2.0\"}\"\n    ```\n\n-   **Return value**\n\n    ```\n    {\n      \"result\": {\n        \"sys_id\": \"99b2a54040697410f87713b6564742ad\",\n        \"name\": \"Test Register\",\n        \"number\": \"SNSVC0001014\",\n        \"version\": \"2.0\"\n      }\n    }\n    ```\n\n\n## Update Application Service State\n\nChanges the application service lifecycle state to activate, deactivate, or retire.\n\nCommand group:\n\n-   Parent group: service-graph\n-   Child group: app-service\n\n-   **Roles required**\n\n    app\\_service\\_admin\n\n    If using a service mapping related service, the user must have the required roles for that service mapping related service.\n\n-   **Command structure for Mac OS**\n\n    ```\n    snc service-graph app-service update-state --data '{JSON}'\n    ```\n\n-   **Command structure for Windows OS**\n\n    ```\n    snc service-graph app-service update-state --data \"{JSON}\"\n    ```\n\n-   **Arguments**\n\n    This command passes a JSON object using the **data** parameter.\n\n    The following properties for identifying a CI take precedence as follows:\n\n    1.  sys\\_id – If sys\\_id, the system only uses the sys\\_id and ignores any additional values.\n    2.  number – If provided without the sys\\_id, the system only uses the number and ignores any additional values.\n    3.  &lt;IRE field name&gt; – The system only uses these values if the sys\\_id or number are not provided.\n<table id=\"table_xrh_s2d_3qb\"><thead><tr><th>\n\nName\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\n&lt;IRE field name&gt;\n\n</td><td>\n\nOne or more IRE fields identifying the application service. For example, name or version.Data type: String\n\n</td></tr><tr><td>\n\nnumber\n\n</td><td>\n\nUnique number that identifies the application service.Data type: String\n\n</td></tr><tr><td>\n\nstate\n\n</td><td>\n\nRequired. Lifecycle state of the application service. These values are updated in the Service Instance \\[cmdb\\_ci\\_service\\_auto\\] table.Valid values:\n\n-   ACTIVATE – Life cycle is operational and in use.\n    -   operational\\_status=Operational\n    -   life\\_cycle\\_stage=Operational\n    -   life\\_cycle\\_stage\\_status=In Use\n-   DEACTIVATE – Life cycle is not operational and is in the design stage.\n    -   operational\\_status=Non-Operational\n    -   life\\_cycle\\_stage=Design\n    -   life\\_cycle\\_stage\\_status=Build\n-   RETIRE – End of life.\n    -   operational\\_status=Retired\n    -   life\\_cycle\\_stage=End Of Life\n    -   life\\_cycle\\_stage\\_status=Retired\n Data type: String\n\n</td></tr><tr><td>\n\nsys\\_id\n\n</td><td>\n\nSys\\_id of the application service listed in the Service Instance \\[cmdb\\_ci\\_service\\_auto\\].Data type: String\n\n</td></tr></tbody>\n</table>-   **Example on Mac OS**\n\n    ```\n    snc service-graph app-service update-state --data '{\"name\":\"Test Register\",\"environment\":\"Test\",\"version\":\"1.0\"}'\n    ```\n\n-   **Example on Windows OS**\n\n    ```\n    snc service-graph app-service update-state --data \"{\"name\":\"Test Register\",\"environment\":\"Test\",\"version\":\"1.0\"}\"\n    ```\n\n-   **Return value**\n\n    ```\n    {\n      \"result\": {\n      \"status\": \"success\"\n      }\n    }\n    ```\n\n\n**Parent Topic:**[ServiceNow CLI](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-cli/servicenow-cli.md)\n\n"}}