Dell Technologies ECS REST API

Search (SHIFT+S)




Getting started with CURL for REST API Commands

Leveraging the ECS Management REST API Using CURL

Download and Setup CURL

Download and install CURL for Windows or Linux from: https://curl.haxx.se or https://github.com/curl/curl-for-win

Extract contents and append PATH to include location to curl_directory_name/bin

Verify curl functionality with curl -h, for help, or curl -V, for version

Authenticate with the ECS Management REST API

ECS uses a token-based authentication system for REST API calls. This section provides examples of authenticating with the ECS API, with and without cookies

When you are authenticated by ECS, the ECS API returns an authentication token. You can use this token for authentication in subsequent calls.

The ECS API is available on port:4443. Clients access ECS by issuing a login request in the form.

You have two options when initiation your login command, either receiving back the Auth Token and copy and paste that with each additional command you wish to run, or you can create a Cookie File that can store the Auth Token and you???ll simply add a syntax to each command referencing your cookie file containing the Auth Token. Both methods are shown below:

Login and Obtain the Auth Token
The UserID and Password are of an ECS GUI Management User.

curl -svk https://<ECS_IP>:4443/login? -u userID:Pwd
The output will end with a section containing the Authentication Token.

< HTTP/1.1 200 OK
< Date: Mon, 08 Mar 2021 01:47:15 GMT
< Content-Type: application/xml
< Content-Length: 93
< Connection: keep-alive
< X-SDS-AUTH-TOKEN: BAAcOThZY3Zoa1ZPc1kzL0hKNVFHRUNPdzVkbjVjPQMAjAQASHVybjpzdG9yYWdlb3M6VmlydHVhbERhdGFDZW50ZXJEYXRhOjIyMjJkNWRiLWYzOTEtNDA4OS05MTlmLWM4ZmI5YmE5YWM4ZgIADTE2MTUxMTY2MjI4ODYDAC51cm46VG9rZW46ZDJjMzg0MTItNDczNS00NTNlLTliMmItYmE2NDQ5MTMwYmMwAgAC0A8=
< X-SDS-AUTH-USERNAME: root
< X-SDS-AUTH-MAX-AGE: 28800
<
* Connection #0 to host 10.52.202.25 left intact
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><loggedIn><user>root</user></loggedIn>
You will want to copy the Auth Token so you can add it to each command using the -H "Auth_Token_Paste" syntax.

The output will end with a section containing

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><loggedIn><user>root</user></loggedIn>

Login and Save Auth Token to Cookie File
The UserID and Password are an ECS Management User. The -c cookiefile can a filename with or without extension.

curl -L -location-trusted -k https://<ECS_IP>:4443/login?using-cookies=true -u userID:Pwd -c cookiefile

You can now run commands and add the -b cookiefile syntax to pass the Auth Token stored in the cookie.