Unclear 404 Error from EPM API

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

Welcome Idira to LIVEcommunity!

Our community just got stronger! Explore new identity security resources, connect with experts, and discover more ways to learn and collaborate.

Meet Idira

Unclear 404 Error from EPM API

L1 Bithead

I'm trying to retrieve a list of all application groups in a set from the EPM API using Python. Unfortunately, the API is repeatedly throwing a 404 error and I can't tell if its because of an error in the URL I'm using, or if there is some sort of authentication issue going on in the back end.

 

I'm using CyberArk Identity for authentication. Code is as follows:

data = { 'grant_type': 'client_credentials' } token = requests.post( url='https://<ID>.id.cyberark.cloud/oauth2/token/<webapp>', data=data, auth=(f"{<username>}@cyberark.cloud.<otherID>", <password>) )   auth_header = 'Bearer ' + token["access_token"] self.headers = { 'authorization': auth_header, 'content_type': 'application/json' }

 

Note that I'm using authorization "Bearer" instead of "Basic" as defined at the bottom of this page: https://docs.cyberark.com/epm/26.3.0/en/content/webservices/authenticate-with-identity-administration.htm

 

From there, I'm successfully able to pull a list of sets using this code:

requests.get( url=f'{self.url}/epm/api/sets', headers=self.headers, )

Following this documentation: https://docs.cyberark.com/epm/26.3.0/en/content/webservices/getsetslist.htm

 

This seems to indicate that authentication is working as expected. Using this, I'm able to retrieve set IDs, which I use in the following code:

requests.post( url=f'{self.url}/EPM/API/Sets/{set_id}/Policies/ApplicationGroups/Search', json={}, headers=self.headers )

Following this documentation: https://docs.cyberark.com/epm/26.3.0/en/content/webservices/getappgroups.htm

 

And this is what returns a 404.

 

I'm confused as to why this is happening.

  • I'm able to authenticate earlier in the application to pull sets/setIDs.
  • I used those IDs verbatim in the URL for application group request, following the structure indicated in the documentation for the Application Group request.
  • I'm NOT using the dispatch server to pull data, but instead using the server name defined for my instance of EPM.
  • the account in question has full read/write/modify/delete rights to all sets

 

I can't find any issue with the URL, and authentication seems to be working earlier in the script. Any advice?

1 accepted solution

Accepted Solutions

L1 Bithead

I was able to find a solution. It was a permissions issue.

 

Despite defining a custom permissions group that seemed to have the exact same permissions as Full Control Set Admin, it apparently did not have the same permissions. By swapping the role permissions assignment to Full Control Set Admin, I was able to retrieve the information I was looking for. I don't know if that's an intentional design choice, or if I just made a mistake somewhere along the line. Either way, it's working now.

 

Thanks for the help, Robert!

View solution in original post

6 REPLIES 6

L7 Applicator

Is that literally in your URL

Should it be

serviceuser@<your-tenant-domain> ([email protected].<otherID>).

L1 Bithead

"cyberark.cloud.#####" is literally in the URL, with the number being a specific string.

 

Could you give an example of what the tenant domain would be expected to look like? Is it the 7-digit ID shown displayed the top right corner of Identity? EG: ADF5987 in the "Setting up API Auth" document page? Is it the EPM server name, IE "na101"? Or would it be something else?

L7 Applicator

 

Are you using this exact script

 

url='https://<ID>.id.cyberark.cloud/oauth2/token/

 

or

 

https://<ID-subdomain>.id.cyberark.cloud/oauth2/token/<webapp-alias> where ID-subdomain is used

 

 

L1 Bithead

I am using:

"https://<ID>.id.cyberark.cloud/oauth2/token/<webapp-alias>"

 

where <ID> is the Cyberark Identity id that can be retrieved from the "about" menu in Step 5. of the Identity API documentation

and <webapp-alias> is the alias given to the web app during creation in Identity.

L1 Bithead

I did verify the tenant domain. In identity, it was set with a different domain name (cloud.cyberark.####) which is why it was properly authenticating with the configuration above. I've swapped it to a normal domain name, but that hasn't had any effect on the 404 errors I've been seeing.

L1 Bithead

I was able to find a solution. It was a permissions issue.

 

Despite defining a custom permissions group that seemed to have the exact same permissions as Full Control Set Admin, it apparently did not have the same permissions. By swapping the role permissions assignment to Full Control Set Admin, I was able to retrieve the information I was looking for. I don't know if that's an intentional design choice, or if I just made a mistake somewhere along the line. Either way, it's working now.

 

Thanks for the help, Robert!

  • 1 accepted solution
  • 112 Views
  • 6 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!