Jump to content
Welcome to our new Citrix community!

disable a server via curl

Jes M

Recommended Posts


I was able to query the status of the server with :


curl -s -k -u <usr>:<pwd> https://<ns-ip>/nitro/v1/config/server/<server-name>?attrs=state,ipaddress


Is it possible to do a curl call to disable the server?

The idea is to do: disable server <Server-Name> 50 -graceFul yes


If I do the following, getting an error: Invalid POST request 

curl -s -k -u <usr>:<pwd> -X POST  https://<ns-ip>/nitro/v1/config/server/<server-name>?action=disable


curl -s -k -u <usr>:<pwd> -X POST  https://<ns-ip>/nitro/v1/config/server?action=disable


Am I missing anything?


Doc: https://developer-docs.citrix.com/projects/netscaler-nitro-api/en/12.0/configuration/basic/server/server/#disable




Link to comment
Share on other sites

according to the documantation you need  to do a  POST  to this   URL : http://<netscaler-ip-address>/nitro/v1/config/server?action=disable

And the payload of the request needs to be something like this:


{"server":{ "name":<String_value>, "delay":<Double_value>, "graceful":<String_value> }}. Edit this and put this in a txt file.


you should do  POST via curl and send as a payload the file , something like this:


curl -X POST -d <filename>  http://<netscaler-ip-address>/nitro/v1/config/server?action=disable



  • Like 1
Link to comment
Share on other sites

Thanks Mihai Czraki!

It finally worked like this:


curl -s -i -k -H "Content-Type:application/vnd.com.citrix.netscaler.server+json" -u <usr>:<pwd> -X POST -d '{"server":{ "name":"serverName"}}' https://myns/nitro/v1/config/server?action=enable


curl -s -i -k -H "Content-Type:application/vnd.com.citrix.netscaler.server+json" -u <usr>:<pwd> -X POST -d '{"server":{ "name":"serverName", "delay":"100", "graceful":"YES"}}' https://myns/nitro/v1/config/server?action=disable


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...