Closed Imar closed 2 years ago
Readme has been updated to reflect the proper example for page delete, these query properties has been moved into the json model being sent to the management API, as this is a property directly tied to the command, it will be in the root of the object sent and not part of 'model'.
It seems that the JSON command doesn't like the JSON at the command prompt. Executing this:
dw command PageDelete --json '{ "Id": "1714" }'
Now gives me this:
SyntaxError: Unexpected token ' in JSON at position 0
at JSON.parse (
It works when I use double quotes on the command line and escape the ones in the JSON:
dw command PageDelete --json "{ \"Id\": \"1718\" }"
This also fails in PowerShell where I have to use single quotes around the command and escaped double quotes within:
dw command PageDelete --json '{ \"Id\": \"1722\" }'
I am trying to delete a page using the following command:
dw command PageDelete --id 1714
Expected results The page is deleted
Actual results: An error is displayed at the console: Error when doing request https://localhost:44360/Admin/Api/PageDelete?Command.id=1714 { status: 'error', message: 'The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. Path: $ | LineNumber: 0 | BytePositionInLine: 0.', exception: 'System.Text.Json.JsonException: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. Path: $ | LineNumber: 0 | BytePositionInLine: 0.\r\n' + ' ---> System.Text.Json.JsonReaderException: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. LineNumber: 0 | BytePositionInLine: 0.\r\n' + ' at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan
1 bytes)\r\n' + ' at System.Text.Json.Utf8JsonReader.Read()\r\n' + ' at System.Text.Json.Serialization.JsonConverter
1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)\r\n' + ' --- End of inner exception stack trace ---\r\n' + ' at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)\r\n' + ' at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)\r\n' + ' at System.Text.Json.Serialization.JsonConverter
1.ReadCoreAsObject(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)\r\n' + ' at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable
1 actualByteCount)\r\n' + ' at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo jsonTypeInfo)\r\n' + ' at System.Text.Json.JsonSerializer.Deserialize(String json, Type returnType, JsonSerializerOptions options)\r\n' + ' at Dynamicweb.Management.Api.Controllers.Api.DataController.GetCommandResult(Type commandType, Type queryType, Object body)\r\n' + ' at Dynamicweb.Management.Api.Controllers.Api.DataController.Post(String command, Object body)', model: null, modelIdentifier: null, resultActions: [] }