Getting an authorization token using a curl command

To get an authorization token using curl:

  1. Execute the following command:

    curl --noproxy controller_ip -X POST --fail -ksSfL --url "https://controller_ip:8443/sdn/v2.0/auth" -H "Content-Type: application/json" --data-binary '{"login": {"domain": "domain","user": "user","password": "password"}}'

    The output of the curl command contains the token.

  2. Without including the quotation marks, copy the value displayed for token.

Example input:

$ curl --noproxy 10.1.1.10 -X POST --fail -ksSfL \
--url "https://10.1.1.10:8443/sdn/v2.0/auth" \
-H "Content-Type: application/json" \
--data-binary \
'{"login":{"user":"sdn","password":"skyline","domain":"sdn"}}'

 

Example output:

{"record":{"token":"237c78769e464508895f51410881ef26",
”expiration":1368749850000,"expirationDate":"2013–05–16 17–17–30 —0700",
"userID":"a4fc1cecad844bc280953f983bbdcc26","userName":"sdn",
"domainID":"ba4e20f1c232401e8f75e9f318c0ae8a","domainName":"sdn"}}

More information

About the curl commands in this document
Default domain name, user name, and password