I am trying to make an API call to create a credential but is failing with error “Request body is empty, or format is invalid.”
I did not modify anything except the endpoint and Token. I am not sure what mistake I am doing here.
documentation referred # https://api.commvault.com/docs/SP32/api/cv/OpenAPI3/create-credential/
import requests
import json
url = "https://commvault.newblr.com/commandcenter/api/V4/Credential"
payload = json.dumps({
"accountType": "CLOUD_ACCOUNT",
"vendorType": "HITACHI_VANTARA_HCP_S3",
"name": "HCPBucketuser01",
"userAccount": "Y3ZidWNrZXQ",
"password": "dc06698f0e2e75751545455899adccc3",
"description": "API test",
"security": {
"owner": {
"user": {
"id": 0,
"name": ""
},
"userGroup": {
"id": 0,
"name": ""
}
},
"associations": [
{
"user": {
"id": 0,
"name": ""
},
"userGroup": {
"id": 0,
"name": ""
},
"permissions": {
"permissionId": 0,
"permissionName": "",
"categoryId": 0,
"categoryName": "",
"type": "ALL_CATEGORIES",
"exclude": True
},
"isCreatorAssociation": True
}
]
}
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authtoken': 'QSDK ******'
}
response = requests.request("POST", url, headers=headers, data=payload, verify=False)
print(response.text)