File: Webhooks.md

package info (click to toggle)
owncloud 7.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 104,192 kB
  • sloc: php: 403,584; xml: 5,843; perl: 630; cs: 504; sh: 453; sql: 271; python: 221; makefile: 104
file content (52 lines) | stat: -rw-r--r-- 1,008 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Webhooks

## Setup

To interact with the webhooks of a group's scaling policy, you will need to setup the group and policy objects beforehand.

```php
$groupId  = 'foo';
$policyId = 'bar';

$group  = $service->getGroup($groupId);
$policy = $group->getPolicy($policyId);
```

For more information about setting up the `$service` object, please see the userguide tutorial for [Autoscale groups]().

## Get all webhooks

```php
$webhooks = $policy->getWebookList();
```

## Create a new webhook

```php
$policy->getWebhook()->create(array(
    (object) array(
        'name' => 'Alice',
        'metadata' => array(
            'firstKey'  => 'foo',
            'secondKey' => 'bar'
        )
    )
));
```

## Get, update and delete an individual webhook

```php
$webhookId = 'baz';
$webhook   = $policy->getWebhook($webhookId);

// Update the metadata
$metadata = $webhook->metadata;
$metadata->thirdKey = 'blah';
$webhook->update(array(
    'metadata' => $metadata
));

// Delete it
$webhook->delete();
```