Require the commands / script or API for EPM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Require the commands / script or API for EPM

L0 Member

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.

4 REPLIES 4

L4 Transporter

@Lirendra Kumar​ Did you manage to get it?

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..​

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.

 

  • 556 Views
  • 4 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

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!