To 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.
CMDB Application CLI and API commands enable the following tasks:
Registering and creating an application service and establishing upstream relationships
Getting details of a given application service and its upstream relationships
Connecting higher level constructs such as business applications and business service offerings
Populating an application service with a given population type
Converts 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.
Command group:
Parent group: service-graph
Child group: app-service
Roles required
app_service_admin
If using a service mapping related service, the user must have the required roles for that service mapping related service.
Constructs 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.
Command group:
Parent group: service-graph
Child group: app-service
Roles required
app_service_admin
If using a service mapping related service, the user must have the required roles for that service mapping related service.
This command passes a JSON object using the data parameter.
The following properties for identifying a CI take precedence as follows:
sys_id – If sys_id, the system only uses the sys_id and ignores any additional values.
number – If provided without the sys_id, the system only uses the number and ignores any additional values.
<IRE field name> – The system only uses these values if the sys_id or number are not provided.
Name
Description
child
Information 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. Data type: Object ``` "child": { "": "String", "number": "String", "sys_id": "String" }
</td></tr><tr><td>
child.<IRE field name>
</td><td>
One or more IRE fields identifying the child application service. For example, name or version.Data type: String
</td></tr><tr><td>
child.number
</td><td>
Unique number that identifies the child application service.Data type: String
</td></tr><tr><td>
child.sys\_id
</td><td>
Sys\_id of the child application service listed in the Service Instance \[cmdb\_ci\_service\_auto\].Data type: String
</td></tr><tr><td>
parent
</td><td>
Details identifying the parent application service with which to create a relationship.Data type: Object
```
"parent": {
"<IRE field name>": "String",
"number": "String",
"sys_id": "String",
"class_name": "String"
}
parent.<IRE field name>
One or more IRE fields identifying the application service. For example, name or version.Data type: String
parent.number
Unique number that identifies the application service.Data type: String
parent.sys\_id
Sys\_id of the application service listed in the Service Instance \[cmdb\_ci\_service\_auto\].Data type: String
parent.class\_name
Name of the class that contains the application service.The parent class name should be from one of the following tables: - cmdb\_ci\_service\_auto - cmdb\_ci\_service\_discovered - cmdb\_ci\_service\_by\_tags - cmdb\_ci\_service\_calculated - service\_offering - cmdb\_ci\_business\_app Default: cmdb\_ci\_service\_auto Data type: String
This command passes a JSON object using the data parameter.
The following properties for identifying a CI take precedence as follows:
sys_id – If sys_id, the system only uses the sys_id and ignores any additional values.
number – If provided without the sys_id, the system only uses the number and ignores any additional values.
<IRE field name> – The system only uses these values if the sys_id or number are not provided.
Name
Description
child
Information describing the child relationship to be deleted from the service application.Data type: Object ``` "child": { "": "String", "number": "String", "sys_id": "String" }
</td></tr><tr><td>
child.<IRE field name>
</td><td>
One or more IRE fields identifying the child application service. For example, name or version.Data type: String
</td></tr><tr><td>
child.number
</td><td>
Unique number that identifies the child application service.Data type: String
</td></tr><tr><td>
child.sys\_id
</td><td>
Sys\_id of the child application service listed in the Service Instance \[cmdb\_ci\_service\_auto\].Data type: String
</td></tr><tr><td>
parent
</td><td>
Details identifying the parent application service from which to remove a relationship.Data type: Object
```
"parent": {
"<IRE field name>": "String",
"number": "String",
"sys_id": "String",
"class_name": "String"
}
parent.<IRE field name>
One or more IRE fields identifying the application service. For example, name or version.Data type: String
parent.number
Unique number that identifies the application service.Data type: String
parent.sys\_id
Sys\_id of the application service listed in the Service Instance \[cmdb\_ci\_service\_auto\] table. Data type: String
parent.class\_name
Name of the class that contains the application service.The parent class name should be from one of the following tables: - cmdb\_ci\_service\_auto - cmdb\_ci\_service\_discovered - cmdb\_ci\_service\_by\_tags - cmdb\_ci\_service\_calculated - service\_offering - cmdb\_ci\_business\_app Default: cmdb\_ci\_service\_auto Data type: String
Example on Mac OS
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"}}'
Example on Windows OS
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"}}"
Return value
{
"result": {
"status": "success"
}
}
Find Application Service
Finds the details of a given application service and its upstream relationships.
Command group:
Parent group: service-graph
Child group: app-service
Roles required
app_service_admin – This role provides unlimited viewing of application services.
app_service_user – This role only provides viewing application services in Operational status.
If using a service mapping related service, the user must have the required roles for that service mapping related service.
This command passes a JSON object using the data parameter.
The following properties for identifying a CI take precedence as follows:
sys_id – If sys_id, the system only uses the sys_id and ignores any additional values.
number – If provided without the sys_id, the system only uses the number and ignores any additional values.
<IRE field name> – The system only uses these values if the sys_id or number are not provided.
Name
Description
<IRE field name>
One or more IRE fields identifying the application service. For example, name or version. Data type: String
number
Unique number that identifies the application service. Data type: String
population\_method
Required. Identifies the population method and its accompanying property to identify the content for population.Only one accompanying object is valid per type. Data type: Object
population\_method.group\_id
Group ID of the CMDB group configured with the cmdb\_group population type.Data type: "String" ``` "population_method": { "group_id": "String", "type": "cmdb_group" }
Associated population type: cmdb\_group
</td></tr><tr><td>
population\_method.levels
</td><td>
Number 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
```
"population_method": {
"levels": Number,
"type": "dynamic_service"
}
Associated population type: dynamic\_service Default: 3 if no level value is set for the sys\_property
population\_method.service\_candidate
Unique identifier of the service candidate. Data type: String ``` "population_method": { "service_candidate": "String", "type": "tag_based_service_family" }
Associated population type: tag\_based\_service\_family
</td></tr><tr><td>
population\_method.service\_relations
</td><td>
List 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
```
"population_method": {
"service_relations":[
{
"child": "String",
"parent": "String"
}
],
"type": "service_hierarchy"
}
Associated population type: service\_hierarchy
population\_method.service\_relations.child
Name of a child CI related to the CI.Data type: String
population\_method.service\_relations.parent
Name of a parent CI related to the CI.Data type: String
population\_method.tags
List of objects containing tags to associate with the CI. This information is located in the Key Values \[cmdb\_key\_value\] table.Data type: Array ``` "population_method": { "tags": [ { "tag": "String", "value": "String" } ], "type": "tag_list" }
Associated population type: tag\_list
</td></tr><tr><td>
population\_method.tags.tag
</td><td>
Tag name.Data type: String
</td></tr><tr><td>
population\_method.tags.value
</td><td>
Tag value.Data type: String
</td></tr><tr><td>
population\_method.type
</td><td>
Required. Population type to add to the application service.Data type: Object
Valid values:
- cmdb\_group
- service\_hierarchy
- dynamic\_service
- tag\_list
- tag\_based\_service\_family
</td></tr><tr><td>
sys\_id
</td><td>
Sys\_id of the application service listed in the Service Instance \[cmdb\_ci\_service\_auto\] table. Data type: String
</td></tr></tbody>
</table>
- **Example on Mac OS**
```
snc service-graph app-service populate --data '{"name":"Test Register","environment":"Test","version":"1.0","population_method":{"group_id":"String","type":"cmdb_group"}}'
```
- **Example on Windows OS**
```
snc service-graph app-service populate --data "{"name":"Test Register","environment":"Test","version":"1.0","population_method":{"group_id":"String","type":"cmdb_group"}}"
```
- **Return value**
```
{
"result": {
"status": "success"
}
}
```
## Register Application Service
Creates an application service, tags and constructs upstream relationships such as business applications, business service offerings, and other application services.
Command group:
- Parent group: service-graph
- Child group: app-service
- **Roles required**
app\_service\_admin
If using a service mapping related service, the user must have the required roles for that service mapping related service.
- **Command structure for Mac OS**
```
snc service-graph app-service register --data '{JSON}'
```
- **Command structure for Windows OS**
```
snc service-graph app-service register --data "{JSON}"
```
- **Arguments**
This command passes a JSON object using the **data** parameter.
The following properties for identifying a CI take precedence as follows:
1. sys\_id – If sys\_id, the system only uses the sys\_id and ignores any additional values.
2. number – If provided without the sys\_id, the system only uses the number and ignores any additional values.
3. <IRE field name> – The system only uses these values if the sys\_id or number are not provided.
<table id="table_mrr_r2d_3qb"><thead><tr><th>
Name
</th><th>
Description
</th></tr></thead><tbody><tr><td>
<IRE field name>
</td><td>
One or more IRE fields identifying the application service. For example, name or version. Data type: String
</td></tr><tr><td>
number
</td><td>
Unique number that identifies the application service. Data type: String
</td></tr><tr><td>
relationships
</td><td>
Upstream relationships categorized by type.Data type: Object
```
"relationships": {
"business_app": [Array],
"business_service_offering": [Array],
"parent_app_service": [Array],
"technical_service_offering": [Array]
}
Maximum number of relationships is 25.
relationships.business\_app
List of objects representing Business Application relationship types. These values can be defined using one of the following items as key-value pairs. - <IRE field name> - number - sys\_id Data type: Array
relationships.business\_service\_offering
List of objects representing Business Service Offering relationship types. These values can be defined using the following items as key-value pairs. - <IRE field name> - number - sys\_id Data type: Array
relationships.parent\_app\_service
List of objects representing Application Service relationship types. These values can be defined using the following items as key-value pairs. - <IRE field name> - number - sys\_id Data type: Array
relationships.technical\_service\_offering
List 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. - <IRE field name> - number - sys\_id Data type: Array
sys\_id
Sys\_id of the application service listed in the Service Instance \[cmdb\_ci\_service\_auto\] table. Data type: String
tags
List of objects containing tag definitions as key-value pairs.
"tags": [
{
"key": "String",
"value": "String"
}]
Data type: Array
tags.key
Tag category name.Data type: String
tags.value
Tag value.Data type: String
Example on Mac OS
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"}]}'
Example on Windows OS
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"}]}"
This command passes a JSON object using the data parameter.
The following properties for identifying a CI take precedence as follows:
sys_id – If sys_id, the system only uses the sys_id and ignores any additional values.
number – If provided without the sys_id, the system only uses the number and ignores any additional values.
<IRE field name> – The system only uses these values if the sys_id or number are not provided.
Name
Description
<fields or tags to update>
Use key-value pairs to identify each field or tag to be updated.Only basic information can be updated, no upstream relationships can be updated. Data type: String
<IRE field name>
One or more IRE fields identifying the application service. For example, name or version.Data type: String
number
Unique number that identifies the application service.Data type: String
sys\_id
Sys\_id of the application service listed in the Service Instance \[cmdb\_ci\_service\_auto\].Data type: String
This command passes a JSON object using the data parameter.
The following properties for identifying a CI take precedence as follows:
sys_id – If sys_id, the system only uses the sys_id and ignores any additional values.
number – If provided without the sys_id, the system only uses the number and ignores any additional values.
<IRE field name> – The system only uses these values if the sys_id or number are not provided.
Name
Description
<IRE field name>
One or more IRE fields identifying the application service. For example, name or version.Data type: String
number
Unique number that identifies the application service.Data type: String
state
Required. Lifecycle state of the application service. These values are updated in the Service Instance \[cmdb\_ci\_service\_auto\] table.Valid values: - ACTIVATE – Life cycle is operational and in use. - operational\_status=Operational - life\_cycle\_stage=Operational - life\_cycle\_stage\_status=In Use - DEACTIVATE – Life cycle is not operational and is in the design stage. - operational\_status=Non-Operational - life\_cycle\_stage=Design - life\_cycle\_stage\_status=Build - RETIRE – End of life. - operational\_status=Retired - life\_cycle\_stage=End Of Life - life\_cycle\_stage\_status=Retired Data type: String
sys\_id
Sys\_id of the application service listed in the Service Instance \[cmdb\_ci\_service\_auto\].Data type: String