Skip to content

Latest commit

 

History

History
68 lines (48 loc) · 1.55 KB

README.md

File metadata and controls

68 lines (48 loc) · 1.55 KB

sfcc-webdav

Salesforce Commerce Cloud simple webdav API

Features

  • API for upload and delete files via webdav, useful for real-time upload of changes file during development
  • Authentication via OCAPI client, uses dw.json for configuration

Installation

$ npm i sfcc-webdav

Requirements

  • Node >= 10

Configuration

Requires a dw.json with client_id/secret

{
  "hostname": "dev01-mysandbox.demandware.net",
  "client_id": "a12464ae-b484-4b90-4dfe-17e20844e9f0",
  "client_secret": "mysupersecretpassword"
}

API client configuration

The API client must be created from the account.demandware.com consoleand must be granted the required permissions for accessing the cartridges folder through webdav.

For doing so access Business Manager and add the following in Administration -> Organization -> WebDAV Client Permissions. Replace client id with your client id, you may need to merge these settings with existing ones.

{
  "clients": [
    {
      "client_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "permissions": [
        {
          "path": "/cartridges",
          "operations": [
            "read_write"
          ]
        }
      ]
    }
  ]
}

Usage

const sfccwebdav = require('sfcc-webdav');

sfccwebdav.fileUpload('/path/to/local/file', '/cartridges/mycodeversion/app_storefront/cartridge/static/filetoupload');

sfccwebdav.fileDelete('/path/to/local/file', '/cartridges/mycodeversion/app_storefront/cartridge/static/filetodelete');

License

Released under the MIT license.