Examples of syntax for the Operations Center REST API

sergio.morales

ADSM.ORG Member
Joined
Jun 20, 2003
Messages
131
Reaction score
2
Points
0
Website
http
Hello everyone. Recently I've started to tinker with the REST API available on Operations Center (8.1.4) and I was wondering if anyone had any resources out there that show me the syntax for using it? I'm interested in all the available commands, but specifically the following commands:

cli/issueCommand, cli/issueCommand/{server name}, cli/issueConfirmedCommand, bcli/issueConfirmedCommand/{server name}

Again, if anyone has any syntax examples they'd be willing to share, I'd appreciate it!

Thanks in advance!
 
Hi,
this is an old post, but in case it can help someone :
I use powershell and my peace of code goes like :

$admin = "[username]"
$pass = "[password]"

$passSEC = ConvertTo-SecureString -String $pass -AsPlainText -Force
$cred = [pscredential]::new($admin,$passSEC)

$headers = @{}
$headers.add("OC-API-Version", "1.0")
$headers.Add("accept" , "application/json")
$headers.add("Content-Type","text/plain")

$body = "SELECT START_TIME,END_TIME,BYTES_PROTECTED,SOURCE_POOL,TARGET_POOL FROM PROTHISTORY WHERE START_TIME>current_timestamp-72 hours order by START_TIME DESC" # here it's select that will be used in call
$comm = Invoke-RestMethod -uri "https://[oc_server_address]:11090/oc/api/cli/issueCommand/[tsm_server_name]" -Body $body -Credential $cred -Headers $headers -Method POST

# results can be accsessed from $comm.items. Down we have report for protection of storage pool
$comm.items | select SOURCE_POOL,TARGET_POOL,`
@{N="start";E={(get-date 01.01.1970).AddSeconds(($_ | select -ExpandProperty START_TIME).secs + ($_ | select -ExpandProperty START_TIME).tzo)}},`
@{N="end";E={(get-date 01.01.1970).AddSeconds(($_ | select -ExpandProperty END_TIME).secs + ($_ | select -ExpandProperty START_TIME).tzo)}},`
@{N="protected GB";E={[math]::round((($_ | select -ExpandProperty BYTES_PROTECTED)/1GB),2)}},`
@{N="duration";E={((get-date 01.01.1970).AddSeconds(($_ | select -ExpandProperty END_TIME).secs) - ((get-date 01.01.1970).AddSeconds(($_ | select -ExpandProperty START_TIME).secs)))}}
 
Back
Top