VeritasOS / netbackup-api-code-samples

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

ansible uri call for vmware resource limits #49

Closed ntbritton closed 4 years ago

ntbritton commented 4 years ago

Using the ansible uri call to changes a resourcelimit gives an api error, but the payload seems to be as it should be.

body: data: type: resource-limits attributes: resources: resourceType: Datastore resourceLimit: 2

TASK [vmware resource limits - vCenter] ***** fatal: [127.0.0.1]: FAILED! => {"changed": false, "connection": "close", "content": "{\"errorCode\":9926,\"errorMessage\":\"Input JSON is invalid\",\"attributeErrors\":{},\"fileUploadErrors\":[],\"errorDetails\":[]}\n", "content_length": "119", "content_type": "application/json;charset=UTF-8", "date": "Thu, 12 Dec 2019 20:30:47 GMT", "elapsed": 0, "json": {"attributeErrors": {}, "errorCode": 9926, "errorDetails": [], "errorMessage": "Input JSON is invalid", "fileUploadErrors": []}, "msg": "Status code was 400 and not [201]: HTTP Error 400: ", "redirected": false, "status": 400, "url": "https://master01:1556/netbackup/config/resource-limits", "x_request_id": "955CBA12DF28644B"}

ntbritton commented 4 years ago

I found the solution. It was a ansible specific solution. To force the list object the first value needed to be proceeded by a -

I have updated the code in the fork.