- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
01-05-2024 11:47 AM
I see this error when trying to retrieve an account via the CCP REST API using Python.
{"ErrorCode":"APPAP008E","ErrorMsg":"Problem occurred while trying to use user in the Vault (Error: ITATS982E User APPID is not defined. Diagnostic Info: 6)"}
The retrieval fails the same way using each of requests, http client and pyaim modules
The retrieval of the same account succeeds using PowerShell.
I'd like to get a sample working using the requests module.
Thoughts?
---------- sample script ---------
import requests
Safe = "THESAFE"
AppID = "APPID"
AccountUserName = "USERNAME"
baseURL = "https://ccp.company.com"
url = f'{baseURL}/AIMWebService/api/Accounts'
CertPath = 'C:\\Local\\ccp_retrieve\\client_cert_with_chain.pem'
KeyPath = 'C:\\Local\\ccp_retrieve\\client_cert.key'
querystring = {
"AppID": AppID,
"Safe": Safe,
"UserName": AccountUserName
}
headers = {'content-type': 'application/json'}
response = requests.request("GET", url, headers=headers, params=querystring, cert=(CertPath,KeyPath), verify=False)
print(response.text)
01-05-2024 01:40 PM
APPAP008E information from the docs:
https://docs.cyberark.com/credential-providers/latest/en/Content/MESSAGES/Application%20Provider%20Messages%20-%20General.htm#
https://docs.cyberark.com/credential-providers/Latest/en/Content/CP%20for%20zOS/Activity-on-the-Central-Credential-Provider.htm
https://community.cyberark.com/s/article/CP-APPAP008E-Problem-occurred-while-trying-to-use-user-in-the-Vault-Error-The-user-doesn-t-exist-Diagnostic-Info-9
01-05-2024 12:18 PM
The error states the APPID is not created. Did you create this Application ID under applications?
01-05-2024 01:40 PM
APPAP008E information from the docs:
https://docs.cyberark.com/credential-providers/latest/en/Content/MESSAGES/Application%20Provider%20Messages%20-%20General.htm#
https://docs.cyberark.com/credential-providers/Latest/en/Content/CP%20for%20zOS/Activity-on-the-Central-Credential-Provider.htm
https://community.cyberark.com/s/article/CP-APPAP008E-Problem-occurred-while-trying-to-use-user-in-the-Vault-Error-The-user-doesn-t-exist-Diagnostic-Info-9
01-06-2024 10:02 AM
Yes, the retrieval of the same account (via the same APPID) succeeds using PowerShell.
I noticed while doublechecking that the PowerShell sample is using the PVWA endpoint, while the Python sample uses the CCP endpoint. this looks like a piece of the puzzle.
Url in the Python sample:
https://ccp.company.com/AIMWebService/api/Accounts?AppID=APPID&Safe=THESAFE&UserName=USERNAME
Uri in the PowerShell sample:
https://pvwa.company.com/AIMWebService/api/Accounts?AppID=APPID&Safe=THESAFE&UserName=USERNAME
01-06-2024 11:45 AM
Got it. Of the laundry list in the first two links, #4 was the issue:
"The application user does not exist. The application user cannot be defined or is defined in a location that is not visible to the Credential Provider user"
The user did exist, but not in the deployment I needed. The endpoint I was using (CCP endpoint) was pointing at a different deployment, which didn't contain the AppId.
The PowerShell sample (using the PVWA endpoint in a different deployment) was able to see the AppId and retrieve the secret.
07-10-2024 11:19 AM
To troubleshoot the error and get a working sample using the `requests` module, follow these steps:
1. Check the AppID and UserName**: Ensure that the `AppID` and `AccountUserName` are correctly defined and have the necessary permissions.
2. Verify the Certificate Paths**: Confirm that the paths to the certificate and key files are correct.
3. Adjust the Request**: Use `requests.get` instead of `requests.request("GET", ...)`, and ensure that the URL and parameters are correctly formatted.
Here's a sample script:
```python
import requests
Safe = "THESAFE"
AppID = "APPID"
AccountUserName = "USERNAME"
baseURL = "https://ccp.company.com"
url = f'{baseURL}/AIMWebService/api/Accounts'
CertPath = 'C:\\Local\\ccp_retrieve\\client_cert_with_chain.pem'
KeyPath = 'C:\\Local\\ccp_retrieve\\client_cert.key'
querystring = {
"AppID": AppID,
"Safe": Safe,
"UserName": AccountUserName
}
headers = {'content-type': 'application/json'}
try:
response = requests.get(url, headers=headers, params=querystring, cert=(CertPath, KeyPath), verify=False)
response.raise_for_status() # Raise an HTTPError for bad responses
print(response.text)
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
```
Additional Tips:
Check Permissions: Ensure the user associated with the certificate has the correct permissions.
Debugging: Add `print(response.status_code, response.text)` to see more details about the response.
Certificate Validation: If you need to verify the server's SSL certificate, set `verify=True` or provide a path to the CA bundle file.
Logs: Check CCP logs for more details on the error message.
This should help in diagnosing and fixing the issue with your API request.
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!

