Update Webhooks

Update Webhooks

To update a webhook, you will need to use the update webhook endpoint, which requires the webhook ID. To find the ID of the webhook, use the list all webhooks endpoint.

cURL
curl -i -X PUT "https://api.box.com/2.0/webhooks/3321123" \
     -H "Authorization: Bearer <ACCESS_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{
       "triggers": [
         "FILE.DOWNLOADED"
       ]
     }'
Java
BoxWebHook webhook = new BoxWebHook(api, id);
BoxWebHook.Info info = webhook.new Info();
info.setAddress(url);
webhook.update(info);
Python
update_object = {
    'triggers': ['FILE.COPIED'],
    'address': 'https://newexample.com',
}
webhook = client.webhook(webhook_id='12345').update_info(update_object)
print('Updated the webhook info for triggers: {0} and address: {1}'.format(webhook.triggers, webhook.address))
iOS
client.webhooks.update(webhookId: "1234", targetType: "file", targetId: "1234", address: "www.testurl.com") { (result: Result<Webhook, BoxSDKError>) in
    guard case let .success(webhook) = result else {
        print("Error updating webhook")
        return
    }

    print("Updated webhook address to \"\(webhook.address)\"")
}