powershellazure-cli

problem with closing parenthesis ')' in az rest body


I'm trying to send a post request using az rest. When I try send request like this - it works:

az rest --method POST --uri "https://someaddress" --body '{"some": "Text" }'

but If I put ')' - closing parenthesis in body like this:

az rest --method POST --uri "https://someaddress" --body '{"some": "Text)" }'

then my rest body is cut off and I receive an error:

az : " }" was unexpected at this time.
At line:2 char:1
+ az rest --method POST --uri "https://someaddress" --body '{"some": "T ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (" }" was unexpected at this time.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

How can I escape the ')' character?


Solution

  • Let me complement your own answer with some background information:


    Therefore you have two options: