Salesforce Commerce Cloud simple webdav API
- 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
$ npm i sfcc-webdav
- Node >= 10
Requires a dw.json with client_id/secret
{
"hostname": "dev01-mysandbox.demandware.net",
"client_id": "a12464ae-b484-4b90-4dfe-17e20844e9f0",
"client_secret": "mysupersecretpassword"
}
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"
]
}
]
}
]
}
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');
Released under the MIT license.