I'm trying to call the EPM API using Python Requests, but it doesn't work. What is wrong with the script below?

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

I'm trying to call the EPM API using Python Requests, but it doesn't work. What is wrong with the script below?

L1 Bithead

I'm trying to call the EPM API using Python Requests, but it doesn't work. What is wrong with the script below? I created it with reference to the following document.

 

https://docs.cyberark.com/EPM/23.11.0/en/Content/WebServices/GetDetailedRawEvents.htm

 

The Python script is below.

 

#####################################

import requests

import json

 

token = "<Token that have been researched in advance>"

setID = "<SetID that have been researched in advance>"

 

url = "https://jp.epm.cyberark.com/EPM/API/Sets/" + setID + "/Events/Search"

headers = {"Content-Type": "application/json", "Authorization": "basic " + token}

data = {"filter": "fileName CONTAINS \"notepad++\""}

 

res = requests.post(

  url,

  headers = headers,

  json = data,

  verify = False

)

 

print(res.status_code)

print(res.text)

#####################################

 

When I run the above, the following will be displayed.

 

500

[{"ErrorCode":"EPM000001E","ErrorMessage":"Internal Error."}]

 

16 REPLIES 16

L1 Bithead

Hi everyone,

This problem solved! It was the server URL that was the problem.

 

Incorrect:

url = "https://jp.epm.cyberark.com/EPM/API/Sets/" + setID + "/Events/Search"

 

Correct:

url = "https://jp153.epm.cyberark.com/EPM/API/Sets/" + setID + "/Events/Search"

 

Actually, there were no other problems other than the above.

 

To explain, "jp.epm.cyberark.com" is the address of the Dispatcher server, and this API will not work unless it is a server after being dispatched.

L7 Applicator

Glad to know issue is fixed, and thanks @Koichiro Ota​ for sharing the resolution.

  • 629 Views
  • 16 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!