---
schema_version: "1"
id: 7e7b3b5480145d7e498ec2b58572413dd217345b84a36f6353865ebb692b4334
title: Data Code Versions (deprecated)
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/b2c-commerce/references/generated-api-specs/ocapi-data-code-versions.md
canonical_url: https://developer.salesforce.com/docs/commerce/b2c-commerce/references/ocapi-data-code-versions
source_site: developer.salesforce.com
content_type: documentation
content_hash: fecb83f189f2d13d8a256d02031df04d582f5708ec68a770455285c2d3e4d448
products:
  - B2C Commerce
  - Salesforce APIs
---
Data Code Versions (deprecated)

# Data Code Versions (deprecated)

Data API endpoints enable developers to build applications for merchants: Create, update, delete business objects, like products, customers, pricing and promotions or assignments. They typically provide read and write access and are designed for moderate usage.

**Version:** 25.6

## Servers

*   `https://{host}/s/-/dw/data/v25_6`

Protocols: https.

## Security

*   `oauth2_application` (oauth2) Authentication flow with client ID and password with account manager.
    *   OAuth flow application (tokenUrl: https://account.demandware.com:443/dwsso/oauth2/access\_token)
    *   Scope x-info: Scopes are NOT supported. This is just a dummy, because the 'scopes' field is required.
*   `client_id` (apiKey) Add client ID for application identification. Alternative as 'client\_id' query parameter.
    *   API key in header: x-dw-client-id

## Operations

### GET Get all code versions

`GET /code_versions`

Operation ID: `Get all code versions`. Tags: code\_versions. Security: oauth2\_application.

Read all existing code versions.

#### Responses

*   **default**
    
    Media type: `application/json, text/xml`. Schema: `code_version_result`.
    

### GET Get a code version

`GET /code_versions/{code_version_id}`

Operation ID: `Get a code version`. Tags: code\_versions. Security: oauth2\_application.

Read a code version.

This endpoint may return the following faults:

*   404 - CodeVersionIdNotFoundException - Indicates that a code version with the given id was not found.

#### Parameters

*   `code_version_id` (path, string, required) The id of the code version.  
    Minimum length: 1.
*   `expand` (query, array of string) The expand parameter. Allowed value (size).

#### Responses

*   **404** `CodeVersionIdNotFoundException` - Indicates that a code version with the given id was not found.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **default**
    
    Media type: `application/json, text/xml`. Schema: `code_version`.
    

### PUT Create code version

`PUT /code_versions/{code_version_id}`

Operation ID: `Create code version`. Tags: code\_versions. Security: oauth2\_application.

Create a new code version.

This endpoint may return the following faults:

*   409 - CodeVersionIdAlreadyExistsException - Indicates that a code version with the given id already exists.

#### Parameters

*   `code_version_id` (path, string, required) The id of the code version.  
    Minimum length: 1.

#### Responses

*   **409** `CodeVersionIdAlreadyExistsException` - Indicates that a code version with the given id already exists.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **default**
    
    Media type: `application/json, text/xml`. Schema: `code_version`.
    

### DELETE Delete a code version

`DELETE /code_versions/{code_version_id}`

Operation ID: `Delete a code version`. Tags: code\_versions. Security: oauth2\_application.

Delete a code version.

This endpoint may return the following faults:

*   400 - CodeVersionModificationException - Indicates that a code version with the given id can't be deleted (because it is active).
*   404 - CodeVersionIdNotFoundException - Indicates that a code version with the given id was not found.

#### Parameters

*   `code_version_id` (path, string, required) The id of the code version.  
    Minimum length: 1.

#### Responses

*   **204**
*   **400** `CodeVersionModificationException` - Indicates that a code version with the given id can't be deleted (because it is active).
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **404** `CodeVersionIdNotFoundException` - Indicates that a code version with the given id was not found.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    

### PATCH Update a code version

`PATCH /code_versions/{code_version_id}`

Operation ID: `Update a code version`. Tags: code\_versions. Security: oauth2\_application.

Update an existing code version.

*   Only an inactive code version can be updated.
    
*   Only the active flag and the id can be changed. The active flag can therefore only set to "true".
    
*   To set the active flag to "false" will not work.
    

This endpoint may return the following faults:

*   400 - CodeVersionModificationException - Indicates that a code version with the given id can't be updated (because it is active).
*   404 - CodeVersionIdNotFoundException - Indicates that a code version with the given id was not found.
*   409 - CodeVersionIdAlreadyExistsException - Indicates that a code version with the given id already exists.

#### Parameters

*   `code_version_id` (path, string, required) The id of the code version.  
    Minimum length: 1.

#### Request body (required)

Media type: `application/json, text/xml`. Schema: `code_version`.

#### Responses

*   **400** `CodeVersionModificationException` - Indicates that a code version with the given id can't be updated (because it is active).
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **404** `CodeVersionIdNotFoundException` - Indicates that a code version with the given id was not found.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **409** `CodeVersionIdAlreadyExistsException` - Indicates that a code version with the given id already exists.
    
    Media type: `application/json, text/xml`. Schema: `fault`.
    
*   **default**
    
    Media type: `application/json, text/xml`. Schema: `code_version`.
    

## Schemas

### code\_version\_result

Result document containing an array of code versions.

*   `count` (_integer (int32)_) The number of returned documents.
*   `data` (_array of code\_version_) The array of code versions
*   `next` (_string_) The URL of the next result page.
*   `previous` (_string_) The URL of the previous result page.
*   `select` (_string_) The fields that you want to select.
*   `start` (_integer (int32)_) The zero-based index of the first search hit to include in the result.  
    Minimum: 0.
*   `total` (_integer (int32)_) The total number of documents.

_Example_

```
{
  "count": 1,
  "data": [
    {
      "activation_time": "2016-01-14T16:48:07Z",
      "active": true,
      "cartridges": "bc_gillian, test_bc_wapi, test_bc_wapi_deprecated",
      "compatibility_mode": "16.2",
      "id": "version1",
      "last_modification_time": "2016-01-14T16:48:07Z",
      "rollback": false,
      "total_size": "537 KB",
      "web_dav_url": "https://example.com/on/demandware.servlet/webdav/Sites/Cartridges/version1"
    }
  ],
  "total": 1
}
```

### fault

Document representing a fault message that is returned whenever the HTTP status code is greater than or equal to 400 (which indicates an error).

*   `arguments` (_object_)
    
    A map that provides fault arguments.
    
    Data can be used to provide error messages on the client side.
    
    Additional properties: `object`.
    
*   `cause` (_cause_)
*   `display_message_pattern` (_string_) The localized display message pattern, if the request parameter display\_locale was given
*   `message` (_string_) The message text of the java exception.
*   `stack_trace` (_string_)
*   `type` (_string_) The name of the java exception.

### code\_version

Document representing a code version

*   `activation_time` (_string (date-time)_) The code version activation time.
*   `active` (_boolean_) Use this method to determine, if this code version is currently active.
*   `cartridges` (_array of string_) A list containing the names of all cartridges participating in this code version.
*   `compatibility_mode` (_string_) The code version compatibility mode.
*   `id` (_string_) The code version id.
*   `last_modification_time` (_string (date-time)_) The last time, when the code version was changed.
*   `rollback` (_boolean_) Use this method to determine, if this code version is the current rollback version.
*   `total_size` (_integer (int64)_) Returns the total size of the file system content of this code version in bytes.
*   `web_dav_url` (_string_) Returns the HTTPS based WebDAV URL that can be used to access the code version resources.

_Example_

```
{
  "activation_time": "2016-01-14T16:48:07Z",
  "active": true,
  "cartridges": [
    "storefront",
    "storefront_richUI",
    "sitegenesis",
    "sitegenesis_richUI"
  ],
  "compatibility_mode": "16.2",
  "id": "version2",
  "last_modification_time": "2016-01-14T16:48:07Z",
  "rollback": false,
  "total_size": 537345,
  "web_dav_url": "https://example.com/on/demandware.servlet/webdav/Sites/Cartridges/version2"
}
```

### cause

*   `cause` (_cause_)
*   `message` (_string_)
*   `type` (_string_)