Asheeholic
3 years agoLevel 3
NetBackup Api policy config patch not working
I used netbackup API in swagger for test, and GET, PUT, DELETE is working, but the PATCH is not working.
The Policy Name is "OEL7-1_ORACLE"
The cURL is
curl -X 'PATCH' \
'xx:1556/netbackup/config/policies/OEL7-1_ORACLE' \
-H 'accept: */*' \
-H 'X-NetBackup-Audit-Reason: xx' \
-H 'Content-Type: application/vnd.netbackup+json;version=7.0' \
-d '{
"data": {
"type": "policy",
"id": "OEL7-1_ORACLE",
"attributes": {
"policy": {
"policyName": "OEL7-1_ORACLE",
"policyAttribute": {
"active": true
}
}
}
}
}'
I want to that policy make active 'true', but the Error is 400 and
{ "errorCode": 9926, "errorMessage": "Input JSON is invalid", "attributeErrors": {}, "fileUploadErrors": [], "errorDetails": []}
What did i miss?
Hi Asheeholic
I figured it out - you use the Chrome inspect (network tab) option to look at the payload sent. What the WebUI sends is different to the documentation (doesn't help).
All you need to do is change the data payload to something like this (your header lines should be fine as is).
{
"data": {
"type": "patchPolicyRequest",
"id": "OEL7-1_ORACLE",
"attributes": {
"policy": {
"policyAttributes": {
"active": false
}
}
}
}
}
So the "type" is documented incorrectly - it should be patchPolicyRequest (not policyPatchRequest), and within the attributes section you need an additional "policy" section before the policyAttributes.Cheers
David