The CdmApplicationsApi provides endpoints that enable you to uploadzoominsoftware.io/utah-devops/ configuration data to the component, collection, deployable, and component variable folders found in the DevOps Config Workspace UI. It also has endpoints that enable you to export deployable configuration data to your DevOps pipeline and manage shared components and shared applications.

The export and upload endpoints use an asynchronous queuing implementation. With this type of implementation, you first call the desired export or upload request endpoint. These endpoints queue your request and return a request identifier. You then use this request identifier to call the appropriate status endpoint, one for uploads and a different one for exports, to obtain the status of the upload/export. For export requests, once the export is complete, you can also request the content of the export.

This API does not provide endpoints that perform simple retrieval of application records. To retrieve these records, use the Table API.

You must have one of the following roles to access this API:
  • Scripted REST CDM View ACL (sn_cdm.cdm.viewer)
  • Scripted REST CDM Editor ACL (sn_cdm.cdm_editor)

In addition, the Configuration Data Management (CDM) plugin must be activated for this API to be available in an instance.

For additional information on Configuration Data Management and the DevOps Config Workspace UI, see Uploading your config data.

For additional information on shared components and shared libraries, see Sharing components among applications — Component libraries.

CdmApplicationsApi - DELETE /sn_cdm/applications/deployables

Deletes a specified Configuration Data Management (CDM) deployable.

The caller of this endpoint must have the CDM Admin role.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/deployables

Default URL: /api/sn_cdm/applications/deployables

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 1. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 2. Query parameters
Name Description
appName Required. Name of the CDM application to which the deployable is associated.

Data type: String

Table: CDM Deployable [sn_cdm_deployable]

name Name of the deployable to delete.

Data type: String

Table: CDM Deployable [sn_cdm_deployable]

Table 3. Request body parameters
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 4. Request headers
Header Description
Accept Data format of the response body. Only supports application/json.
Table 5. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 6. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad Request. A bad request type or malformed request was detected.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters

Name Description
None

Example: cURL request

The following code example shows how to remove a deployable.

curl "http://instance.servicenow.com/api/sn_cdm/applications/deployables?appName=testApp&name=Dep-1" \ 
--request DELETE \ 
--header "Accept:application/json" \ 
--user 'username':'password1' 

For a successful deletion of the deployable, no response is returned other than the HTTP status code.

None - results defined by the HTTP status code

CdmApplicationsApi - DELETE /sn_cdm/applications/shared_components

Removes the shared component usage reference from a specified Configuration Data Management (CDM) application.

The CDM Admin role is required to access this endpoint.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/shared_components

Default URL: /api/sn_cdm/applications/shared_components

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 7. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 8. Query parameters
Name Description
appName Required. Name of the application from which to remove the specified shared component association. The specified application must have the type field set to "shared_library".

Data type: String

Table: CDM Application [sn_cdm_application]

changesetNumber Required.
Unique identifier of the associated changeset, such as "Chset-10".

Data type: String

Table: CDM Changeset [sn_cdm_changeset]

sharedComponentName Required. Unique name of the shared component to remove from the specified application.

Data type: String

Table: CDM Shared Component [sn_cdm_shared_component]

Table 9. Request body parameters
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 10. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json or application/xml.

Default: application/json

Table 11. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 12. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad Request. A bad request type or malformed request was detected.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters

Example: cURL request

The following code example shows how to delete the "paymentService-V1.1" shared component from the "App1" application.

curl "https://instance-name.service-now.com/api/sn_cdm/applications/shared_components?appName=App1&sharedComponentName=paymentService-V1.1&changesetNumber=Chset-25" \ 
--request DELETE \ 
--header "Accept:application/json" \ 
--user 'username':'password' 

Response:

""

CdmApplicationsApi - GET /sn_cdm/applications/deployables/exports/{export_id}/content

Returns the content associated with a specified configuration data export request.

Only call this endpoint once you have received a complete response from the CdmApplicationsApi - GET /sn_cdm/applications/deployables/exports/{export_id}/status endpoint. If you call this endpoint before the export is complete, a 400 status error is returned.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/deployables/exports/{export_id}/content

Default URL: /api/sn_cdm/applications/deployables/exports/{export_id}/content

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 13. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

export_id Unique identifier for the export request whose configuration data to return. This value is returned by the CdmApplicationsApi - POST /sn_cdm/applications/deployables/exports endpoint.
Table 14. Query parameters
Name Description
None
Table 15. Request body parameters (XML or JSON)
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 16. Request headers
Header Description
Accept Data format of the response body. Only supports application/json.
Table 17. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 18. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad Request. A bad request type or malformed request was detected.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters (JSON or XML)

Example: cURL request

The following example requests the configuration data of an export request with the ID of 3ab14a7d53b1301096edddeeff7b12f.

curl "http://instance.servicenow.com/api/sn_cdm/applications/deployables/exports/3ab14a7d53b1301096edddeeff7b12f/content" \ 
--request GET \ 
--header "Accept:application/json" \
--user 'username':'password' 

The following shows the possible return results.

// Successful completion of the export request
{ 
  "result": { 
    "export_id": "3ab14a7d53b1301096edddeeff7b12f" 
    "exporter_result": "DEP1.COMP.cdi_1=cdi-1-value" 
  } 
}

// Response when an incorrect export_id is passed. Note: Status code is 200.
{ 
  "result": { 
    "request_id": "3ab14a7d53b1301096edddeeff7b12e", 
    "state": "error", 
    "errors": "Invalid requestId '3ab14a7d53b1301096edddeeff7b12fe'", 
    "export_id": "3ab14a7d53b1301096edddeeff7b12e" 
  } 
}

CdmApplicationsApi - GET /sn_cdm/applications/deployables/exports/{export_id}/status

Returns the current status of the specified configuration data export request.

Use the CdmApplicationsApi - POST /sn_cdm/applications/deployables/exports endpoint to make an export request.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/deployables/exports/{export_id}/status

Default URL: /api/sn_cdm/applications/deployables/exports/{export_id}/status

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 19. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

export_id Sys_id of the export request whose status to return. This value is returned by the CdmApplicationsApi - POST /sn_cdm/applications/deployables/exports endpoint.
Table 20. Query parameters
Name Description
None
Table 21. Request body parameters (XML or JSON)
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 22. Request headers
Header Description
Accept Data format of the response body. Only supports application/json.
Table 23. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 24. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad Request. A bad request type or malformed request was detected.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters (JSON or XML)

Example: cURL request

The following example requests the status of an export with the ID of 3ab14a7d53b1301096edddeeff7b12f.

curl "http://instance.servicenow.com/api/sn_cdm/applications/deployables/exports/3ab14a7d53b1301096edddeeff7b12f/status" \ 
--request GET \ 
--header "Accept:application/json" \
--user 'username':'password' 

The following are the possible return results.

// Successful completion of the export request
{ 
  "result": { 
    "state": "completed", 
    "export_id": "3ab14a7d53b1301096edddeeff7b12f0" 
  } 
}

// Response when an incorrect export_id is passed. Note: Status code is 200.
{ 
  "result": { 
    "request_id": "3ac8e1b05311301096edddeeff7b123c", 
    "state": "error", 
    "errors": "Invalid requestId '3ac8e1b05311301096edddeeff7b123c'", 
    "export_id": "3ac8e1b05311301096edddeeff7b123c" 
  } 
} 

// Response when the export encounters an error. The exporter_result array contains the error information. Note: Status code is 200.
{ 
  "result": { 
    "state": "completed", 
    "export_id": "24536c3353f9301096edddeeff7b12b1", 
    "exporter_result": { 
      "execution_id": "81536c3353f9301096edddeeff7b129e", 
      "state": "failure", 
      "errors": [ 
        "Snapshot 'SNA-001-published-non_compliant' has not passed validation. All snapshots of deployable '/ApplicationA/deployables/DEP3' are required to pass validation" 
      ] 
    } 
  } 
}

CdmApplicationsApi - GET /sn_cdm/applications/shared_components

Returns the list of shared components used by a specified application. You can also specify to only return those shared components that have a new version available.

The CDM Admin role is required to access this endpoint.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/shared_components

Default URL: /api/sn_cdm/applications/shared_components

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 25. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 26. Query parameters
Name Description
appName Required. Name of the application whose list of shared components you want returned. The type field of the application must be set to shared_library.

Data type: String

Table: CDM Application [sn_cdm_application]

withUpdatesOnly Flag that indicates whether to only return shared components that have a new updated version available.
Valid values:
  • true: Only return shared components that have a new updated version available.
  • false: Return all shared components used by the specified application.

Default: false

Table 27. Request body parameters (XML or JSON)
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 28. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json or application/xml.

Default: application/json

Table 29. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 30. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad Request. A bad request type or malformed request was detected.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters

Example: cURL request

The following code example shows how to call this endpoint to retrieve the shared components that have a new version used by "App1".

