- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
10-24-2019 03:06 AM
Hi Team,
I would require the commands / script or API as below, please support.
1. Login at EPM console with AD credentials
2. identify and enter in the set than search the hostname and move that hostname in a specified group.
3. publish the result and logout or disconnect from the session.
02-04-2020 04:59 AM
@Lirendra Kumar Did you manage to get it?
02-04-2020 06:29 AM
EPM API is documented here: https://docs.cyberark.com/Product-Doc/OnlineHelp/EPM/Latest/en/Content/WebServices/API%20Commands.ht...
02-04-2020 06:38 AM
Thanks..But it is not helping to authenticate with windows credentials.. where do i give the windows credentials with domain name...
When i try without credentials, it is not asking for credentials and throws authentication failure message..
03-05-2020 11:04 PM
Im also facing similar problem. However I manage to login to epm using domain user credentials:
import json
import base64
import urllib.parse
import requests
from requests_ntlm import HttpNtlmAuth
class epmlib:
def __init__(self, domain, username, password):
self.domain = domain
self.username = username
self.password = password
self.token = ''
self.s = requests.session()
def postLogon(self):
url = "https://" + self.domain + "/EPM/API/Auth/Windows/Logon" # https://docs.cyberark.com/Product-Doc/OnlineHelp/EPM/11.2/en/Content/WebServices/ServerAuthentication.htm
task = { 'Username': self.username, 'Password': self.password, 'ApplicationID': 'AppName' }
headers = {'Content-type': 'application/json'}
r = self.s.post( url, auth=HttpNtlmAuth(self.username, self.password), data=json.dumps(task), headers=headers, verify=False )
if r.status_code == 200:
x = r.json()
self.token = x['EPMAuthenticationResult']
else:
print('Error code: ' + str(r.status_code))After executing postLogon im able to get version number:
def getEPMVersion(self):
url = "https://" + self.domain + "/EPM/API/Server/Version" # https://docs.cyberark.com/Product-Doc/OnlineHelp/EPM/11.2/en/Content/WebServices/GetEPMVersion.htm
#headers = {'Authorization': 'basic ' + self.token}
r = self.s.get( url, verify=False )
if r.status_code == 200:
x = r.json()
print(x['Version'])
else:
print('Error code: ' + str(r.status_code))But im not able to execute some gets ex. Get Sets as it require authorization token to be added to header. According to documentation EPMAuthenticationResult is the right token but id doesn't work... Its not even in base64 format. So I stuck at that point.
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!

