Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin


scrollbar

The following script is a Windows Powershell example on how to use the Admin Interface REST API to collect all system log files.

Code Block
languagepowershell
$dir = Split-Path $script:MyInvocation.MyCommand.Path
 
$url = "localhost:8080/mcid/api/v1/"
$user = "USER"
$key = "PASS"
 
$auth = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$key)))
 
$uri = $url + "login"
 
Invoke-RestMethod -Uri $uri -Headers @{Authorization=("Basic {0}" -f $auth)} -SessionVariable session
 
$uri = $url + "systemstatus/logs/collect"
$datetime = Get-Date -UFormat %Y%m%d-%H%M%S
$file_path = $dir + "\CollectedLogFiles-" + $datetime + ".zip"
Invoke-RestMethod -Uri $uri -WebSession $session -OutFile $file_path
 
$uri = $url + "logout"
Invoke-RestMethod -Uri $uri -WebSession $session
 

The script logs in, stores the collected log files at the same location as the script and logs out. Please note that the url, user and key are specific per admin interface instance.