curl "https://instance-name.service-now.com/api/sn_cdm/applications/shared_components?updatesOnly=true&appName=App1" \ 
--request GET \ 
--header "Accept:application/json" \ 
--user 'username':'password' 

Response:

{ 
  "result": [
    {
      "name": "Component_Name",
      "description": "”,
      "sharedLibraryName": "Shared Library",
      "currentVersion": "2",
      "currentVersionName": "Component_A-v2.shc",
      "updateVersionName": "Component_A-v3.shc"
    } 
  ]
}

CdmApplicationsApi - GET /sn_cdm/applications/shared_libraries/components/applications

Returns a map of shared components and the applications that use them that are within a specified library.

The CDM Admin role is required to access this endpoint.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/shared_libraries/components/applications

Default URL: /api/sn_cdm/applications/shared_libraries/components/applications

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 31. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 32. Query parameters
Name Description
sharedComponentName Required. Name of the shared component to include in the map.

Data type: String

Table: CDM Shared Component [sn_cdm_shared_component]

sharedLibraryName Required. Name of the shared library to include in the map. The specified application must have the type field set to "shared_library".

Data type: String

Table: CDM Application [sn_cdm_application]

Table 33. Request body parameters
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 34. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json or application/xml.

Default: application/json

Table 35. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 36. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad Request. A bad request type or malformed request was detected.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters

Example: cURL request

The following code example shows how to call this endpoint to retrieve the map that shows the applications in the "OracleG-Library-10" shared library that use the "paymentService-V1.1" shared component.

curl "https://instance-name.service-now.com/api/sn_cdm/applications/shared_libraries/components/applications?sharedLibraryName=OracleG-Library-10&sharedComponentName=paymentService-V1.1" \ 
--request GET \ 
--header "Accept:application/json" \ 
--user 'username':'password'

Response:

{
  "result": {
    "component_name": [
      { 
        "name": "App Name",
        "description": "desc",
        "managed_by_group": null,
        "sys_id": "4e7808bb1b371110636e0fe0604bcb08"
      }, 
      {
        "name": "Config App",
        "description": "desc",
        "managed_by_group": null,
        "sys_id": "55a75cfb1b771110636e0fe0604bcb5c"
      },
      {
        "name": "Database App",
        "description": "desc",
        "managed_by_group": null,
        "sys_id": "2eb7503f1b771110636e0fe0604bcb06"
      }
    ]
  } 
}

CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id}

Returns the current status of the specified configuration data upload request.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/upload-status/{upload_id}

Default URL: /api/sn_cdm/applications/upload-status/{upload_id}

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 37. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

upload_id Sys_id of the upload request whose status to return. This value is returned by the various CdmApplications upload request endpoints.
Table 38. Query parameters
Name Description
None
Table 39. Request body parameters (XML or JSON)
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 40. Request headers
Header Description
Accept Data format of the response body. Only supports application/json.
Table 41. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 42. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad Request. A bad request type or malformed request was detected.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters (JSON or XML)

Example: cURL request

The following example show requesting the status for an upload with the ID of 5560a6895326301096edddeeff7b1230.

curl "http://instance.servicenow.com/api/sn_cdm/applications/upload-status/5560a6895326301096edddeeff7b1230" \ 
--request GET \ 
--header "Accept:application/json" \
--user 'username':'password' 

The following are the possible return results.

// Successful completion of the upload request
{ 
  "result": { 
    "type": "upload_and_commit", 
    "state": "completed", 
    "output": { 
      "sys_id": "be681dc95362301096edddeeff7b12ba", 
      "number": "Chset-102", 
      "title": "admin2021-09-10 08:09:07", 
      "description": null, 
      "committed_at": "2021-09-10 20:23:37", 
      "committed_by": "6816f79cc0a8016401c5a33be04be441", 
      "sys_created_by": "admin", 
      "state": "committed", 
      "publish_option": "publish_none", 
      "auto_validate": false, 
      "snapshot_name": null, 
      "snapshot_description": null, 
      "cdm_application": "Demo_App1631126164773", 
      "last_conflict_detection_time": "1631305417894" 
    }, 
    "processing_state": "PROCESSED", 
    "upload_id": "5560a6895326301096edddeeff7b1230"
  } 
}

// Response when an incorrect upload_id is passed. Note: Status code is 200.
{ 
  "result": { 
    "state": "error", 
    "errors": "Invalid requestId '5560a6895326301096edddeeff7b1240'", 
    "upload_id": "5560a6895326301096edddeeff7b1240" 
  } 
} 

// Response when the upload encounters an error. The exporter_result array contains the error information. Note: Status code is 200.
{ 
  "result": { 
    "type": "upload_and_commit", 
    "state": "error", 
    "output": "Error encountered during execution of request.\nError: Node 'dbSettings' of type 'sg_cdm_node_component' cannot create child 'dbSettings' of type 'sg_cdm_node_folder'", 
    "processing_state": "PROCESSED", 
    "upload_id": "272f8a415326301096edddeeff7b1232" 
  } 
}

CdmApplicationsApi - POST /sn_cdm/applications/deployables

Creates a new deployable and automatically connects it to a specified Configuration Data Management (CDM) application.

You can create a deployable for any one of three environment types: Development, Test, or Production.

To access this endpoint the caller must have the CDM Admin role.

If you need to create multiple deployables, use the CdmApplicationsApi - POST /sn_cdm/applications/deployables/create endpoint.

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/deployables

Default URL: /api/sn_cdm/applications/deployables

Supported request parameters

Table 43. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 45. Request body parameters
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 46. Request headers
Header Description
Accept Data format of the response body. Only supports application/json.
Content-Type Data format of the request body. Only supports application/json.
Table 47. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 48. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad Request. A bad request type or malformed request was detected.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters

NameDescription
cdi_count Number of configuration data items (CDIs) contained in the associated CDM application.

Data type: Number (Integer)

cdi_usage Percentage of the CDIs used by the deployable.

Data type: Number (Integer)

cdm_app CDM application object associated with the deployable.

Data type: Object

"cdm_app": {
  "link": "String",
  "value": "String"
}
cdm_app.link Call to use to access the CDM application record using the REST Table API.

Data type: String

cdm_app.value Sys_id of the associated CDM application record.

Data type: String

Table: CDM Application [sn_cdm_application]

cdm_ci Application service object associated with the deployable.

Data type: Object

"cdm_ci": {
  "link": "String",
  "value": "String"
}
cdm_ci.link Call to use to access the application service record using the REST Table API.

Data type: String

cdm_ci.value Sys_id of the associated application service record.

Data type: String

Table: Configuration Item [cmdb_ci]

description Description of the generated CDM deployable.

Data type: String

environment_type Environment type of the deployable.
Possible values:
  • Development
  • Production
  • Test

Data type: String

error Only returned if an error occurred during processing.

Data type: Object

"error": {
  "detail": "String",
  "message": "String"
}
error.detail Additional information about the error.

Data type: String

error.message Error message that was generated while trying to process the request.

Data type: String

name Name of the CDM deployable.

Data type: String

node Details about the deployable node.

Data type: Object

"node": {
  "link": "String",
  "value": "String"
}
node.link Call to use to access the deployable node record using the REST Table API.

Data type: String

node.value Sys_id of the deployable node record.

Data type: String

Table: CDM Deployable [sn_cdm_deployable]

snapshot_version_counter Number of snapshots created for the deployable.

Data type: Number (Integer)

state Current state of the deployable.
Possible values:
  • active
  • deleted

Data type: String

sys_created_by User name of the user that created the CDM deployable. For example, able.tuter.

Data type: String

sys_created_on Date and time when the CDM deployable was created.

Data type: String

Format: YYYY-mm-DD hh:mm:ss

sys_id Sys_id of the created deployable.

Data type: String

Table: CDM Deployable [sn_cdm_deployable]

sys_updated_by User name of the user that last updated the CDM deployable. For example, able.tuter.

Data type: String

sys_updated_on Date and time when the CDM deployable was last updated.

Data type: String

Format: YYYY-mm-DD hh:mm:ss

Example: cURL request

The following code example shows how to create and associate a deployable to a CDM application.

curl "http://instance.servicenow.com/api/sn_cdm/applications/deployables?name=Dep-1&returnFields=name%2Csys_id%2Cstate&appName=testApp&envType=Test" \ 
--request POST \ 
--header "Accept:application/json" \ 
--user 'username':'password1' 

Return results:

