I am trying to initialize an Exchange using Powershell. I need to define a DLQ, so I am trying the following syntax:
$exchangeURL = $apiURL + "/exchanges/myHost/myExchange";
$body = "{""type"":""fanout"",""auto_delete"":false,""durable"":true,""arguments"":[{""x-dead-letter-exchange"": ""myExchangeDLQ""}]}"
$response = Invoke-WebRequest -Uri $exchangeURL -Headers $headers -Method Put -ContentType "application/json" -Body $body
I get this error:
Invoke-WebRequest :
{"error":"bad_request","reason":["unhandled_type",["x-dead-letter-exchange","myExchangeDLQ"]]}
+ $response = Invoke-WebRequest -Uri $exchangeURL -Headers $headers -Method Put -C ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
I see at this link that maybe it is not that easy:
arguments fields are ignored everywhere. You cannot create a queue, exchange or binding with arguments. Queues, exchanges or bindings with arguments won't show those arguments