VMware Networking Community
VMgwbaby
Enthusiast
Enthusiast
Jump to solution

500 Internal Server Error while I tried to run POST API against NSX controllers

I have "500 internal server error" when I do POST command for controllers. Would you explain why it happened?

1. I retrieved the controller ID (controller-1) by using below command meaning that my authorization is correct (nsx-mgr can communicate with postman)

Retrieve available controller IDs with GET /api/2.0/vdn/controller

2. I am able to run GET to get the status of controller, for example

GET /api/2.0/vdn/controller/controller-1/syslog

The return value said that "Syslog serer is not configured for controller.."

3. Then I tried to run POST commands with below syntax, I got 500 error.

<controllerSyslogServer>

<syslogServer>1.2.3.4</syslogServer>

<port>12345</port>

<protocol>tcp</protocol>

<level></level>

</controllerSyslogServer>

Does anyone know why I am getting this? I test it from HOL and my homelab, the results were same. By the way, return value said "400 Bad Request"

FYI I added "Content-type with application/xml"

1 Solution

Accepted Solutions
Sreec
VMware Employee
VMware Employee
Jump to solution

You are missing logging level in the Post Body call

<controllerSyslogServer>

<syslogServer>1.2.3.4</syslogServer>

<port>12345</port>

<protocol>tcp</protocol>

<level></level>

</controllerSyslogServer>

Correct Format is

<controllerSyslogServer>

<syslogServer>1.2.3.4</syslogServer>

<port>12345</port>

<protocol>tcp</protocol>

<level>info</level>

</controllerSyslogServer>

Cheers,
Sree | VCIX-5X| VCAP-5X| VExpert 6x|Cisco Certified Specialist
Please KUDO helpful posts and mark the thread as solved if answered

View solution in original post

6 Replies
Sreec
VMware Employee
VMware Employee
Jump to solution

You are missing logging level in the Post Body call

<controllerSyslogServer>

<syslogServer>1.2.3.4</syslogServer>

<port>12345</port>

<protocol>tcp</protocol>

<level></level>

</controllerSyslogServer>

Correct Format is

<controllerSyslogServer>

<syslogServer>1.2.3.4</syslogServer>

<port>12345</port>

<protocol>tcp</protocol>

<level>info</level>

</controllerSyslogServer>

Cheers,
Sree | VCIX-5X| VCAP-5X| VExpert 6x|Cisco Certified Specialist
Please KUDO helpful posts and mark the thread as solved if answered
VMgwbaby
Enthusiast
Enthusiast
Jump to solution

Adding "INFO" in the level did not solve the problem. I am still getting an 404 error.  I don't know what I am missing.

Reply
0 Kudos
Sreec
VMware Employee
VMware Employee
Jump to solution

Most likely there is something wrong that you did in the past. Do a DELETE call and ensure when you perform GET call , you are getting status as syslog not configured and after that issue the POST call with the correct body.

Cheers,
Sree | VCIX-5X| VCAP-5X| VExpert 6x|Cisco Certified Specialist
Please KUDO helpful posts and mark the thread as solved if answered
Reply
0 Kudos
VMgwbaby
Enthusiast
Enthusiast
Jump to solution

I don't know what I did wrong. I deleted it and tried, but still not working. Let me try in HOL and will update the status. Thanks

Reply
0 Kudos
VMgwbaby
Enthusiast
Enthusiast
Jump to solution

Hi Sreec,

You are correct. When I add a level, it worked. I learned the difference between POST and PUT. I guess it was not working properly until I delete the API command and do it again with a level value. Thanks.

Reply
0 Kudos
Sreec
VMware Employee
VMware Employee
Jump to solution

Glad to hear that Smiley Happy

Cheers,
Sree | VCIX-5X| VCAP-5X| VExpert 6x|Cisco Certified Specialist
Please KUDO helpful posts and mark the thread as solved if answered
Reply
0 Kudos