{ 
  "result": [ 
    { 
      "cmdb_ci": { 
        "value": "f5b9e00b53901110a1d3ddeeff7b12b8", 
        "link": "http://192.168.0.233:8080/api/now/table/cmdb_ci_service_auto/f5b9e00b53901110a1d3ddeeff7b12b8" 
      }, 
      "cdi_count": "0", 
      "snapshot_version_counter": "0", 
      "description": null, 
      "sys_updated_on": "2022-06-29 12:53:57", 
      "environment_type": "Test", 
      "node": { 
        "value": "7db9e00b53901110a1d3ddeeff7b12b6", 
        "link": "http://192.168.0.233:8080/api/now/table/sn_cdm_node/7db9e00b53901110a1d3ddeeff7b12b6" 
      }, 
      "sys_id": "39b9e00b53901110a1d3ddeeff7b12b7", 
      "sys_updated_by": "admin", 
      "cdm_app": { 
        "value": "62b517a953b70110a1d3ddeeff7b128c", 
        "link": "http://192.168.0.233:8080/api/now/table/sn_cdm_application/62b517a953b70110a1d3ddeeff7b128c" 
      }, 
      "sys_created_on": "2022-06-29 12:53:57", 
      "cdi_usage": "0", 
      "name": "Dep-2", 
      "state": "active", 
      "sys_created_by": "admin" 
    } 
  ] 
}

CdmApplicationsApi - POST /sn_cdm/applications/deployables/create

Creates one or more new deployables.

You can create one of two types of deployables:
  • Deployables that must be manually connected to an Application Model (CI Service).
  • Deployables that are automatically connected to new, dynamically created Application Models (CI Services).

You can create a deployable for any one of three environment types: Development, Test, or Production. When creating multiple deployables, the auto-generated names of the deployables follow the pattern: DeployableType_Number, where Number is a running sequence number based on the creation of a new deployable. For example, if you create three deployables of type Test in an endpoint call, they are named Test_1, Test_2, and Test_3. If you then call the endpoint again, and create a different Test deployable, its auto-gen'd name is Test_4. These numbers are never reused, even if a deployable is deleted.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/deployables/create

Default URL: /api/sn_cdm/applications/deployables/create

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 49. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 51. Request body parameters (XML or JSON)
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 52. Request headers
Header Description
Accept Data format of the response body. Only supports application/json.
Content-Type Data format of the request body. Only supports application/json.
Table 53. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 54. Status codes
Status code Description
200 Successful. The request was successfully processed.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters

Example: cURL request

The following example shows how to create a single deployable and associate it with and existing CDM application.

curl "http://instance.servicenow.com/api/sn_cdm/applications/deployables/create?envType=Production&appSysId=5e118055b712011054c1e5a6ce11a9d4&quantity=5&autoConnect=true" \ 
--request POST \ 
--header "Accept:application/json" \ 
--header "Content-Type:application/json" \
--user 'username':'password' 

The following shows the possible responses to this call, both as a success and an error.

// Successful completion of the upload request
{
  "result": [
    "8ba43a3db7d6011054c1e5a6ce11a9a4",
    "93a47a3db7d6011054c1e5a6ce11a90d",
    "dba47a3db7d6011054c1e5a6ce11a91d",
    "6fa47a3db7d6011054c1e5a6ce11a921",
    "efa47a3db7d6011054c1e5a6ce11a925"
  ]
} 

// Error response
{
  "error": {
    "message": "Error: CDM Application with SysID 5e118055b712011054c1e5a6ce11a9d1 was not found. (sys_script_include.8cf0fbf453626010a1d3ddeeff7b12fe.script; line 211)",
    "detail": ""
  },
  "status": "failure"
}

CdmApplicationsApi - POST /sn_cdm/applications/deployables/exports

Submits a request to export the current snapshot for a specified application and one or more deployables into the CDM Exporter Cache [sn_cdm_exporter_cache] table.

This endpoint returns a unique identifier for the request, which you then use to call the CdmApplicationsApi - GET /sn_cdm/applications/deployables/exports/{export_id}/status endpoint to retrieve the status of the export. Once the export is complete, you can use the CdmApplicationsApi - GET /sn_cdm/applications/deployables/exports/{export_id}/content endpoint to retrieve the associated application's configuration data.

A snapshot is the complete data model of a deployable at the time a configuration change is committed. This includes any included components, collections, and vars, as well as deployable-specific vars and overrides. For additional information on deployables, see Create and update a deployable.

Note: Snapshots cannot exceed 10,000 configuration data items (CDIs) per deployable or 100,000 CDIs per application.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/deployables/exports

Default URL: /api/sn_cdm/applications/deployables/exports

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 55. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 57. Request body parameters (XML or JSON)
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 58. Request headers
Header Description
Accept Data format of the response body. Only supports application/json.
Content-Type Data format of the request body. Only supports application/json.
Table 59. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 60. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad Request. A bad request type or malformed request was detected.
Possible error messages:
  • Error: Missing required param 'appName'
  • Error: User does not have necessary permission to create Export request
  • Error: Invalid Boolean value (<xyz>).
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters

Example: cURL request

The following example requests the export of the configuration data for the following: application name = TestAppA, deployable name = DEP, using the exporter = exporter-1-primary_deployable.

curl "http://instance.servicenow.com/api/sn_cdm/applications/deployables/exports?appName=TestAppA&args=%7B%22arg_A_required%22%20%3A%20%22value%20A%22%7D&exporterName=exporter-1-primary_deployable&deployableName=DEP1" \ 
--request POST \ 
--header "Accept:application/json" \ 
--header "Content-Type:application/json" \
--user 'username':'password' 

Returns the unique identifier of the export request.

{ 
  "result": {
    "export_id": "64b5f79f5379301096edddeeff7b12eb" 
  } 
}

CdmApplicationsApi - POST /sn_cdm/applications/shared_components

Associates the specified shared component to the application within a specified changeset.

The CDM Admin role is required to access this endpoint.

Note: The specified shared component must have an associated published version (snapshot).

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/shared_components

Default URL: /api/sn_cdm/applications/shared_components

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 61. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 63. Request body parameters
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 64. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json or application/xml.

Default: application/json

Table 65. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 66. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad Request. The passed changeset doesn't exist.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters

The response fields depend on what fields were specified in the returnFields parameter in the request. The following describes some of the more important fields.

Example: cURL request

The following example shows how to call this endpoint to associate the application "App1" with the shared component "paymentService-V1.1" under the shared library "OracleG-Library-10" within the "Chset-20" changeset.

curl "https://instance.servicenow.com/api/sn_cdm/applications/shared_components?appName=App1&changesetNumber=Chset-20&sharedLibraryName=OracleG-Library-10&sharedComponentName=paymentService-V1.1" \ 
--request POST \ 
--header "Accept:application/json" \ 
--user 'username':'password'

Response:

{ 
  "result": { 
    "changeset_id": { 
      "value": "74b7ff6fc33711100c257e2cc840dd6b", 
      "link": "http://instance.servicenow.com/api/now/table/sn_cdm_changeset/74b7ff6fc33711100c257e2cc840dd6b" 
    }, 
    "node_path": "!,0!,1!/D", 
    "description": null, 
    "sys_updated_on": "2022-12-22 17:07:29", 
    "type": "sn_cdm_node_linked_shared_component", 
    "sys_class_name": "sn_cdm_node", 
    "sys_id": "ff8b37ebc3b711100c257e2cc840ddba", 
    "sys_updated_by": "admin", 
    "previous_version": null, 
    "sys_created_on": "2022-12-22 17:07:29", 
    "value": null, 
    "effective_from": null, 
    "linked_to": "210", 
    "sys_created_by": "admin", 
    "restricted_to": null, 
    "linked_to_version": { 
      "value": "581fc3e9c3b311100c257e2cc840dd17", 
      "link": "http://instance.servicenow.com/api/now/table/sn_cdm_snapshot/581fc3e9c3b311100c257e2cc840dd17" 
    }, 
    "level": "2", 
    "conflict_type": null, 
    "main_id": "483",
    "effective_to": null,
    "secure_value": null, 
    "node_classifier": "/application/components", 
    "main_id_encoded": "/D",
    "name": "LIB2_C",
    "position": null,
    "reason_for_conflict": null,
    "system_folder": false,
    "status": "new",
    "conflict": false
  } 
}

CdmApplicationsApi - POST /sn_cdm/applications/uploads/components

Submits a request to upload the passed-in configuration data for a specific component, within the system components folder, for the specified application.

This endpoint returns the ID of the upload request. Use this ID to call the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} endpoint to obtain the status of the upload.
Note: The maximum default upload content size is 2 MB. You can modify this default by updating the property sn_cdm.max_allowed_upload_file_size.

The following image shows an example of where the component configuration data is uploaded in reference to the ServiceNow DevOps Config UI. Assumes the component is dbComponent and the application is paymentSvc.

Example configuration content location within UI

Note: This upload method cannot be used to modify nodes. Use the alternative CdmApplicationsApi - POST sn_cdm/applications/uploads/components/file method to modify nodes.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/uploads/components

Default URL: /api/sn_cdm/applications/uploads/components

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 67. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 68. Query parameters
NameDescription
appName Name of the application to associate with the configuration data. This application must be in the active state.

Data type: String

Table: CDM Application [sn_cdm_application]

autoCommit Flag that indicates whether the changeset identified in the changesetNumber parameter is committed to the data model after upload.
Valid values:
  • true: Changeset is committed after upload.
  • false: Changeset isn't committed after upload.

