OS Name/Version: Windows Server 2019
Product Name/Version: AMP v2.5.0.10
Problem Description: Unable to successfully setup/utilize API to get instance info.
I have followed guidance to configure the AMPConfig.cong file to setup API key.
AMPConfig.conf modification
Security.APIKey=##################
# Add the required permissions for the API key
Security.APIKeyPermissions={
"89e0b5c4-9cc4-467c-9637-07826a90a740": [
"Session.Exists",
"Core.GetStatus",
"Core.Read",
"Core.Write"
]
}
API Request
# Define headers and body
$headers = @{
"Content-Type" = "application/json"
"Accept"= "application/json"
"Authorization" = "Bearer 89e0b5c4-9cc4-467c-9637-07826a90a740"
}
$body = @{
"InstanceID" = "ff0498e6-1334-4d33-9a8f-babb1245d3bf"
} | ConvertTo-Json
# Invoke the API request
$response = Invoke-RestMethod -Uri "http://localhost:8081/API/Core/GetStatus" -Method Post -Headers $headers -Body $body
# Output the response
$response
This is the output I receive.
Title Message Stack
Trace
----- ------- -----
Unauthorized Access You do not have permission to use this method (GSMyAdmin.WebServer.GetStatus) at this time. This method requires the Session.Exists permission. ...
It seems the AMPConfig files would revert after starting the server, so I tried setting to read only still with no luck.
Steps to reproduce:
- Step 1: Stop all running instances and ADS01
- Step 2: Modify AMPConfig.conf to setup API
- Step 3: Start instances and ADS01
- Step 4: Files are overwritten by AMP on instance startup.
- Step 5: Setting files to read only doesn’t seem to help.
- Step 6: Consistent error
Title Message Stack
Trace
----- ------- -----
Unauthorized Access You do not have permission to use this method (GSMyAdmin.WebServer.GetStatus) at this time. This method requires the Session.Exists permission. ...
Actions taken to resolve so far:
- Attempt to set config files read only to prevent overwrite
- Utilize CURL and Postman to attempt API without success
- Set explicit API permissions for Session.Exists to try to overcome permissions issue