- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
07-23-2020 11:12 AM
Version
API version
Type: String
Valid value: Version number. Format is x.x.x.x (for example, 11.5.0.1)
Default value: Latest version
Mandatory: No
How do you do a "default value" in a URL?
07-23-2020 11:31 AM
See the note here: https://docs.cyberark.com/Product-Doc/OnlineHelp/EPM/Latest/en/Content/WebServices/WebServicesIntro.htm#APIversioning
"We recommend not specifying the version number in the REST API URL, which will run the latest version of the API. Review the EPM Release Notes to determine which APIs changed in each release."
So just omit that portion of the url.
07-23-2020 11:46 AM
So to be clear, just:
https://na999.epm.cyberark.com/EPM/API//Auth/EPM/Logon
I use that and get a 500 (when posting the username, password, and application ID)
Where/how can I troubleshoot that further?
$body = [pscustomobject] @{
Username = $Username
Password = $Password
ApplicationID = $($MyInvocation.MyCommand).ToString()
}
$url = "{0}/EPM/API/Auth/EPM/Logon" -f $EpmBaseUrl
$url
try
{
$token = Invoke-RestMethod -Uri $url -Method Post -Body $body -ContentType application/json
}
catch
{
$_.Exception | fl * -force
}
$token
07-23-2020 12:41 PM
2 things to try - remove the extra backslash in the URL:
https://na999.epm.cyberark.com/EPM/API/Auth/EPM/LogonThe Body should be formatted as JSON
$body = [pscustomobject] @{
Username = $Username
Password = $Password
ApplicationID = $($MyInvocation.MyCommand).ToString()
} | ConvertTo-Json
07-23-2020 12:46 PM
Thanks. I thought .NET automatically converted the body content to the correct content format, but apparently not. When I explicitly convert to JSON I get a 401, which is an improvement over a 500.
I'll figure out what I've done wrong with the user setup. I had to create a new user ID for this test because we normally access EPM via SAML federation.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!