Data type: Boolean

Default: false

autoDelete Flag that indicates whether the existing nodes, that aren’t part of the upload content, are deleted after the processing is complete.
Valid values:
  • true: Automatically delete existing nodes.
  • false: Don't automatically delete existing nodes.

Data type: Boolean

Default: false

autoValidate Flag that indicates whether the snapshots created when committed are validated.
Valid values:
  • true: Validate the snapshots.
  • false: Don't validate the snapshots.
Note: This option is only available if the autoCommit parameter is true.

Data type: Boolean

Default: false

changesetNumber String that uniquely identifies the changeset associated with the application, such as Chset-102. This changeset must be in the "Open" state.

Data type: String

Default: Creates a changeset to use. The changeset details are returned as part of the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} results.

Table: CDM Changeset [sn_cdm_changeset]

dataFormat Required. Format of the configuration data.
Valid values:
  • csv
  • ini
  • json
  • properties
  • raw
  • xml
  • yaml

Data type: String

dataFormatAttributes Only supported when the dataFormat parameter is set to csv. Attributes that define the CSV data format. For additional information, see Parsing of CSV files in CDM.

Data type: Object

"dataFormatAttributes" {
  "containsHeader": Boolean,
  "delimeter": "String"
  "headers": [Array],
  "securedHeaders": [Array]
}
dataFormatAttributes.containsHeaders Flag that indicates whether the data contains a header row.
Valid values:
  • true: Data contains a header row. The first row in the data is considered the header row.

    Header row example

  • false: Data doesn't contain a header row. You must pass the header information in the dataFormatAttributes.headers parameter.

Data type: Boolean

Default: false

dataFormatAttributes.delimeter Character to use to delineate fields within the data.

Data type: String

Default: Comma ","

dataFormatAttributes.headers Required if dataFormatAttributes.containsHeaders parameter is false. Fields in the data that comprise the header. These headers are converted to the key names of the CDIs in the JSON format. The number of headers must match the number of record fields.

Data type: Array

Default: Empty array

dataFormatAttributes.securedHeaders Fields in the data that are secure fields and must be encrypted in the data uploaded to CDM. The name of the secured headers must match the name of the headers in the headers attribute or data file. These fields are stored in a column of type Password (2 Way Encrypted).
Note: You can only secure fields using this attribute. You can't unsecure the secured fields.

Data type: Array

Default: Empty array

deleteRedundantOverrides Flag that indicates whether to create an override where redundant values are present.
Valid values:
  • true: If redundant values are present, an override isn’t created.
  • false: If redundant values are present, proceeds with an override.

Default: true

fileName Name of the file to upload. This name can differ from than the actual file name and contain the file extension. For example, .txt/.scv/.jar. The fileName value is applied when downloading the file.

Data type: String

fileNodeName Name of the file node. This file name is used in the configuration data when exporting it. This name doesn’t require a file extension nor does it affect the download.

Data type: String

identifierKeys List of names that indicate which key in an array child to use to identify the same node.

For example, if you’re uploading:

