Needed to automate some NSX stuff but I am stuck... I won't cry about JSON examples not being available in documentation .. Here is my issue :
I am using Golang however even Postman fails when using JSON as body payload
Method:POST
URI : https://nsx-mgr.local/api/2.0/vdn/scopes/vdnscope-1/virtualwires
Body ( JSON)
{
"virtualWireCreateSpec": {
"name": "Test-Logical-Switch",
"description": "Test",
"tenantId": "virtual wire tenant",
"controlPlaneMode": "HYBRID_MODE",
"guestVlanAllowed": "false"
}
}
Fails with error
{
"errorCode": 401,
"details": "Invalid Parameter.",
"rootCauseString": null,
"moduleName": null,
"errorData": null
}
But works when I use it with XML
Method:POST
URI : https://nsx-mgr.local/api/2.0/vdn/scopes/vdnscope-1/virtualwires
Body ( XML)
<virtualWireCreateSpec>
<name>Test-Logical-Switch</name>
<description>Test</description>
<tenantId>virtual wire tenant</tenantId>
<controlPlaneMode>HYBRID_MODE</controlPlaneMode>
<guestVlanAllowed>false</guestVlanAllowed>
</virtualWireCreateSpec>
I can convert the Body to XML when calling the API but this is bizarre . As per documentation Json is supported . Maybe I am missing something very simple ?