Home > Storage > PowerFlex > White Papers > PowerFlex REST API Introduction > System information
This section shows the process for displaying system level information. The process consists of the following steps:
Use the following code to authenticate with PowerFlex Manager and initialize variables.
#PFMP ingress
$PFMPhost = 'pfxm.powerflex.lab'
#System name
$SystemName = 'block-legacy-gateway'
#Authentication
$Headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$Headers.Add("Content-Type", "application/json")
$Headers.Add("Accept", "application/json")
$CredJson = "{`"username`": `"admin`", `"password`": `"Password`"}"
$Response = Invoke-RestMethod "https://$PFMPhost/rest/auth/login" -Method POST -Headers $Headers -Body $CredJson
$accessToken = $Response.access_token
#Create authentication header for use in API calls
$AuthHeader = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$AuthHeader.Add("Content-Type", "application/json")
$AuthHeader.Add("Accept", "application/json")
$AuthHeader.Add("Authorization", "Bearer $accessToken")
The following code takes the PowerFlex system name defined in the $SystemName variable and queries for the system id.
#API Call for PowerFlex system id using the user entered system name
$SystemJson = "{`"name`":`"$SystemName`"}"
$SystemID = (Invoke-RestMethod -Uri "https://$PFMPhost/api/types/System/instances/action/queryIdByKey" -Method Post -Body $SystemJson -Headers $AuthHeader)
Use the following code to get information for the PowerFlex system and save it to a file in JSON format.
#API call for PowerFlex system using the $SystemID variable
$SystemInfo = (Invoke-RestMethod -Uri "https://$PFMPhost/api/instances/System::$SystemID" -Headers $AuthHeader)
#Convert object to JSON and write to file.
$SystemInfo | ConvertTo-Json -Depth 4 | Set-Content -Path "C:\Users\Administrator\Desktop\PFsystem.json"