Hi - unless I’ve missed it - is there a way to add webhooks to commvault via the API?
Hey
Is this what you’re looking for?
https://documentation.commvault.com/2022e/essential/144668_adding_webhook.html
If not, let me know your end goal and I’ll get a better link
I think
You could try, in the meantime, to capture the body once you submit the creation via the browser.
Hi
Thanks for the replies - yes I’m looking at writing a python script that along with other things - automatically adds MS Teams Webhooks. I’ve been able to figure out most steps - just webhooks don’t seem to be an option and I still have to manually add them in the webconsole.
Mike
I’ll see what I can gather.
Adding
I got a reply, right from dev:
POST {{ServerURL}}/Webhook
Body:
<Api_CreateWebhook headers="Authorization=Splunk 1be3a69e-c5e8-407c-b6bf-1adce9719a19" name="splunktestwh-del2" secret="hamactext" ssl="1" url="<WEBHOOK_URL>" />
Let me know if that helps!
I’ll see what I can gather.
Adding
I’m a little late to the party as it looks like you have provided the solution for the payload.
At the very least maybe I can help by sharing the instructions from Microsoft for the teams web hook
Originally provided by
In this post.
Hi
Thanks for the responses.
I’m using the python requests library:
Capturing the payload using chrome dev tools gives this:
{
"name":"mikes_testing",
"url":"test-webhook.com",
"ssl":false
}
But if I provide the above json payload I get: Request body is empty or format is invalid.
I have many working Post requests and as this is the “captured” payload I’m a bit stumped.
Can you show the post command you are using?
## READ POST DATA JSON
with open('Payload/create_webhook.json') as json_file:
json_data = json_file.read()
## CREATE HEADERS
headers = {'Cookie2': token, "Accept": "application/json", "Content-Type": "application/json"}
## GENERATE REQUEST
r = requests.post(clientPropsReq, json=json_data, headers=headers)
resp = r.text
print(resp)
print(r.status_code)
This works for all other post requests I’ve been testing (just not webhooks) - but that’s fine if its not supported yet :)
I don’t know much about Python, so I’ll have to do some reading to get details but my guess is that.
json=json_data
Is where your issue is as the payload you posted looks incomplete, referencing what
At some point I am going to try using this in my own workflows so I’ll putz around with this and see if I can be more helpful.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.