dynamicweb / CLI

CLI for Dynamicweb 10 automation in development, builds and deployment scenarios
4 stars 2 forks source link

Command PageCopy throws an error #9

Closed Imar closed 1 year ago

Imar commented 1 year ago

I am trying to copy a page with ID 150 as a child of another page with ID 149 using this command:

dw command PageCopy --json '{ "SourcePageId": 150, "DestinationParentPageId": 149 }'

Expected results: The page is copied successfully

Actual results: An error is displayed at the command line:

undefined:1 '{ ^

SyntaxError: Unexpected token ' in JSON at position 0 at JSON.parse () at parseJsonOrPath (file:///D:/Projects/Dynamicweb/Cli/bin/commands/command.js:75:21) at handleCommand (file:///D:/Projects/Dynamicweb/Cli/bin/commands/command.js:44:88)

frederik5480 commented 1 year ago

The documentation was missing an update as the json used for commands has a different structure so the example was outdated, this has been fixed now so the request should be dw command PageCopy --json '{ "model": { "SourcePageId": 150, "DestinationParentPageId": 149 } }'

Imar commented 1 year ago

Great, thanks. Note that this has the same issues as page delete; the quotes won't work as shown. Single quotes with escaped double quotes worked OK at a normal command prompt:

dw command PageCopy --json "{ \"model\": { \"SourcePageId\": 1726, \"DestinationParentPageId\": 150 } }"