[
  {"name" : "Allan, "city" : "Paris"}, 
  {"name" : "Karen, "city" : "Sydney"}
]

in the following existing model:

[
  {"name" : "Karen, "city" : "Manila"},
  {"name" : "Allan, "city" : "Brussels"}
]

and you set identifierKeys to name, it produces the following output:

[
  {"name" : "Karen, "city" : "Sydney"},
  {"name" : "Allan, "city" : "Paris"}
]

Otherwise, it produces the following output:

[
  {"name" : "Karen, "city" : "Manila"},
  {"name" : "Allan, "city" : "Brussels"},
  {"name" : "Allan, "city" : "Paris"},
  {"name" : "Karen, "city" : "Sydney"}
]

Data type: Array of Strings

ignoreAttributes Flag that indicates whether the given data format supports attributes (currently only XML).
Valid values:
  • true: If the given data format supports attributes, any attributes in the input data are skipped during the upload.
  • false: If the given data format supports attributes, any attributes in the input data are included in the upload.

Data type: Boolean

Default: false

namePath Path of the targeted node under which the configuration data should be uploaded. This path is relative to the components, collection, or deployable folder (depending on the endpoint being called).
You can pass the name path in any of the following formats. For example, to define the name path for the node testApp/deployables/Development1/cdi1:
  • Backslash format: testApp/deployables/Development1/cdi1
    Note: If your node name contains a backslash ("/"), you can’t use this format.
  • Backend name path with replacement characters: testApp�deployables�​Development1​�​cdi1
  • Array: ['testApp','deployables','Development1','cdi1']
Note: If the specified component doesn't exist at the specified path, the system automatically creates the component at the specified path and then uploads the data.

Data type: String

sharedLibraryName Required. Name of the shared library where the component to delete is located.

Data type: String

Table: CDM Application [sn_cdm_application]

Table 69. Request body parameters (XML or JSON)
Name Description
Variable upload data Configuration data to upload. This can be any data in the format defined by the dataFormat parameter of the query parameters.

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 70. Request headers
Header Description
Accept Data format of the response body. Only supports application/json.
Content-Type Data format of the request body. Supported types: text/plain and application/x-www-form-urlencoded.

Default: text/plain

Table 71. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 72. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad request.

Upload request has been rejected.

Possible issues:
  • Size of configuration payload is greater that the allowed maximum - 2 MB by default.
  • Required parameters are missing from the call.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters (JSON or XML)

NameDescription
error If an error occurred during processing, the details about the error.

Data type: Object

"error": {
  "detail": "String",
  "message": "String"
}
error.detail Additional information about the error.

Data type: String

error.message Error message that was generated while trying to process the request.

Data type: String

status Error status of the request.

Possible values: failure

Data type: String

upload_id Sys_id of the upload request. Use this ID to call the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} endpoint to obtain the status of the upload.

Data type: String

Example: cURL request

The following example shows an upload request for the application Demo_App1631126164773.

curl "http://instance.servicenow.com/api/sn_cdm/applications/uploads/components?namePath=%2FSettings%2FdbSettings&dataFormat=json&appName=Demo_App1631126164773&changesetNumber=Chset-8&autoCommit=false&publishOption=publish_none&autoValidate=false&autoDelete=true" \ 
--request POST \ 
--header "Accept:application/json" \ 
--header "Content-Type:text/plain" \ 
--data "{
  \"dbIPAddress\": \"10.10.10.110\",
  \"dbPort\": \"8080\",
  \"dbConnectionString\": \"admin:admin server1.xyz.com:8080 dbName_payments\",
  \"dbConnectionStringBackup\": \"admin:admin server2.xyz.com dbName_payments_backup\
"}" \ 
--user 'username':'password' 

The following return results show both a successful and an error response for this request.

// Successful completion of the upload request
{ 
  "result": { 
    "upload_id": "ec1f71f45322301096edddeeff7b12b3" 
  } 
} 

// Error response. Payload is too large.
{ 
  "error": { 
    "message": "Size of uploaded data:6853632.0(bytes) is greater than max allowed upload limit of 2097152.0(bytes)", 
    "detail": "" 
  },
  "status": "failure"
}

CdmApplicationsApi - POST sn_cdm/applications/uploads/components/file

Uploads files as part of the Configuration Data Model (CDM) to the components folder.

Use this method to upload to a components file node.

URL format

Versioned URL: POST /api/sn_cdm/{api_version}/applications/uploads/components/file

Default URL: POST /api/sn_cdm/applications/uploads/components/file

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 73. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 74. Query parameters
NameDescription
appName Name of the application to associate with the configuration data. This application must be in the active state.

Data type: String

Table: CDM Application [sn_cdm_application]

autoCommit Flag that indicates whether the changeset identified in the changesetNumber parameter is committed to the data model after upload.
Valid values:
  • true: Changeset is committed after upload.
  • false: Changeset isn't committed after upload.

Data type: Boolean

Default: false

autoValidate Flag that indicates whether the snapshots created when committed are validated.
Valid values:
  • true: Validate the snapshots.
  • false: Don't validate the snapshots.
Note: This option is only available if the autoCommit parameter is true.

Data type: Boolean

Default: false

changesetNumber String that uniquely identifies the changeset associated with the application, such as Chset-102. This changeset must be in the "Open" state.

Data type: String

Default: Creates a changeset to use. The changeset details are returned as part of the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} results.

Table: CDM Changeset [sn_cdm_changeset]

fileName Name of the file to upload. This name can differ from than the actual file name and contain the file extension. For example, .txt/.scv/.jar. The fileName value is applied when downloading the file.

Data type: String

fileNodeName Name of the file node. This file name is used in the configuration data when exporting it. This name doesn’t require a file extension nor does it affect the download.

Data type: String

namePath Path of the targeted node under which the configuration data should be uploaded. This path is relative to the components, collection, or deployable folder (depending on the endpoint being called).
You can pass the name path in any of the following formats. For example, to define the name path for the node testApp/deployables/Development1/cdi1:
  • Backslash format: testApp/deployables/Development1/cdi1
    Note: If your node name contains a backslash ("/"), you can’t use this format.
  • Backend name path with replacement characters: testApp�deployables�​Development1​�​cdi1
  • Array: ['testApp','deployables','Development1','cdi1']
Note: If the specified component doesn't exist at the specified path, the system automatically creates the component at the specified path and then uploads the data.

Data type: String

publishOption
Publish option for the associated configured snapshots.
Valid values:
  • publish_none: Don't publish any snapshots.
  • publish_valid: Publish only those snapshots that pass validation after the commit.

For additional information on publishing snapshots, see Publish or unpublish a snapshot.

Data type: String

Default: publish_none

Note: This option is only available if the value for the autoCommit parameter is true.
Table 75. Request body parameters (XML or JSON)
Name Description
Variable upload data Configuration data to upload. By default, file size uploads are limited to 5 MB. For information about how to adjust your upload file sizes and type, see this Now Support article.

Data type: String/stream

Headers

Table 76. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json or application/xml.

Default: application/json

Content-Type Data type of the file to be uploaded. Supported types: application/zip, text/plain, application/json.

Default: application/json

Table 77. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 78. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad request.

Upload request has been rejected.

Possible issues:
  • Size of configuration payload is greater that the allowed maximum - 2 MB by default.
  • Required parameters are missing from the call.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters (JSON or XML)

NameDescription
error If an error occurred during processing, the details about the error.

Data type: Object

"error": {
  "detail": "String",
  "message": "String"
}
error.detail Additional information about the error.

Data type: String

error.message Error message that was generated while trying to process the request.

Data type: String

status Error status of the request.

Possible values: failure

Data type: String

upload_id Sys_id of the upload request. Use this ID to call the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} endpoint to obtain the status of the upload.

Data type: String

Example: cURL request

The following example shows how to upload a content to a text file.

curl "http://instance.servicenow.com/api/sn_cdm/applications/uploads/components/file?autoValidate=true&appName=testApp&namePath=testComponent%2FfilesFolder&fileName=testFileNodeName.txt&publishOption=publish_valid&changesetNumber=Chset-108&autoCommit=true&fileNodeName=testFile.txt" \ 
--request POST \ 
--header "Accept:application/json" \ 
--header "Content-Type:text/plain" \ 
--data "This is sample content that will be uploaded to a plain text file."\ 
--user 'username':'password' 

The following return results show both a successful and an error response for this request.

// Successful completion of the upload request
{ 
  "result": { 
    "upload_id": "ec1f71f45322301096edddeeff7b12b3" 
  } 
} 

// Error response. Payload is too large.
{ 
  "error": { 
    "message": "Could not find active application with name: ‘testApp’ of type application", 
    "detail": "" 
  },
  "status": "failure"
}

CdmApplicationsApi - POST /sn_cdm/applications/uploads/components/vars

Submits a request to upload the passed-in configuration data under the vars folder, within the system components folder, for the specified application.

The following image shows an example of where the component's vars configuration data is uploaded in reference to the ServiceNow DevOps Config Workspace UI. Assumes the application is paymentSvc.

Upload vars directory

Note: The maximum default upload content size is 2 MB. You can modify this default by updating the property sn_cdm.max_allowed_upload_file_size.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/uploads/components/vars

Default URL: /api/sn_cdm/applications/uploads/components/vars

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 79. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 80. Query parameters
NameDescription
appName Name of the application to associate with the configuration data. This application must be in the active state.

Data type: String

Table: CDM Application [sn_cdm_application]

autoCommit Flag that indicates whether the changeset identified in the changesetNumber parameter is committed to the data model after upload.
Valid values:
  • true: Changeset is committed after upload.
  • false: Changeset isn't committed after upload.

Data type: Boolean

Default: false

autoDelete Flag that indicates whether the existing nodes, that aren’t part of the upload content, are deleted after the processing is complete.
Valid values:
  • true: Automatically delete existing nodes.
  • false: Don't automatically delete existing nodes.

Data type: Boolean

Default: false

autoValidate Flag that indicates whether the snapshots created when committed are validated.
Valid values:
  • true: Validate the snapshots.
  • false: Don't validate the snapshots.
Note: This option is only available if the autoCommit parameter is true.

Data type: Boolean

Default: false

changesetNumber String that uniquely identifies the changeset associated with the application, such as Chset-102. This changeset must be in the "Open" state.

Data type: String

Default: Creates a changeset to use. The changeset details are returned as part of the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} results.

Table: CDM Changeset [sn_cdm_changeset]

dataFormat Required. Format of the configuration data.
Valid values:
  • ini
  • json
  • properties
  • raw
  • xml
  • yaml

Data type: String

deleteRedundantOverrides Flag that indicates whether to create an override where redundant values are present.
Valid values:
  • true: If redundant values are present, an override isn’t created.
  • false: If redundant values are present, proceeds with an override.

Default: true

fileName Name of the file to upload. This name can differ from than the actual file name and contain the file extension. For example, .txt/.scv/.jar. The fileName value is applied when downloading the file.

Data type: String

fileNodeName Name of the file node. This file name is used in the configuration data when exporting it. This name doesn’t require a file extension nor does it affect the download.

Data type: String

identifierKeys List of names that indicate which key in an array child to use to identify the same node.

For example, if you’re uploading:

[
  {"name" : "Allan, "city" : "Paris"}, 
  {"name" : "Karen, "city" : "Sydney"}
]

in the following existing model:

[
  {"name" : "Karen, "city" : "Manila"},
  {"name" : "Allan, "city" : "Brussels"}
]

and you set identifierKeys to name, it produces the following output:

[
  {"name" : "Karen, "city" : "Sydney"},
  {"name" : "Allan, "city" : "Paris"}
]

Otherwise, it produces the following output:

[
  {"name" : "Karen, "city" : "Manila"},
  {"name" : "Allan, "city" : "Brussels"},
  {"name" : "Allan, "city" : "Paris"},
  {"name" : "Karen, "city" : "Sydney"}
]

Data type: Array of Strings

ignoreAttributes Flag that indicates whether the given data format supports attributes (currently only XML).
Valid values:
  • true: If the given data format supports attributes, any attributes in the input data are skipped during the upload.
  • false: If the given data format supports attributes, any attributes in the input data are included in the upload.

Data type: Boolean

Default: false

namePath Path of the targeted node under which the configuration data should be uploaded. This path is relative to the components, collection, or deployable folder (depending on the endpoint being called).
You can pass the name path in any of the following formats. For example, to define the name path for the node testApp/deployables/Development1/cdi1:
  • Backslash format: testApp/deployables/Development1/cdi1
    Note: If your node name contains a backslash ("/"), you can’t use this format.
  • Backend name path with replacement characters: testApp�deployables�​Development1​�​cdi1
  • Array: ['testApp','deployables','Development1','cdi1']
Note: If the specified component doesn't exist at the specified path, the system automatically creates the component at the specified path and then uploads the data.

Data type: String

sharedLibraryName Required. Name of the shared library where the component to delete is located.

Data type: String

Table: CDM Application [sn_cdm_application]

Table 81. Request body parameters (XML or JSON)
Name Description
Variable upload data Configuration data to upload. This can be any data in the format defined by the dataFormat parameter of the query parameters.

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 82. Request headers
Header Description
Accept Data format of the response body. Only supports application/json.
Content-Type Data format of the request body. Supported types: text/plain and application/x-www-form-urlencoded.

Default: text/plain

Table 83. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 84. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad request.

Upload request has been rejected.

Possible issues:
  • Size of configuration payload is greater that the allowed maximum - 2 MB by default.
  • Required parameters are missing from the call.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters (JSON or XML)

NameDescription
error If an error occurred during processing, the details about the error.

Data type: Object

"error": {
  "detail": "String",
  "message": "String"
}
error.detail Additional information about the error.

Data type: String

error.message Error message that was generated while trying to process the request.

Data type: String

status Error status of the request.

Possible values: failure

Data type: String

upload_id Sys_id of the upload request. Use this ID to call the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} endpoint to obtain the status of the upload.

Data type: String

Example: cURL request

The following example shows a vars upload request for the application Demo_App1631126164773.

curl "http://instance.servicenow.com/api/sn_cdm/applications/uploads/components/vars?changesetNumber=Chset-102&autoValidate=false&autoDelete=true&publishOption=publish_none&appName=Demo_App1631126164773&namePath=%2FSettings%2FdbSettings&autoCommit=false&dataFormat=json" \ 
--request POST \ 
--header "Accept:application/json" \ 
--header "Content-Type:text/plain" \ 
--data "{ 
  \"dbSettings\": { 
    \"dbIPAddress\": \"10.10.10.110\", 
    \"dbPort\": \"8080\", 
    \"dbConnectionString\": \"username:password server1.xyz.com:8080 dbName_payments\", 
    \"dbConnectionStringBackup\": \"username:password server2.xyz.com dbName_payments_backup\"
  } 
}"
--user 'username':'password' 

The following return results show both a successful and an error response for this request.

// Successful completion of the upload request
{ 
  "result": { 
    "upload_id": "d21f71f45322301096eccceaff7b1ce3" 
  } 
} 

// Error response. Payload is too large.
{ 
  "error": { 
    "message": "Size of uploaded data:6853632.0(bytes) is greater than max allowed upload limit of 2097152.0(bytes)", 
    "detail": "" 
  },
  "status": "failure"
}

CdmApplicationsApi - POST /sn_cdm/applications/uploads/collections

Submits a request to upload the passed-in configuration data for a specific collection, within the system collections folder, for the specified application.

This endpoint returns the ID of the upload request. Use this ID to call the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} endpoint to obtain the status of the upload.
Note: The maximum default upload content size is 2 MB. You can modify this default by updating the property sn_cdm.max_allowed_upload_file_size.

The following image shows an example of where the configuration data is uploaded in reference to the ServiceNow DevOps Config Workspace UI. Assumes the collection is db0Release1.0 and the application is paymentSvc.

Collections upload folder

Note: This upload method cannot be used to modify nodes. Use the alternative CdmApplicationsApi - POST /sn_cdm/applications/uploads/collections/file method to modify nodes.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/uploads/collections

Default URL: /api/sn_cdm/applications/uploads/collections

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 85. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 86. Query parameters
NameDescription
appName Name of the application to associate with the configuration data. This application must be in the active state.

Data type: String

Table: CDM Application [sn_cdm_application]

autoCommit Flag that indicates whether the changeset identified in the changesetNumber parameter is committed to the data model after upload.
Valid values:
  • true: Changeset is committed after upload.
  • false: Changeset isn't committed after upload.

Data type: Boolean

Default: false

autoDelete Flag that indicates whether the existing nodes, that aren’t part of the upload content, are deleted after the processing is complete.
Valid values:
  • true: Automatically delete existing nodes.
  • false: Don't automatically delete existing nodes.

Data type: Boolean

Default: false

autoValidate Flag that indicates whether the snapshots created when committed are validated.
Valid values:
  • true: Validate the snapshots.
  • false: Don't validate the snapshots.
Note: This option is only available if the autoCommit parameter is true.

Data type: Boolean

Default: false

changesetNumber String that uniquely identifies the changeset associated with the application, such as Chset-102. This changeset must be in the "Open" state.

Data type: String

Default: Creates a changeset to use. The changeset details are returned as part of the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} results.

Table: CDM Changeset [sn_cdm_changeset]

collectionName Required. Name of the collection under which to store the uploaded payload.
Note: If the specified namePath does not exist under this collection, the system automatically creates the component(s) under this collection and then uploads the configuration content. For example, if you want to upload the collection collA, with the path compA/comp/compC, the data is uploaded under /collA/collections/compa/compB/compC.

If compA exists but not compB and compC, then the endpoint creates these components and uploads the data under compC.

Data type: String

dataFormat Required. Format of the configuration data.
Valid values:
  • csv
  • ini
  • json
  • properties
  • raw
  • xml
  • yaml

Data type: String

dataFormatAttributes Only supported when the dataFormat parameter is set to csv. Attributes that define the CSV data format. For additional information, see Parsing of CSV files in CDM.

Data type: Object

"dataFormatAttributes" {
  "containsHeader": Boolean,
  "delimeter": "String"
  "headers": [Array],
  "securedHeaders": [Array]
}
dataFormatAttributes.containsHeaders Flag that indicates whether the data contains a header row.
Valid values:
  • true: Data contains a header row. The first row in the data is considered the header row.

    Header row example

  • false: Data doesn't contain a header row. You must pass the header information in the dataFormatAttributes.headers parameter.

Data type: Boolean

Default: false

dataFormatAttributes.delimeter Character to use to delineate fields within the data.

Data type: String

Default: Comma ","

dataFormatAttributes.headers Required if dataFormatAttributes.containsHeaders parameter is false. Fields in the data that comprise the header. These headers are converted to the key names of the CDIs in the JSON format. The number of headers must match the number of record fields.

Data type: Array

Default: Empty array

dataFormatAttributes.securedHeaders Fields in the data that are secure fields and must be encrypted in the data uploaded to CDM. The name of the secured headers must match the name of the headers in the headers attribute or data file. These fields are stored in a column of type Password (2 Way Encrypted).
Note: You can only secure fields using this attribute. You can't unsecure the secured fields.

Data type: Array

Default: Empty array

deleteRedundantOverrides Flag that indicates whether to create an override where redundant values are present.
Valid values:
  • true: If redundant values are present, an override isn’t created.
  • false: If redundant values are present, proceeds with an override.

Default: true

ignoreAttributes Flag that indicates whether the given data format supports attributes (currently only XML).
Valid values:
  • true: If the given data format supports attributes, any attributes in the input data are skipped during the upload.
  • false: If the given data format supports attributes, any attributes in the input data are included in the upload.

Data type: Boolean

Default: false

namePath Path of the targeted node under which the configuration data should be uploaded. This path is relative to the components, collection, or deployable folder (depending on the endpoint being called).
You can pass the name path in any of the following formats. For example, to define the name path for the node testApp/deployables/Development1/cdi1:
  • Backslash format: testApp/deployables/Development1/cdi1
    Note: If your node name contains a backslash ("/"), you can’t use this format.
  • Backend name path with replacement characters: testApp�deployables�​Development1​�​cdi1
  • Array: ['testApp','deployables','Development1','cdi1']
Note: If the specified component doesn't exist at the specified path, the system automatically creates the component at the specified path and then uploads the data.

Data type: String

Table 87. Request body parameters (XML or JSON)
Name Description
Variable upload data Configuration data to upload. This can be any data in the format defined by the dataFormat parameter of the query parameters.

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 88. Request headers
Header Description
Accept Data format of the response body. Only supports application/json.
Content-Type Data format of the request body. Supported types: text/plain and application/x-www-form-urlencoded.

Default: text/plain

Table 89. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 90. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad request.

Upload request has been rejected.

Possible issues:
  • Size of configuration payload is greater that the allowed maximum - 2 MB by default.
  • Required parameters are missing from the call.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters (JSON or XML)

NameDescription
error If an error occurred during processing, the details about the error.

Data type: Object

"error": {
  "detail": "String",
  "message": "String"
}
error.detail Additional information about the error.

Data type: String

error.message Error message that was generated while trying to process the request.

Data type: String

status Error status of the request.

Possible values: failure

Data type: String

upload_id Sys_id of the upload request. Use this ID to call the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} endpoint to obtain the status of the upload.

Data type: String

Example: cURL request

This example shows how to upload JSON-formatted dbSettings configuration date into the collections folder for the application Demo_App1631126164773.

curl "http://instance.servicenow.com/api/sn_cdm/applications/uploads/collections?dataFormat=json&autoValidate=false&changesetNumber=Chset-102&appName=Demo_App1631126164773&autoDelete=true&namePath=%2FSettings%2FdbSettings&collectionName=release-1.0&autoCommit=false&publishOption=publish_none" \ 
--request POST \ 
--header "Accept:application/json" \ 
--header "Content-Type:text/plain" \ 
--data "{ 
  \"dbSettings\": { 
    \"dbIPAddress\": \"10.10.10.110\", 
    \"dbPort\": \"8080\", 
    \"dbConnectionString\": \"admin:admin server1.xyz.com:8080 dbName_payments\", 
    \"dbConnectionStringBackup\": \"admin:admin server2.xyz.com dbName_payments_backup\" 
  } 
}" \ 
--user 'username':'password' 

The following shows the possible responses to this call, both as a success and an error.

// Successful completion of the upload request
{ 
  "result": { 
    "upload_id": "ec1f71f45322301096edddeeff7b12b3" 
  } 
} 

// Error response. Payload is too large.
{ 
  "error": { 
    "message": "Size of uploaded data:6853632.0(bytes) is greater than max allowed upload limit of 2097152.0(bytes)", 
    "detail": "" 
  },
  "status": "failure"
}

CdmApplicationsApi - POST /sn_cdm/applications/uploads/collections/file

Uploads a file to the collections folder in the Configuration Data Model (CDM).

URL format

Versioned URL: POST /api/sn_cdm/{api_version}/applications/uploads/collections/file

Default URL: POST /api/sn_cdm/applications/uploads/collections/file

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 91. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 92. Query parameters
NameDescription
appName Name of the application to associate with the configuration data. This application must be in the active state.

Data type: String

Table: CDM Application [sn_cdm_application]

autoCommit Flag that indicates whether the changeset identified in the changesetNumber parameter is committed to the data model after upload.
Valid values:
  • true: Changeset is committed after upload.
  • false: Changeset isn't committed after upload.

Data type: Boolean

Default: false

autoValidate Flag that indicates whether the snapshots created when committed are validated.
Valid values:
  • true: Validate the snapshots.
  • false: Don't validate the snapshots.
Note: This option is only available if the autoCommit parameter is true.

Data type: Boolean

Default: false

collectionName Required. Name of the collection under which to store the uploaded payload.
Note: If the specified namePath does not exist under this collection, the system automatically creates the component(s) under this collection and then uploads the configuration content. For example, if you want to upload the collection collA, with the path compA/comp/compC, the data is uploaded under /collA/collections/compa/compB/compC. If compA exists but not compB and compC, then the endpoint creates these components and uploads the data under compC.

Data type: String

changesetNumber String that uniquely identifies the changeset associated with the application, such as Chset-102. This changeset must be in the "Open" state.

Data type: String

Default: Creates a changeset to use. The changeset details are returned as part of the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} results.

Table: CDM Changeset [sn_cdm_changeset]

fileName Name of the file to upload. This name can differ from than the actual file name and contain the file extension. For example, .txt/.scv/.jar. The fileName value is applied when downloading the file.

Data type: String

fileNodeName Name of the file node. This file name is used in the configuration data when exporting it. This name doesn’t require a file extension nor does it affect the download.

Data type: String

namePath Path of the targeted node under which the configuration data should be uploaded. This path is relative to the components, collection, or deployable folder (depending on the endpoint being called).
You can pass the name path in any of the following formats. For example, to define the name path for the node testApp/deployables/Development1/cdi1:
  • Backslash format: testApp/deployables/Development1/cdi1
    Note: If your node name contains a backslash ("/"), you can’t use this format.
  • Backend name path with replacement characters: testApp�deployables�​Development1​�​cdi1
  • Array: ['testApp','deployables','Development1','cdi1']
Note: If the specified component doesn't exist at the specified path, the system automatically creates the component at the specified path and then uploads the data.

Data type: String

publishOption
Publish option for the associated configured snapshots.
Valid values:
  • publish_none: Don't publish any snapshots.
  • publish_valid: Publish only those snapshots that pass validation after the commit.

For additional information on publishing snapshots, see Publish or unpublish a snapshot.

Data type: String

Default: publish_none

Note: This option is only available if the value for the autoCommit parameter is true.
Table 93. Request body parameters (XML or JSON)
Name Description
Variable upload data Configuration data to upload. By default, file size uploads are limited to 5 MB. For information about how to adjust your upload file sizes and type, see this Now Support article.

Data type: String/stream

Headers

Table 94. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json or application/xml.

Default: application/json

Content-Type Content Type of the file to be uploaded. Examples: application/zip, text/plain, application/json.
Table 95. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 96. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad request.

Upload request has been rejected.

Possible issues:
  • Size of configuration payload is greater that the allowed maximum - 2 MB by default.
  • Required parameters are missing from the call.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters (JSON or XML)

NameDescription
error If an error occurred during processing, the details about the error.

Data type: Object

"error": {
  "detail": "String",
  "message": "String"
}
error.detail Additional information about the error.

Data type: String

error.message Error message that was generated while trying to process the request.

Data type: String

status Error status of the request.

Possible values: failure

Data type: String

upload_id Sys_id of the upload request. Use this ID to call the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} endpoint to obtain the status of the upload.

Data type: String

Example: cURL request

The following call uploads a plain text file to the CDM collections folder.

curl "http://instance.servicenow.com/api/sn_cdm/applications/uploads/collections/file?autoValidate=true&collectionName=collA&appName=testApp&namePath=testComponent%2FfilesFolder&fileName=testFileNodeName.txt&publishOption=publish_valid&changesetNumber=Chset-108&autoCommit=true&fileNodeName=testFile.txt" \ 
--request POST \ 
--header "Accept:application/json" \ 
--header "Content-Type:text/plain" \ 
--data "This is sample content that will be uploaded to a plain text file."\ 
--user 'username':'password'

The following return results show both a successful and an error response to this request.

// Successful completion of the upload request
{ 
  "result": { 
    "upload_id": "ec1f71f45322301096edddeeff7b12b3" 
  } 
} 

// Error response. Payload is too large.
{ 
  "error": { 
    "message": "Could not find active application with name: ‘testApp’ of type application", 
    "detail": "" 
  },
  "status": "failure"
}

CdmApplicationsApi - POST /sn_cdm/applications/uploads/deployables

Submits a request to upload the configuration content for a specific deployable within the deployables system folder of a specified application.

This endpoint returns the ID of the upload request. Use this ID to call the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} endpoint to obtain the status of the upload.
Note: The maximum default upload content size is 2 MB. You can modify this default by updating the property sn_cdm.max_allowed_upload_file_size.

The following image shows an example of where the deployable configuration data is uploaded in reference to the ServiceNow DevOps Config UI. Assumes the deployable is Development_1 and the application is paymentSvc.

Deployables config data location in UI

Note: This upload method cannot be used to modify nodes. Use the alternative CdmApplicationsApi - POST /sn_cdm/applications/uploads/deployables/file method to modify nodes.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/uploads/deployables

Default URL: /api/sn_cdm/applications/uploads/deployables

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 97. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 99. Request body parameters (XML or JSON)
Name Description
Variable upload data Configuration data to upload. This can be any data in the format defined by the dataFormat parameter of the query parameters.

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 100. Request headers
Header Description
Accept Data format of the response body. Only supports application/json.
Content-Type Data format of the request body. Supported types: text/plain and application/x-www-form-urlencoded.

Default: text/plain

Table 101. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 102. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad request.

Upload request has been rejected.

Possible issues:
  • Size of configuration payload is greater that the allowed maximum - 2 MB by default.
  • Required parameters are missing from the call.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters (JSON or XML)

NameDescription
error If an error occurred during processing, the details about the error.

Data type: Object

"error": {
  "detail": "String",
  "message": "String"
}
error.detail Additional information about the error.

Data type: String

error.message Error message that was generated while trying to process the request.

Data type: String

status Error status of the request.

Possible values: failure

Data type: String

upload_id Sys_id of the upload request. Use this ID to call the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} endpoint to obtain the status of the upload.

Data type: String

Example: cURL request

The following example shows an upload request for the application Demo_App1631126164773.

curl "http://instance.servicenow.com/api/sn_cdm/applications/uploads/deployables?deployableName=TST-1&autoValidate=false&dataFormat=json&autoDelete=false&changesetNumber=Chset-102&appName=Demo_App1631126164773&publishOption=publish_none&autoCommit=true&namePath=%2FSettings%2FdbSettings" \ 
--request POST \ 
--header "Accept:application/json" \ 
--header "Content-Type:text/plain" \ 
--data "{
  \"dbIPAddress\": \"10.10.10.110\",
  \"dbPort\": \"8080\",
  \"dbConnectionString\": \"admin:admin server1.xyz.com:8080 dbName_payments\",
  \"dbConnectionStringBackup\": \"admin:admin server2.xyz.com dbName_payments_backup\"
}" \ 
--user 'username':'password' 

The following return results show both a successful and an error response for this request.

// Successful completion of the upload request
{ 
  "result": { 
    "upload_id": "ec1f71f45322301096edddeeff7b12b3" 
  } 
} 

// Error response. Payload is too large.
{ 
  "error": { 
    "message": "Size of uploaded data:6853632.0(bytes) is greater than max allowed upload limit of 2097152.0(bytes)", 
    "detail": "" 
  },
  "status": "failure"
}

CdmApplicationsApi - POST /sn_cdm/applications/uploads/deployables/file

Uploads files to the deployables folder in the Configuration Data Model (CDM).

URL format

Versioned URL: POST /api/sn_cdm/{api_version}/applications/uploads/deployables/file

Default URL: POST /api/sn_cdm/applications/uploads/deployables/file

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 103. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 104. Query parameters
NameDescription
appName Name of the application to associate with the configuration data. This application must be in the active state.

Data type: String

Table: CDM Application [sn_cdm_application]

autoCommit Flag that indicates whether the changeset identified in the changesetNumber parameter is committed to the data model after upload.
Valid values:
  • true: Changeset is committed after upload.
  • false: Changeset isn't committed after upload.

Data type: Boolean

Default: false

autoValidate Flag that indicates whether the snapshots created when committed are validated.
Valid values:
  • true: Validate the snapshots.
  • false: Don't validate the snapshots.
Note: This option is only available if the autoCommit parameter is true.

Data type: Boolean

Default: false

changesetNumber String that uniquely identifies the changeset associated with the application, such as Chset-102. This changeset must be in the "Open" state.

Data type: String

Default: Creates a changeset to use. The changeset details are returned as part of the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} results.

Table: CDM Changeset [sn_cdm_changeset]

deployableName Required. Name of the CDM deployable for which to map the policy.

Data type: String

Table: CDM Deployable [sn_cdm_deployable]

fileName Name of the file to upload. This name can differ from than the actual file name and contain the file extension. For example, .txt/.scv/.jar. The fileName value is applied when downloading the file.

Data type: String

fileNodeName Name of the file node. This file name is used in the configuration data when exporting it. This name doesn’t require a file extension nor does it affect the download.

Data type: String

namePath Path of the targeted node under which the configuration data should be uploaded. This path is relative to the components, collection, or deployable folder (depending on the endpoint being called).
You can pass the name path in any of the following formats. For example, to define the name path for the node testApp/deployables/Development1/cdi1:
  • Backslash format: testApp/deployables/Development1/cdi1
    Note: If your node name contains a backslash ("/"), you can’t use this format.
  • Backend name path with replacement characters: testApp�deployables�​Development1​�​cdi1
  • Array: ['testApp','deployables','Development1','cdi1']
Note: If the specified component doesn't exist at the specified path, the system automatically creates the component at the specified path and then uploads the data.

Data type: String

publishOption
Publish option for the associated configured snapshots.
Valid values:
  • publish_none: Don't publish any snapshots.
  • publish_valid: Publish only those snapshots that pass validation after the commit.

For additional information on publishing snapshots, see Publish or unpublish a snapshot.

Data type: String

Default: publish_none

Note: This option is only available if the value for the autoCommit parameter is true.
Table 105. Request body parameters (XML or JSON)
Name Description
Variable upload data Configuration data to upload. By default, file size uploads are limited to 5 MB. For information about how to adjust your upload file sizes and type, see this Now Support article.

Data type: String/stream

Headers

Table 106. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json or application/xml.

Default: application/json

Content-Type Data type of the file to be uploaded. Supported types: application/zip, text/plain, application/json.

Default: application/json

Table 107. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 108. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad request.

Upload request has been rejected.

Possible issues:
  • Size of configuration payload is greater that the allowed maximum - 2 MB by default.
  • Required parameters are missing from the call.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters (JSON or XML)

NameDescription
error If an error occurred during processing, the details about the error.

Data type: Object

"error": {
  "detail": "String",
  "message": "String"
}
error.detail Additional information about the error.

Data type: String

error.message Error message that was generated while trying to process the request.

Data type: String

status Error status of the request.

Possible values: failure

Data type: String

upload_id Sys_id of the upload request. Use this ID to call the CdmApplicationsApi - GET /sn_cdm/applications/upload-status/{upload_id} endpoint to obtain the status of the upload.

Data type: String

Example: cURL request

The following request uploads a plain text file to the deployables folder of the CDM application.

curl "http://instance.servicenow.com/api/sn_cdm/applications/uploads/deployables/file?autoValidate=true&deployableName=depA&appName=testApp&namePath=testComponent%2FfilesFolder&fileName=testFileNodeName.txt&publishOption=publish_valid&changesetNumber=Chset-108&autoCommit=true&fileNodeName=testFile.txt" \ 
--request POST \ 
--header "Accept:application/json" \ 
--header "Content-Type:text/plain" \ 
--data "This is sample content that will be uploaded to a plain text file."\ 
--user 'username':'password' 

The following return results show both a successful and an error response to this request.

// Successful completion of the upload request
{ 
  "result": { 
    "upload_id": "ec1f71f45322301096edddeeff7b12b3" 
  } 
} 

// Error response. Payload is too large.
{ 
  "error": { 
    "message": "Could not find active application with name: ‘testApp’ of type application", 
    "detail": "" 
  },
  "status": "failure"
}

CdmApplicationsApi - PUT /sn_cdm/applications/deployables

Updates the specified shared component in an application within a specified changeset.

Allows an update to the following fields:
  • Name
  • Description
  • Application Service\Dynamic CI Group
  • Deployable identifier

The CDM Admin role is required to access this endpoint.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/deployables

Default URL: /api/sn_cdm/applications/deployables

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 109. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 111. Request body parameters (XML or JSON)
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 112. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 113. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad request. A bad request type or malformed request was detected.
500 Internal Server Error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters (JSON or XML)

Example: cURL request

curl "http://localhost:8080/api/sn_cdm/applications/deployables?appName=testApp&name=Dep-1" \ 
--request PUT\ 
--header "Accept:application/json" \ 
--user 'cdm_admin':'password1!' 

Output:

{ 
  "result": { 
    "identifier": "identiy1", 
    "cmdb_ci": { 
      "value": "f5b9e00b53901110a1d3ddeeff7b12b8", 
      "link": "http://192.168.0.233:8080/api/now/table/cmdb_ci_service_auto/f5b9e00b53901110a1d3ddeeff7b12b8" 
    }, 
    "cdi_count": "3", 
    "snapshot_version_counter": "1", 
    "description": "cdcds", 
    "sys_updated_on": "2022-07-27 13:40:13", 
    "environment_type": "Test", 
    "node": { 
      "value": "30c00d4053015110a1d3ddeeff7b12bf", 
      "link": "http://192.168.0.233:8080/api/now/table/sn_cdm_node/30c00d4053015110a1d3ddeeff7b12bf" 
    }, 
    "sys_id": "39b9e00b53901110a1d3ddeeff7b12b7", 
    "sys_updated_by": "admin", 
    "cdm_app": { 
      "value": "62b517a953b70110a1d3ddeeff7b128c", 
      "link": "http://192.168.0.233:8080/api/now/table/sn_cdm_application/62b517a953b70110a1d3ddeeff7b128c" 
    }, 
    "sys_created_on": "2022-06-29 12:53:57", 
    "cdi_usage": "0.03", 
    "name": "Dep-2", 
    "state": "active", 
    "sys_created_by": "admin" 
  } 
} 

CdmApplicationsApi - PUT /sn_cdm/applications/shared_components

Updates the specified shared component in an application within a specified changeset.

The CDM Admin role is required to access this endpoint.

URL format

Versioned URL: /api/sn_cdm/{api_version}/applications/shared_components

Default URL: /api/sn_cdm/applications/shared_components

Note: Available versions are specified in the REST API Explorer. For scripted REST APIs there is additional version information on the Scripted REST Service form.

Supported request parameters

Table 114. Path parameters
Name Description
api_version Optional. Version of the endpoint to access. For example, v1 or v2. Only specify this value to use an endpoint version other than the latest.

Data type: String

Table 116. Request body parameters
Name Description
None

Headers

The following request and response headers apply to this HTTP action only, or apply to this action in a distinct way. For a list of general headers used in the REST API, see Supported REST API headers.

Table 117. Request headers
Header Description
Accept Data format of the response body. Supported types: application/json or application/xml.

Default: application/json

Table 118. Response headers
Header Description
None

Status codes

The following status codes apply to this HTTP action. For a list of possible status codes used in the REST API, see REST API HTTP response codes.

Table 119. Status codes
Status code Description
200 Successful. The request was successfully processed.
400 Bad Request. The passed changeset does not exist.
500 Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error.

Response body parameters

The response fields depend on what fields were specified in the returnFields parameter in the request. The following describes some of the more important fields.

Example: cURL request

The following example shows how to call this endpoint to update the application "App1" with the shared component "paymentService-V1.1" under the shared library "OracleG-Library-10" within the "Chset-20" changeset.

"https://instance-name.service-now.com/api/sn_cdm/applications/shared_components?sharedComponentName=paymentService-V1.1&sharedLibraryName=OracleG-Library-10&changesetNumber=Chset-20&versionName=sComp3-v2.shc&appName=App1" \ 
--request PUT \ 
--header "Accept:application/json" \ 
--user 'username':'password'

Response:

"result": {
  "changeset_id": {
    "value": "7343d0f71b771110636e0fe0604bcb0b",
    "link": "https://instance-name.service-now.com/api/now/table/sn_cdm_changeset/7343d0f71b771110636e0fe0604bcb0b"
  },
  "node_path": "!2!3!&`",
  "description": null,
  "sys_updated_on": "2022-12-22 18:52:38",
  "type": "sn_cdm_node_linked_shared_component",
  "sys_class_name": "sn_cdm_node",
  "sys_id": "339314b71b771110636e0fe0604bcba3",
  "sys_updated_by": ”admin",
  "previous_version": {
    "value": "a9ce80bf1b371110636e0fe0604bcb10",
    "link": "https://instance-name.service-now.com/api/now/table/sn_cdm_node/a9ce80bf1b371110636e0fe0604bcb10" 
  },
  "sys_created_on": "2022-12-22 18:52:38",
  "value": null,
  "effective_from": null,
  "linked_to": "146", 
  "sys_created_by": ”admin",
  "restricted_to": null,
  "linked_to_version": {
    "value": "54115c371b771110636e0fe0604bcb77",
    "link": "https://instance-name.service-now.com/api/now/table/sn_cdm_snapshot/54115c371b771110636e0fe0604bcb77"
  },
  "level": "2",
  "conflict_type": null,
  "main_id": "166",
  "effective_to": null,
  "secure_value": null,
  "node_classifier": "/application/components",
  "main_id_encoded": "&`",
  "name": "Component_A",
  "position": null,
  "reason_for_conflict": null,
  "system_folder": false,
  "status": "updated",
  "conflict": false
}