VeritasOS / netbackup-api-code-samples

Contains code samples that demonstrate the use of NetBackup REST API
MIT License
53 stars 52 forks source link

Error 500 errorCode 130 #61

Closed joshiko closed 3 years ago

joshiko commented 4 years ago

Hello, when I use the API for get the policies definition, the http response is 500 and the content of response is:

{'errorCode': 130, 'errorMessage': 'system error occurred', 'details': {}}

An example GET url is this: https://nbumaster:1556/netbackup/config/policies/BRS_FULL

I run Netbackup 8.1.2

kenogden commented 4 years ago

Do you have the following in your headers?

"X-NetBackup-Policy-Use-Generic-Schema" = $true

I've also commited a new sample for this... "Create new sample Get-NB-PolicyDetails" #63

joshiko commented 4 years ago

Hello, yes, this is the code in my python function:

def get_netbackup_policy(jwt, base_url,testVMwarePolicyName): url = base_url + "/config/policies/" + testVMwarePolicyName global etag headers = {'Content-Type': content_type, 'Authorization': jwt, 'X-NetBackup-Policy-Use-Generic-Schema': 'True'} print("\nperforming GET on {}\n".format(url)) resp = requests.get(url, headers=headers, verify=False) if resp.status_code != 200: print('GET Policy API failed with status code {} and {}\n'.format(resp.status_code, resp.json())) print("\nGet policy details on {} succeeded with status code: {}\n".format(testVMwarePolicyName, resp.status_code)) print("\n The E-tag for the get policy : {}\n".format(resp.headers['ETag'])) etag = resp.headers['ETag'] print("\n Json Response body for get policy : \n{}\n".format(json.loads(resp.content)))

It's the same that appear in the library just adding the 'X-NetBackup-Policy-Use-Generic-Schema': 'True' tag and parse the policy in the parameters

kenogden commented 4 years ago

I just tested the generic schema = true with a vmware policy and it works... I'm not seeing much different in your function versus the ps example I provided. I would wager that something is just slightly malformed in your request.

Can you expand 'details': {}

Also, can you test the current function against a standard policy, instead of VMware, sql, Oracle, etc. which have unique attribute schemas?

joshiko commented 4 years ago

Hello, I try for random policies (one or two for each type) and only get response 200 in the oracle type policies.

lynix12 commented 3 years ago

Hello, i have the same error, that is a bug in NB 8.2 RESTfull API. I have received a patch from support, that fix (EEB 3986887) the issue.