---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# CdmSharedLibraryApi

# CdmSharedLibraryApi {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 26 minutes to read

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.
This API requires the Configuration Data Management (CDM) plugin to be activated for these APIs to be available in the instance. In addition, you must have one of the following roles to access this API:

* CDM Editor Role
* CDM Admin Role

For additional information on shared libraries and shared components, see [Sharing components among applications ---
Component libraries](https://www.servicenow.com/docs/access?context=cdm-component-libraries&version=xanadu&pubname=xanadu-it-service-management&ft:locale=en-US).

## CdmSharedLibraryApi - DELETE /sn_cdm/shared_libraries {#ariaid-title2}

Deletes the shared library with the specified name.
The CDM Admin role is required to access this endpoint.

### URL format {#sl-DELETE-shared_libs__section_evn_zmx_dwb}

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

Default URL:
/api/sn_cdm/shared_libraries

### Supported request parameters

{#sl-DELETE-shared_libs__entry__2}{#sl-DELETE-shared_libs__version-not_optional-RESTAPI}

| Name | Description |
|-|-|
| api_version | Optional. Version of the endpoint to access. For example, <kbd class="ph userinput">v1</kbd> or <kbd class="ph userinput">v2</kbd>. Only specify this value to use an endpoint version other than the latest. Data type: String |
[Table 1. Path parameters]

{#sl-DELETE-shared_libs__entry__6}

| Name | Description |
|-|-|
| None |   |
[Table 2. Query parameters]

{#sl-DELETE-shared_libs__entry__10}

| Name | Description |
|-|-|
| name | Required. Name of the shared library to delete. Located in the CDM Application \[sn_cdm_application\] table. Data type: String |
[Table 3. Request body parameters (XML or JSON)]

### 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-DELETE-shared_libs__entry__14}{#sl-DELETE-shared_libs__cdm_apps-sl_req_headers-accept-entry}

| Header | Description |
|-|-|
| Accept | Data format of the response body. Supported types: * application/json * application/xml * text/xml Default: application/json |
[Table 4. Request headers]

{#sl-DELETE-shared_libs__entry__18}

| Header | Description |
|-|-|
| None |   |
[Table 5. Response headers]

### 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-DELETE-shared_libs__entry__22}{#sl-DELETE-shared_libs__entry-200-status-code}{#sl-DELETE-shared_libs__entry-400-status-code}{#sl-DELETE-shared_libs__entry-500-status-code}

| 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. |
[Table 6. Status codes]

### Response body parameters (JSON or XML)

{#sl-DELETE-shared_libs__entry__30}

| Name | Description |
|-|-|
| 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 |
[ ]

### 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 {#ariaid-title3}

Deletes the specified shared component from the specified library.
The CDM Editor role is required to access this endpoint.  
Note:  
You can only delete a component if it is not currently being used. Also, you cannot delete a component if the associated shared library is not active.

### URL format

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

Default URL:
/api/sn_cdm/shared_libraries/components

### Supported request parameters

{#sl-DELETE-shared_libs-comps__entry__2}{#sl-DELETE-shared_libs-comps__version-not_optional-RESTAPI}

| Name | Description |
|-|-|
| api_version | Optional. Version of the endpoint to access. For example, <kbd class="ph userinput">v1</kbd> or <kbd class="ph userinput">v2</kbd>. Only specify this value to use an endpoint version other than the latest. Data type: String |
[Table 7. Path parameters]

{#sl-DELETE-shared_libs-comps__entry__6}

| Name | Description |
|-|-|
| changesetNumber | Required. Number of the changeset associated with the component. Located in the CDM Changeset \[sn_cdm_changeset\] table Data type: String |
| name | Required. Name of the shared component to delete. Located in the CDM Shared Component \[sn_cdm_shared_component\] table. Data type: String |
| sharedLibraryName | Required. Name of the shared library where the component to delete is located. Located in the CDM Application \[sn_cdm_application\] table. Data type: String |
[Table 8. Query parameters]

{#sl-DELETE-shared_libs-comps__entry__14}

| Name | Description |
|-|-|
| None |   |
[Table 9. Request body 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-DELETE-shared_libs-comps__entry__18}{#sl-DELETE-shared_libs-comps__cdm_apps-sl_req_headers-accept-entry}

| Header | Description |
|-|-|
| Accept | Data format of the response body. Supported types: * application/json * application/xml * text/xml Default: application/json |
[Table 10. Request headers]

{#sl-DELETE-shared_libs-comps__entry__22}

| Header | Description |
|-|-|
| None |   |
[Table 11. Response headers]

### 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-DELETE-shared_libs-comps__entry__26}{#sl-DELETE-shared_libs-comps__entry-200-status-code}{#sl-DELETE-shared_libs-comps__entry-500-status-code}

| Status code | Description |
|-|-|
| 200 | Successful. The request was successfully processed. |
| 400 | Bad Request. Possible issues: * Shared library does not exist. * Shared library is not active. * Shared component is in use. Cannot delete it. * User is restricted from deleting the shared component. {#sl-DELETE-shared_libs-comps__ul_x5v_4vp_dwb} |
| 500 | Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error. |
[Table 12. Status codes]

### Response body parameters

{#sl-DELETE-shared_libs-comps__entry__34}

| Name | Description |
|-|-|
| 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 |
[ ]

### 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} {#ariaid-title4}

Returns the current status of the specified shared library upload request.
<br />

### 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

{#sl-GET-shared_libs-upload-status__entry__2}{#sl-GET-shared_libs-upload-status__version-not_optional-RESTAPI}

| Name | Description |
|-|-|
| api_version | Optional. Version of the endpoint to access. For example, <kbd class="ph userinput">v1</kbd> or <kbd class="ph userinput">v2</kbd>. 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 various CdmSharedLibrary upload request endpoints. Data type: String |
[Table 13. Path parameters]

{#sl-GET-shared_libs-upload-status__entry__8}

| Name | Description |
|-|-|
| None |   |
[Table 14. Query parameters]

{#sl-GET-shared_libs-upload-status__entry__12}

| Name | Description |
|-|-|
| None |   |
[Table 15. Request body 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-GET-shared_libs-upload-status__entry__16}{#sl-GET-shared_libs-upload-status__cdm_apps-sl_req_headers-accept-entry}

| Header | Description |
|-|-|
| Accept | Data format of the response body. Supported types: * application/json * application/xml * text/xml Default: application/json |
[Table 16. Request headers]

{#sl-GET-shared_libs-upload-status__entry__20}

| Header | Description |
|-|-|
| None |   |
[Table 17. Response headers]

### 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-GET-shared_libs-upload-status__entry__24}{#sl-GET-shared_libs-upload-status__entry-200-status-code}{#sl-GET-shared_libs-upload-status__entry-400-status-code}{#sl-GET-shared_libs-upload-status__entry-500-status-code}

| 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. |
[Table 18. Status codes]

### Response body parameters (JSON or XML)

{#sl-GET-shared_libs-upload-status__entry__32}

| 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": "String", "cdm_application": "String", "committed_at": "String", "committed_by": "String", "description": "String", "last_conflict_detection_time": "String", "number": "String", "publish_option": "String", "sharedLibraryName": "String", "snapshot_description": "String", "snapshot_name": "String", "state": "String", "sys_created_by": "String", "sys_id": "String", "title": "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](https://www.servicenow.com/docs/access?context=cdm-snapshot-publish&version=xanadu&pubname=xanadu-it-service-management&ft:locale=en-US). 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: * COMPLETED: Upload has completed. * EXPIREDERROR: Error while processing the upload request. The job ran for more than 15 minutes and was terminated by the system. * IN_PROGRESS: Upload is in process. * NEW: Processing has not yet started. * READY: Request has been queued. 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: * completed * error |
| 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 {#ariaid-title5}

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

{#sl-POST-shared_libs__entry__2}{#sl-POST-shared_libs__version-not_optional-RESTAPI}

| Name | Description |
|-|-|
| api_version | Optional. Version of the endpoint to access. For example, <kbd class="ph userinput">v1</kbd> or <kbd class="ph userinput">v2</kbd>. Only specify this value to use an endpoint version other than the latest. Data type: String |
[Table 19. Path parameters]

{#sl-POST-shared_libs__entry__6}{#sl-POST-shared_libs__appName-userGroupIds-entry}

| 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. Located in the CDM Application \[sn_cdm_application\] table. Data type: String Default: All non-system fields are returned. |
| 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. Located in the Group \[sys_user_group\] table. Data type: String Default: All users with the CDM Editor role can edit data within the shared library. |
[Table 20. Query parameters]

{#sl-POST-shared_libs__entry__16}

| Name | Description |
|-|-|
| None |   |
[Table 21. Request body parameters (XML or JSON)]

### 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-POST-shared_libs__entry__20}{#sl-POST-shared_libs__cdm_apps-sl_req_headers-accept-entry}

| Header | Description |
|-|-|
| Accept | Data format of the response body. Supported types: * application/json * application/xml * text/xml Default: application/json |
[Table 22. Request headers]

{#sl-POST-shared_libs__entry__24}

| Header | Description |
|-|-|
| None |   |
[Table 23. Response headers]

### 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-POST-shared_libs__entry__28}{#sl-POST-shared_libs__entry-200-status-code}{#sl-POST-shared_libs__entry-400-status-code}{#sl-POST-shared_libs__entry-500-status-code}

| 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. |
[Table 24. Status codes]

### Response body parameters

{#sl-POST-shared_libs__entry__36}

| Name | Description |
|-|-|
| \<fields\> | Requested fields from the CDM Application \[sn_cdm_application\] table. Data type: Variable |
| 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 |
[ ]

### 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 {#ariaid-title6}

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

{#sl-POST-shared_libs-comps__entry__2}{#sl-POST-shared_libs-comps__version-not_optional-RESTAPI}

| Name | Description |
|-|-|
| api_version | Optional. Version of the endpoint to access. For example, <kbd class="ph userinput">v1</kbd> or <kbd class="ph userinput">v2</kbd>. Only specify this value to use an endpoint version other than the latest. Data type: String |
[Table 25. Path parameters]

{#sl-POST-shared_libs-comps__entry__6}{#sl-POST-shared_libs-comps__changesetNumber-changeset-entry}

| Name | Description |
|-|-|
| changesetNumber | Required. Unique identifier of the associated changeset, such as "Chset-10". Located in the CDM Changeset \[sn_cdm_changeset\] table. Data type: String |
| 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 |
[Table 26. Query parameters]

{#sl-POST-shared_libs-comps__entry__18}

| Name | Description |
|-|-|
| None |   |
[Table 27. Request body 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-POST-shared_libs-comps__entry__22}{#sl-POST-shared_libs-comps__cdm_apps-sl_req_headers-accept-entry}

| Header | Description |
|-|-|
| Accept | Data format of the response body. Supported types: * application/json * application/xml * text/xml Default: application/json |
[Table 28. Request headers]

{#sl-POST-shared_libs-comps__entry__26}

| Header | Description |
|-|-|
| None |   |
[Table 29. Response headers]

### 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-POST-shared_libs-comps__entry__30}{#sl-POST-shared_libs-comps__entry-200-status-code}{#sl-POST-shared_libs-comps__entry-400-status-code}{#sl-POST-shared_libs-comps__entry-500-status-code}

| 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. |
[Table 30. Status codes]

### Response body parameters

{#sl-POST-shared_libs-comps__entry__38}{#sl-POST-shared_libs-comps__cdm_apps-error-entry}{#sl-POST-shared_libs-comps__cdm_apps-error_detail-entry}{#sl-POST-shared_libs-comps__cdm_apps-error_message-entry}

| Name | Description |
|-|-|
| \<requested fields\> | Requested fields from the CDM Node \[sn_cdm_node\] table. |
| error | Only returned if an error occurred during processing. Data type: Object "error": { "detail": "String", "message": "String" } |
| 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 {#ariaid-title7}

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.  
Note:  
By default, the maximum content upload size is 2MB. You can modify this default by updating the sn_cdm.max_allowed_upload_file_size property.  
Note:  
This upload method cannot be used to modify nodes. Use the alternative [CdmSharedLibraryApi - POST /sn_cdm/shared_libraries/uploads/components/file](https://servicenow-prod.fluidtopics.net/ZyKqW1KVSdPyyALRkUnueg#csl-POST-shared_libs-upld-comp-file "Uploads files as part of the Configuration Data Model (CDM) under the components folder in a shared library.") method to modify nodes.

### 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

{#sl-POST-shared_libs-uploads-comp__entry__2}{#sl-POST-shared_libs-uploads-comp__version-not_optional-RESTAPI}

| Name | Description |
|-|-|
| api_version | Optional. Version of the endpoint to access. For example, <kbd class="ph userinput">v1</kbd> or <kbd class="ph userinput">v2</kbd>. Only specify this value to use an endpoint version other than the latest. Data type: String |
[Table 31. Path parameters]

{#sl-POST-shared_libs-uploads-comp__entry__6}

| Name | Description |
|-|-|
| 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 |
| changesetNumber | Required. String that uniquely identifies the changeset associated with the application, such as Chset-102. Located in the CDM Changeset \[sn_cdm_changeset\] table. This changeset must be in the "Open" state. Data type: String |
| dataFormat | Required. Format of the configuration data. Valid values: * csv * 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 |
| 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 <kbd class="ph userinput">name</kbd>, 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. {#sl-POST-shared_libs-uploads-comp__ul_egn_4q4_1yb} 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'\] {#sl-POST-shared_libs-uploads-comp__cdm_apps-namePath-ul} 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_new_and_unpublish_old: Publish the new snapshot created after the commit and unpublish the existing snapshot. * publish_none: Do not publish any snapshots. For additional information on publishing snapshots, see [Publish or unpublish a snapshot](https://www.servicenow.com/docs/access?context=cdm-snapshot-publish&version=xanadu&pubname=xanadu-it-service-management&ft:locale=en-US). Data type: String Default: publish_none |
| sharedLibraryName | Required. Name of the shared library to create or manage. Located in the CDM Application \[sn_cdm_application\] table. Data type: String |
[Table 32. Query parameters]

{#sl-POST-shared_libs-uploads-comp__entry__28}{#sl-POST-shared_libs-uploads-comp__cdm_apps-var_up_data-entry}

| 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. |
[Table 33. Request body 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-POST-shared_libs-uploads-comp__id_fyp_pmb_fwb__entry__2}{#sl-POST-shared_libs-uploads-comp__accept-JSON-only-entry-RESTAPI}

| 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 34. Request headers]

{#sl-POST-shared_libs-uploads-comp__id_fyp_pmb_fwb} {#sl-POST-shared_libs-uploads-comp__entry__38}

| Header | Description |
|-|-|
| None |   |
[Table 35. Response headers]

### 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-POST-shared_libs-uploads-comp__entry__42}{#sl-POST-shared_libs-uploads-comp__entry-200-status-code}{#sl-POST-shared_libs-uploads-comp__entry-500-status-code}

| Status code | Description |
|-|-|
| 200 | Successful. The request was successfully processed. |
| 400 | Bad Request. The upload request has been rejected. Possible issues: * Size of the configuration payload is greater that the allowed maximum - 2MB 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. |
[Table 36. Status codes]

### Response body parameters

{#sl-POST-shared_libs-uploads-comp__entry__50}

| Name | Description |
|-|-|
| 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 |
| 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 {#ariaid-title8}

Uploads files as part of the Configuration Data Model (CDM) under the components folder in a shared library.

### URL format {#csl-POST-shared_libs-upld-comp-file__section_abk_fyr_byb}

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

Default URL: /api/sn_cdm/shared_libraries/uploads/components/file

### Supported request parameters

{#csl-POST-shared_libs-upld-comp-file__entry__2}{#csl-POST-shared_libs-upld-comp-file__version-not_optional-RESTAPI}

| Name | Description |
|-|-|
| api_version | Optional. Version of the endpoint to access. For example, <kbd class="ph userinput">v1</kbd> or <kbd class="ph userinput">v2</kbd>. Only specify this value to use an endpoint version other than the latest. Data type: String |
[Table 37. Path parameters]

{#csl-POST-shared_libs-upld-comp-file__table_hxt_rmm_2yb__entry__2}

|   |   |
|-|-|
| 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 <kbd class="ph userinput">true</kbd>. Data type: Boolean Default: false |
| changesetNumber | String that uniquely identifies the [changeset](https://www.servicenow.com/docs/access?context=cdm-changesets-version-control&version=xanadu&pubname=xanadu-it-service-management&ft:locale=en-US) associated with the application, such as Chset-102. This changeset must be in the "Open" state. Located in the CDM Changeset \[sn_cdm_changeset\] table. 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}](https://servicenow-prod.fluidtopics.net/kxQnNcfcJkxqyOLRcDyN~g#apps-GET-upload-status "Returns the current status of the specified configuration data upload request.") results. |
| 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'\] {#csl-POST-shared_libs-upld-comp-file__cdm_apps-namePath-ul} 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. Located in the CDM Application \[sn_cdm_application\] table. Data type: String |
[Table 38. Query parameters]

{#csl-POST-shared_libs-upld-comp-file__table_hxt_rmm_2yb} {#csl-POST-shared_libs-upld-comp-file__table_j22_fgm_2yb__entry__2}

| 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](https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0718101). Data type: String/stream |
[Table 39. Request body parameters (XML or JSON)]

{#csl-POST-shared_libs-upld-comp-file__table_j22_fgm_2yb}

### 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#csl-POST-shared_libs-upld-comp-file__entry__26}{#csl-POST-shared_libs-upld-comp-file__accept-RESTAPI}

| 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 40. Request headers]

{#csl-POST-shared_libs-upld-comp-file__entry__32}

| Header | Description |
|-|-|
| None |   |
[Table 41. Response headers]

### Status codes {#csl-POST-shared_libs-upld-comp-file__section_mtw_2vr_byb}

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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#csl-POST-shared_libs-upld-comp-file__id_cdq_fft_byb__entry__2}{#csl-POST-shared_libs-upld-comp-file__entry-200-status-code}{#csl-POST-shared_libs-upld-comp-file__entry-500-status-code}

| 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. {#csl-POST-shared_libs-upld-comp-file__ul_kmn_gkh_psb} |
| 500 | Internal server error. An unexpected error occurred while processing the request. The response contains additional information about the error. |
[Table 42. Status codes]

{#csl-POST-shared_libs-upld-comp-file__id_cdq_fft_byb}

### Response body parameters (JSON or XML) {#csl-POST-shared_libs-upld-comp-file__section_sbq_2bx_1yb}

{#csl-POST-shared_libs-upld-comp-file__id_af3_kft_byb__entry__2}{#csl-POST-shared_libs-upld-comp-file__cdm_apps-stat-error}{#csl-POST-shared_libs-upld-comp-file__cdm_apps-stat-error_detail-row}{#csl-POST-shared_libs-upld-comp-file__cdm_apps-stat-error_messaage-row}{#csl-POST-shared_libs-upld-comp-file__cdm_apps-stat-error_status-row}{#csl-POST-shared_libs-upld-comp-file__cdm_apps-upload_id-row}

| Name | Description |
|-|-|
| 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}](https://servicenow-prod.fluidtopics.net/kxQnNcfcJkxqyOLRcDyN~g#apps-GET-upload-status "Returns the current status of the specified configuration data upload request.") endpoint to obtain the status of the upload. Data type: String |
[ ]

{#csl-POST-shared_libs-upld-comp-file__id_af3_kft_byb}  

### 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 {#ariaid-title9}

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.

### URL format {#sl-PUT-shared_libs__section_thy_4hj_dwb}

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

Default URL:
/api/sn_cdm/shared_libraries

### Supported request parameters

{#sl-PUT-shared_libs__entry__2}{#sl-PUT-shared_libs__version-not_optional-RESTAPI}

| Name | Description |
|-|-|
| api_version | Optional. Version of the endpoint to access. For example, <kbd class="ph userinput">v1</kbd> or <kbd class="ph userinput">v2</kbd>. Only specify this value to use an endpoint version other than the latest. Data type: String |
[Table 43. Path parameters]

{#sl-PUT-shared_libs__entry__6}

| Name | Description |
|-|-|
| name | Required. Name of the shared library to update. Located in the CDM Application \[sn_cdm_application\] table. Data type: String |
| newAvailableState | Flag that indicates the state of the shared library. Valid values: * true: The shared library is active. * false: The shared library is inactive. No users are allowed to access this library. 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. Located in the Group \[sys_user_group\] table. Data type: String |
| 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. |
[Table 44. Query parameters]

{#sl-PUT-shared_libs__entry__20}

| Name | Description |
|-|-|
| None |   |
[Table 45. Request body 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-PUT-shared_libs__entry__24}{#sl-PUT-shared_libs__cdm_apps-sl_req_headers-accept-entry}

| Header | Description |
|-|-|
| Accept | Data format of the response body. Supported types: * application/json * application/xml * text/xml Default: application/json |
[Table 46. Request headers]

{#sl-PUT-shared_libs__entry__28}

| Header | Description |
|-|-|
| None |   |
[Table 47. Response headers]

### 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-PUT-shared_libs__entry__32}{#sl-PUT-shared_libs__entry-200-status-code}{#sl-PUT-shared_libs__entry-400-status-code}{#sl-PUT-shared_libs__entry-500-status-code}

| 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. |
[Table 48. Status codes]

### Response body parameters

{#sl-PUT-shared_libs__entry__40}

| Name | Description |
|-|-|
| \<fields\> | Requested fields from the CDM Application \[sn_cdm_application\] table. Data type: Variable |
| 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 |
[ ]

### 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 {#ariaid-title10}

Updates the name and description of the specified shared component.
The CDM Editor role is required to access this endpoint.  
Note:  
Renaming is only allowed if a component has never been used, as when the component's snapshot has never been imported. The renaming scenario is primarily for the purpose of fixing typos when creating new components.

### URL format {#sl-PUT-shared_libs-comps__section_nff_yxj_dwb}

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

Default URL:
/api/sn_cdm/shared_libraries/components

### Supported request parameters

{#sl-PUT-shared_libs-comps__entry__2}{#sl-PUT-shared_libs-comps__version-not_optional-RESTAPI}

| Name | Description |
|-|-|
| api_version | Optional. Version of the endpoint to access. For example, <kbd class="ph userinput">v1</kbd> or <kbd class="ph userinput">v2</kbd>. Only specify this value to use an endpoint version other than the latest. Data type: String |
[Table 49. Path parameters]

{#sl-PUT-shared_libs-comps__entry__6}

| Name | Description |
|-|-|
| changesetNumber | Required. Name of the associated changeset. Located in the CDM Changeset \[sn_cdm_changeset\] table. Data type: String |
| name | Required. Name of the shared component to update. Located in the CDM Shared Component \[sn_cdm_shared_component\] table. Data type: String |
| 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. |
[Table 50. Query parameters]

{#sl-PUT-shared_libs-comps__entry__18}

| Name | Description |
|-|-|
| None |   |
[Table 51. Request body parameters (XML or JSON)]

### 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-PUT-shared_libs-comps__entry__22}{#sl-PUT-shared_libs-comps__cdm_apps-sl_req_headers-accept-entry}

| Header | Description |
|-|-|
| Accept | Data format of the response body. Supported types: * application/json * application/xml * text/xml Default: application/json |
[Table 52. Request headers]

{#sl-PUT-shared_libs-comps__entry__26}

| Header | Description |
|-|-|
| None |   |
[Table 53. Response headers]

### 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](https://servicenow-prod.fluidtopics.net/2vuQj3~2s_niNXyXhrbRZA "REST (REpresentational State Transfer) is a simple stateless architecture that provides standards between computer systems on the web, making it easier for them to communicate with each other.").
{#sl-PUT-shared_libs-comps__entry__30}{#sl-PUT-shared_libs-comps__entry-200-status-code}{#sl-PUT-shared_libs-comps__entry-400-status-code}{#sl-PUT-shared_libs-comps__entry-500-status-code}

| 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. |
[Table 54. Status codes]

### Response body parameters

{#sl-PUT-shared_libs-comps__entry__38}

| 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": "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 |
[ ]

### 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
      }
    }


