Przejdź do treści

Update Webhook Subscription

Aktualizacja subskrypcji

PUT /application/{application_id}/webhook/subscription

URL Parameters

Nazwa Rodzaj Przykład Opis
application_id <INTEGER> 9 Identyfikator systemowy aplikacji

Body

{
    "acw_start": {
        "ensure_delivery": true,
        "active": true
    },
    "voice_campaign_activate": {
        "ensure_delivery": true,
        "active": true
    }
}

Response Body

{
    "success": true, 
    "subscriptions": {
        "acw_start": {
            "ensure_delivery": true,
            "active": true
        },
        "voice_campaign_activate": {
            "ensure_delivery": true,
            "active": true
        }
    }
}

Response Code

Status Opis
200 Żądanie przyjęte do realizacji
403 Nie można wykonać takiej akcji
404 Nie znaleziono zasobu

Example

curl -X PUT \
$CONPEEK_URL/application/9/webhook/subscription \
-H 'Authorization: '$CONPEEK_KEY \
-H 'Content-Type: application/json' \
-d '{"acw_start": {
    "ensure_delivery": true,
    "active": true
}, "voice_campaign_activate": {
    "ensure_delivery": true,
    "active": true
}}'
import requests
import json
import os
from urllib import parse

url = parse.urljoin(os.environ["CONPEEK_URL"], "/application/%(application_id)s/webhook/subscription" % {
    "application_id": "9"
})

payload = {
    "acw_start": {
        "ensure_delivery": true,
        "active": true
    }, 
    "voice_campaign_activate": {
        "ensure_delivery": true,
        "active": true
    }
}

headers = {
    'Content-Type': "application/json",
    'Authorization': os.environ["CONPEEK_KEY"]
}

response = requests.request("PUT", url, data=json.dumps(payload), headers=headers)
print(response.text)
<?php
$curl = curl_init();

$payload = array(
    "acw_start" => array(
        "ensure_delivery" => True,
        "active" => True
    ),
    "voice_campaign_activate" => array(
        "ensure_delivery" => True,
        "active" => True
    )
);

$ticket_id = "5dcd6173f03d645ca3ec6b23";

curl_setopt_array($curl, array(
    CURLOPT_URL => getenv("CONPEEK_URL")."/application/$application_id/webhook/subscription",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_PUTFIELDS => json_encode($payload),
    CURLOPT_HTTPHEADER => array(
        "Authorization: ".getenv("CONPEEK_KEY"),
        "Content-Type: application/json"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;
}