Has anyone used apis to login to the command center?
I think my code below works for login, but doesn’t work for logout.
I’ve redacted specific details.
Eventually I want it to login, create a credential in the vault and logout but I’m also having issues removing httponly from the session.
curl -k -L -v -X POST "https://myserver/commandcenter/api/Login" -H "Content-Type: application/x-www-form-urlencoded" -H "Accept: application/json" --data-urlencode "username=xxx" --data-urlencode "password=xxx" -c "E:\automation\cookie.txt"
echo logout
curl -k -L -v "https://myserver/commandcenter/api/Logout" -b "E:\automation\cookie.txt" -c "E:\automation\cookie2.txt" -H "Content-Length: 15" -H "Content-Type: text/plain; charset=utf-8"
Can anyone advise?
Thanks.
This is the output of the logout command:
* Connected to myserver (::1) port 443
* schannel: disabled automatic use of client certificate
* ALPN: curl offers http/1.1
* ALPN: server did not agree on a protocol. Uses default.
* using HTTP/1.x
> GET /commandcenter/api/Logout HTTP/1.1
> Host: my server
> User-Agent: curl/8.9.1
> Accept: */*
> Cookie: JSESSIONID=A0A9471D67AFB7C72DB4BBCCF87D1045
> Content-Length: 15
> Content-Type: text/plain; charset=utf-8
>
* Request completely sent off
< HTTP/1.1 408
< Strict-Transport-Security: max-age=31536000;includeSubDomains
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
< Content-Security-Policy: default-src 'self' https:; script-src 'self' 'unsafe-eval' 'nonce--7ipy0jue34nv' https://code.highcharts.com https://www.googletagmanager.com ; img-src 'self' https://flagcdn.com blob: data: https://*.mapbox.com/ https://*.gstatic.com ; connect-src 'self' https://ipapi.co/ https://*.mapbox.com/ https://git.commvault.com https://api-engineer.azurewebsites.net/ https://edit.commvault.com:11316 http://deployer.commvault.com:8888/ https://deployer.commvault.com:8888/ https://www.google-analytics.com/ ; object-src 'none' ; worker-src 'self' blob: ; child-src 'self' blob: data: https://export.highcharts.com https://www.youtube.com/ https://*.vimeo.com/ ; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://stackpath.bootstrapcdn.com; base-uri 'self' ; font-src 'self' data: https://fonts.gstatic.com ; upgrade-insecure-requests; report-uri https:///commandcenter/consoleError.do;
< Permissions-Policy: accelerometer=(); geolocation=(); gyroscope=(); microphone=(); payment=();
< X-UA-Compatible: IE=Edge,chrome=1
< Referrer-Policy: strict-origin-when-cross-origin
< vary: accept-encoding
< Content-Type: text/html;charset=UTF-8
< Content-Length: 1640
< Date: Fri, 21 Mar 2025 11:02:21 GMT
< Connection: close
< Server:
<
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; style-src 'self' 'unsafe-inline';">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="cloudFav.png" />
<title>Error page</title>
<style>
body {
padding-top: 120px;
margin-left: auto;
margin-right: auto;
color: #2e4f66;
text-align: center;
font-family: Helvetica,Arial,sans-serif;
}
img {
display: block;
max-width: 100%;
height: auto;
margin-left: auto;
margin-right: auto;
}
h1, h2, p {
margin: 0;
padding: 0;
font-weight: normal;
}
h1 {
margin-top: 18px;
margin-bottom: -12px;
font-size: 72px;
}
h2 {
font-size: 24px;
}
p {
margin-top: 29px;
font-size: 21px;
margin-left: auto;
margin-right: auto;
}
</style>
</head>
<body>
<img src="/gears.png" alt="Error" />
<h1>An error has occurred.</h1>
<p>We're sorry, but something prevented us from completing your request.</p>
</body>