CdmSharedLibraryApi
The CdmSharedLibraryApi provides endpoints that enable you to create and manage shared libraries and shared components. It also has endpoints that enable you to upload and export the configuration data of a shared component.
- CDM Editor Role
- CDM Admin Role
For additional information on shared libraries and shared components, see Sharing components among applications — Component libraries.
CdmSharedLibraryApi - DELETE /sn_cdm/shared_libraries
Deletes the shared library with the specified name.
The CDM Admin role is required to access this endpoint.
Supported request parameters
| Name | Description |
|---|---|
| api_version |
Data type: String |
| Name | Description |
|---|---|
| None |
| Name | Description |
|---|---|
| name | Required. Name of the shared library to delete. Data type: String Table: CDM Application [sn_cdm_application] |
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.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types:
Default: application/json |
| 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.
| 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)
| Name | Description |
|---|---|
| error | If an error occurred during processing, the details about the error. Data type: Object |
| 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 |
cURL request
The following code example shows how delete the shared library "javalib".
curl "http://instance.servicenow.com/sn_cdm/shared_libraries?name='javalib'\
--request DELETE\
--header "Accept:application/json" \
--user 'username':'password'
Response:
""
CdmSharedLibraryApi - DELETE /sn_cdm/shared_libraries/components
Deletes the specified shared component from the specified library.
The CDM Editor role is required to access this endpoint.
URL format
Versioned URL: /api/sn_cdm/{api_version}/shared_libraries/components
Default URL: /api/sn_cdm/shared_libraries/components
Supported request parameters
| Name | Description |
|---|---|
| api_version |
Data type: String |
| Name | Description |
|---|---|
| changesetNumber | Required. Number of the changeset associated with the component. Data type: String Table: CDM Changeset [sn_cdm_changeset] |
| name | Required. Name of the shared component to delete. Data type: String Table: CDM Shared Component [sn_cdm_shared_component] |
| sharedLibraryName | Required. Name of the shared library where the component to delete is located. Data type: String Table: CDM Application [sn_cdm_application] |
| 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.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types:
Default: application/json |
| 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.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 400 | Bad Request. Possible issues: |
| 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 |
|---|---|
| error | If an error occurred during processing, the details about the error. Data type: Object |
| 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 |
cURL request
The following code example shows how to delete the component "TestComponent" under the "javalib" shared library.
curl "http://instance.servicenow.com/sn_cdm/shared_libraries/components?sharedLibraryName='javalib&changesetNumber='chset-8'&name='TestComponent'\
--request DELETE\
--header "Accept:application/json" \
--user 'username':'password'
Response:
""
CdmSharedLibraryApi - GET /sn_cdm/shared_libraries/upload-status/{upload-id}
Returns the current status of the specified shared library upload request.
URL format
Versioned URL: /api/sn_cdm/{api_version}/shared_libraries/upload-status/{upload-id}
Default URL: /api/sn_cdm/shared_libraries/upload-status/{upload-id}
Supported request parameters
| Name | Description |
|---|---|
| api_version |
Data type: String |
| upload-id | Sys_id of the upload request whose status to return. This value is returned by
various CdmSharedLibrary upload request endpoints. Data type: String |
| Name | Description |
|---|---|
| None |
| 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.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types:
Default: application/json |
| 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.
| 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)
| Name | Description |
|---|---|
| errors | Description of the error(s) encountered during upload. Data type: String |
| output | Description of the uploaded data or if an error occurred during the upload, an
error message describing the error that was encountered. Data type: Array of String |
| output.auto_validate | Indicates whether to invoke validation after the commit. Data type: String |
| output.cdm_application | Name of application under which the upload was performed. Data type: String |
| output.committed_at | Date and time that the uploaded content was committed. Data type: String |
| output.committed_by | Sys_id of the record of the entity that performed the commit. Data type: String |
| output.description | Not currently used. Data type: String |
| output.last_conflict_detection_time | Date and time conflict detection invocation. Data type: String |
| output.number | Unique changeset identification value, such as Chset-124. Data type: String |
| output.publish_option | Value of the publish option passed in the associated upload call. For additional information on publishing snapshots, see Publish or unpublish a snapshot. Data type: String |
| output.sharedLibraryName | Name of the shared library as passed in the original upload call. Data type: String |
| output.snapshot_description | Description of the associated snapshot. Data type: String |
| output.snapshot_name | Name of the associated snapshot. Data type: String |
| output.state | State of the upload. Possible values:
Data type: String |
| output.sys_created_by | Sys_id of the entity that created the record. Data type: String |
| output.sys_id | Sys_id of the record containing the changeset. Data type: String |
| output.title | Title of the changeset created as part of the upload. Data type: String |
| processing_state | Current processing state of the upload request. Possible values: PROCESSED Data type: String |
| state | Current state of the upload request. Possible values:
|
| type | Type of upload request. Possible values: upload_and_commit Data type: String |
| upload_id | Sys_id of the record containing the uploaded configuration payload. Data type: String |
cURL request
This code example shows how to request the status for the upload-id 0d91d9891b2b19109524cae0604bcbe6.
curl "http://instance.servicenow.com/api/sn_cdm/shared_libraries/upload-status/0d91d9891b2b19109524cae0604bcbe6" \
--request GET \
--header "Accept:application/json" \
--user 'username':'password'
Response:
// Successful response
{
"result": {
"type": "upload_and_commit",
"state": "completed",
"output": {
"sys_id": "0002ea107768a1109ac0cf0bbb5a9963",
"number": "Chset-457",
"title": "admin8802ea107768a1109ac0cf0bbb5a9962",
"description": null,
"committed_at": "",
"committed_by": null,
"sys_created_by": "admin",
"state": "open",
"publish_option": "publish_none",
"auto_validate": false,
"snapshot_name": null,
"snapshot_description": null,
"cdm_application": "OracleG-Library-15",
"last_conflict_detection_time": null
},
"processing_state": "PROCESSED",
"upload_id": "00b226547768a1109ac0cf0bbb5a99f2"
}
}
// Error response
{
"result": {
"type": "upload_and_commit",
"state": "error",
"output": "Error: Application with sys_id 87fb1ecb1be3111050fc21b0604bcb95 is in State Deleted. No data can be modified on deleted applications",
"processing_state": "PROCESSED",
"upload_id": "fcdfaf7f1b88211050fc21b0604bcb79"
}
}
CdmSharedLibraryApi - POST /sn_cdm/shared_libraries
Creates a new shared library with the specified name.
The CDM Admin role is required to access this endpoint.
URL format
Versioned URL: /api/sn_cdm/{api_version}/shared_libraries
Default URL: /api/sn_cdm/shared_libraries
Supported request parameters
| Name | Description |
|---|---|
| api_version |
Data type: String |
| Name | Description |
|---|---|
| description | Description of the shared library. Data type: String Default: Empty |
| name | Required. Name of the shared library to create. This name must be unique across
all CDM applications and libraries. Data type: String |
| returnFields | Comma separated list of fields to return as part of the response. Data type: String Default: All non-system fields are returned. Table: CDM Application [sn_cdm_application] |
| userGroupIds | Comma-separated list of sys_ids of the user groups that can edit the associated shared library. All users with the proper roles can view the shared library. Data type: String Default: All users with the CDM Editor role can edit data within the shared library. Table: Group [sys_user_group] |
| 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.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types:
Default: application/json |
| 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.
| 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 |
|---|---|
| <fields> | Requested fields. Data type: Variable Table: CDM Application [sn_cdm_application] |
| error | If an error occurred during processing, the details about the error. Data type: Object |
| 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 |
cURL request
The following code example shows how to call this endpoint to create the shared library Java11Lib with all user groups able to access the library.
curl "http://instance.servicenow.com/api/sn_cdm/shared_libraries?name=Java11Lib&description=The%20new%20java%20library" \
--request POST \
--header "Accept:application/json" \
--user 'userName':'password
Response:
{
"result": {
"sdlc_component": null,
"cdi_count": "0",
"available": false,
"description": "Description of LibraryA",
"managed_by_group": null,
"sys_updated_on": "2023-01-18 11:34:43",
"type": "shared_library",
"node": {
"value": "d852b15877a4a1109ac0cf0bbb5a99aa",
"link": "http://instance.servicenow.com/api/now/table/sn_cdm_node/d852b15877a4a1109ac0cf0bbb5a99aa"
},
"sys_id": "185235dc77a4a1109ac0cf0bbb5a994e",
"sys_updated_by": "admin",
"node_main": {
"value": "1852b15877a4a1109ac0cf0bbb5a99aa",
"link": "http://instance.servicenow.com/api/now/table/sn_cdm_node_main/1852b15877a4a1109ac0cf0bbb5a99aa"
},
"sys_created_on": "2023-01-18 11:34:43",
"cdi_usage": "0",
"name": "LibraryA",
"last_committed_changeset": {
"value": "9052b15877a4a1109ac0cf0bbb5a99aa",
"link": "http://instance.servicenow.com/api/now/table/sn_cdm_changeset/9052b15877a4a1109ac0cf0bbb5a99aa"
},
"state": "active",
"sys_created_by": "admin"
}
}
CdmSharedLibraryApi - POST /sn_cdm/shared_libraries/components
Creates the specified shared component under the specified library.
The CDM Editor role is required to access this endpoint.
URL format
Versioned URL: /api/sn_cdm/{api_version}/shared_libraries/components
Default URL: /api/sn_cdm/shared_libraries/components
Supported request parameters
| Name | Description |
|---|---|
| api_version |
Data type: String |
| Name | Description |
|---|---|
| changesetNumber | Required. |
| description | Description of the shared component. Data type: String |
| name | Required. Name of the shared component to create in the shared library. This
name must be unique. Data type: String |
| returnFields | Comma separated list of fields in the CDM Node [sn_cdm_node] table to return as part of the response. Data type: String Default: All non-internal fields are returned. |
| sharedLibraryName | Required. Name of the shared library under which to create the component. This
library must already exist and be in the active state. Data type: String |
| 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.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types:
Default: application/json |
| 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.
| 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 |
|---|---|
| <requested fields> | Requested fields. Data type: Various Table: CDM Node [sn_cdm_node] |
| error | Only returned if an error occurred during processing. Data type: Object |
| error.detail | Details about the error that occurred. Data type: String |
| error.message | Message that provides an overview of the error. Data type: String |
| status | Error status of the request. Possible values: failure Data type: String |
cURL request
The following code example stores the component named "SharedComponent" under the shared library "javalib".
curl "http://instance.servicenow.com/sn_cdm/shared_libraries/components/?sharedLibraryName=javalib&changeSetNumber='Chset-9'&name='SharedComponent'\
--request POST\
--header "Accept:application/json" \
--user 'username':'password'
Response:
{
"result": {
"changeset_id": {
"value": "ca7e6a501b202110636e0fe0604bcb71",
"link": "https://instance.servicenow.com/api/now/table/sn_cdm_changeset/ca7e6a501b202110636e0fe0604bcb71"
},
"node_path": "!2!3!:",
"description": null,
"sys_updated_on": "2023-01-18 16:04:52",
"type": "sn_cdm_node_shared_component",
"sys_class_name": "sn_cdm_node",
"sys_id": "6d2072901b602110636e0fe0604bcbec",
"sys_updated_by": "admin",
"previous_version": null,
"sys_created_on": "2023-01-18 16:04:52",
"value": null,
"effective_from": null,
"linked_to": null,
"sys_created_by": "admin",
"restricted_to": null,
"linked_to_version": null,
"level": "2",
"conflict_type": null,
"main_id": "19",
"effective_to": null,
"secure_value": null,
"node_classifier": "/shared_library/shared_components",
"main_id_encoded": ":",
"name": "testSharedComponent",
"position": null,
"reason_for_conflict": null,
"system_folder": false,
"status": "new",
"conflict": false
}
}
CdmSharedLibraryApi - POST /sn_cdm/shared_libraries/uploads/components
Enables you to create and manage shared libraries and shared components. This endpoint creates a shared component node in the CDM Node [sn_cdm_node] table and a shared component record in the CDM Shared Component [sn_cdm_shared_component] table.
The CDM Editor role is required to access this endpoint.
URL format
Versioned URL: /api/sn_cdm/{api_version}/shared_libraries/uploads/components
Default URL: /api/sn_cdm/shared_libraries/uploads/components
Supported request parameters
| Name | Description |
|---|---|
| api_version |
Data type: String |
| Name | Description |
|---|---|
| autoCommit | Flag that indicates whether the changeset identified in the changesetNumber parameter is committed to the data model after upload. Valid values:
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:
Data type: Boolean Default: false |
| changesetNumber | Required. 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 Table: CDM Changeset [sn_cdm_changeset] |
| dataFormat | Required. Format of the configuration data. Valid values:
Data type: String |
| deleteRedundantOverrides | Flag that indicates whether to create an override where redundant values are present. Valid values:
Default: true |
| 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: in the following existing model: and you set identifierKeys to name, it produces the following output: Otherwise, it produces the following output: Data type: Array of Strings |
| ignoreAttributes | Flag that indicates whether the given data format supports attributes (currently only XML). Valid values: 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). 주: 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:
For additional information on publishing snapshots, see Publish or unpublish a snapshot. Data type: String Default: publish_none |
| sharedLibraryName | Required. Name of the shared library to create or manage. Data type: String Table: CDM Application [sn_cdm_application] |
| 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.
| 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 |
| 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.
| Status code | Description |
|---|---|
| 200 | Successful. The request was successfully processed. |
| 400 | Bad Request. The upload request has been rejected. Possible issues:
|
| 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 |
|---|---|
| error | If an error occurred during processing, the details about the error. Data type: Object |
| 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 |
| upload_id | Sys_id of the upload request. Use this ID to call the endpoint to obtain the
status of the upload. Data type: String |
| status | Error status of the request. Possible values: failure Data type: String |
cURL request
The following example shows how to upload the shared library called Demo_App1631126164773 with the configuration data being plain text.
curl "http://instance.servicenow.com/api/sn_cdm/sharedlibrary/component/upload?namePath=%2FSettings%2FdbSettings&dataFormat=json&appName=Demo_App1631126164773&changesetNumber=Chset-8&autoCommit=false&publishOption=publish_none&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 to this request.
// Successful response
{
"result": {
"upload_id": "ec1f71f45322301096edddeeff7b12b3"
}
}
// Error response
{
"error": {
"message": "Size of uploaded data:6853632.0(bytes) is greater than max allowed upload limit of 2097152.0(bytes)",
"detail": ""
},
"status": "failure"
}
CdmSharedLibraryApi - POST /sn_cdm/shared_libraries/uploads/components/file
Uploads files as part of the Configuration Data Model (CDM) under the components folder in a shared library.
Supported request parameters
| Name | Description |
|---|---|
| api_version |
Data type: String |
| autoCommit | Flag that indicates whether the changeset identified in the changesetNumber parameter is committed to the data model after upload. Valid values:
Data type: Boolean Default: false |
| autoValidate | Flag that indicates whether the snapshots created when committed are validated. Valid values:
주: 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). 주: 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] |
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.
| Header | Description |
|---|---|
| Accept |
Default: application/json |
| Content-Type | Content Type of the file to be uploaded. Examples: application/zip, text/plain, application/json. |
| Header | Description |
|---|---|
| None |
cURL request
The following call demonstrates how to upload a plain text file to the components folder in the Shared Library.
curl "http://instance.servicenow.com/api/sn_cdm/shared_libraries/uploads/components/file?autoValidate=true&sharedLibraryName=sharedLibA &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"
}
CdmSharedLibraryApi - PUT /sn_cdm/shared_libraries
Updates the shared library information. Use this endpoint to update the name, description, state of a shared library, and the user groups that can access the library.
The CDM Admin role is required to access this endpoint.
Supported request parameters
| Name | Description |
|---|---|
| api_version |
Data type: String |
| Name | Description |
|---|---|
| name | Required. Name of the shared library to update. Data type: String Table: CDM Application [sn_cdm_application] |
| newAvailableState | Flag that indicates the state of the shared library. Valid values:
Default: true |
| newDescription | Updated description of the shared library. Data type: String |
| newName | New name of the shared library. Data type: String |
| newUserGroupIds | Comma separated list of sys_ids of the user groups that can access the associated shared library. Data type: String Table: Group [sys_user_group] |
| returnFields | Comma separated list of fields in the CDM Application [sn_cdm_application] table to return as part of the response. Data type: String Default: All non-system fields are returned. |
| 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.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types:
Default: application/json |
| 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.
| 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 |
|---|---|
| <fields> | Requested fields. Data type: Variable Table: CDM Application [sn_cdm_application] |
| error | If an error occurred during processing, the details about the error. Data type: Object |
| 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 |
cURL request
The following code example shows how to call this endpoint for the shared library Java11Lib and update the library name and description.
curl "http://instance.servicenow.com/sn_cdm/shared_libraries?name=' javalib'&newName=’NewLibraryName’&newDescription=’new%20description%20of%20library’\
--request PUT\
--header "Accept:application/json" \
--user 'username':'password'
Response:
{
"result": {
"sdlc_component": null,
"cdi_count": "0",
"available": true,
"description": "Set new description",
"managed_by_group": null,
"sys_updated_on": "2023-01-18 11:51:14",
"type": "shared_library",
"node": {
"value": "021635dc77a4a1109ac0cf0bbb5a9952",
"link": "http://192.168.0.129:8080/api/now/table/sn_cdm_node/021635dc77a4a1109ac0cf0bbb5a9952"
},
"sys_id": "185235dc77a4a1109ac0cf0bbb5a994e",
"sys_updated_by": "admin",
"node_main": {
"value": "1852b15877a4a1109ac0cf0bbb5a99aa",
"link": "http://192.168.0.129:8080/api/now/table/sn_cdm_node_main/1852b15877a4a1109ac0cf0bbb5a99aa"
},
"sys_created_on": "2023-01-18 11:34:43",
"cdi_usage": "0",
"name": "LibraryA",
"last_committed_changeset": {
"value": "4a1635dc77a4a1109ac0cf0bbb5a9951",
"link": "http://192.168.0.129:8080/api/now/table/sn_cdm_changeset/4a1635dc77a4a1109ac0cf0bbb5a9951"
},
"state": "active",
"sys_created_by": "admin"
}
}
CdmSharedLibraryApi - PUT /sn_cdm/shared_libraries/components
Updates the name and description of the specified shared component.
The CDM Editor role is required to access this endpoint.
Supported request parameters
| Name | Description |
|---|---|
| api_version |
Data type: String |
| Name | Description |
|---|---|
| changesetNumber | Required. Name of the associated changeset. Data type: String Table:CDM Changeset [sn_cdm_changeset] |
| name | Required. Name of the shared component to update. Data type: String Table: CDM Shared Component [sn_cdm_shared_component] |
| newName | Required. Updated name of the shared component. Data type: String |
| newDescription | Updated description of the shared component. Data type: String Default: Empty |
| returnFields | Comma separated list of fields in the CDM Shared Component [sn_cdm_shared_component] table to return as part of the response. Data type: String Default: All non-system fields are returned. |
| 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.
| Header | Description |
|---|---|
| Accept | Data format of the response body. Supported types:
Default: application/json |
| 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.
| 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 |
|---|---|
| <fields> | Requested fields from the CDM Shared Component [sn_cdm_shared_component]
table. Data type: Variable |
| error | If an error occurred during processing, the details about the error. Data type: Object |
| 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 |
cURL request
The following code sample shows how to update the description of the component SharedComponentTest.
curl "http://instance.servicenow.com/sn_cdm/shared_libraries/components/?sharedLibraryName=javalib&changeSetNumber='chset-9'&name='SharedComponentTest'&newDescription='The shared component description'\
--request POST\
--header "Accept:application/json" \
--user 'username':'password
Response:
{
"result": {
"changeset_id": {
"value": "5c33311077e4a1109ac0cf0bbb5a9902",
"link": "http://instance.servicenow.com/api/now/table/sn_cdm_changeset/5c33311077e4a1109ac0cf0bbb5a9902"
},
"node_path": "!(1!(2!(3",
"description": "Changing the description only",
"sys_updated_on": "2023-01-18 12:09:05",
"type": "sn_cdm_node_shared_component",
"sys_class_name": "sn_cdm_node",
"sys_id": "9953f99077a4a1109ac0cf0bbb5a99ec",
"sys_updated_by": "admin",
"previous_version": null,
"sys_created_on": "2023-01-18 11:39:09",
"value": null,
"effective_from": null,
"linked_to": null,
"sys_created_by": "admin",
"restricted_to": null,
"linked_to_version": null,
"level": "2",
"conflict_type": null,
"main_id": "183",
"effective_to": null,
"secure_value": null,
"node_classifier": "/shared_library/shared_components",
"main_id_encoded": "(3",
"name": "sharedComponentName",
"position": null,
"reason_for_conflict": null,
"system_folder": false,
"status": "new",
"conflict": false
}
}