Przejdź do treści

Update CRM Notice

Aktuualizowanie komunikatu CRM

PUT /crm_notice/{crm_notice_id}

URL Parameters

Nazwa Rodzaj Przykład Opis
crm_notice_id <STRING> 64476899cd16c07f5a58a26b Identyfikator komunikatu CRM

Body

{
    "name": <STRING>,
    "type": <STRING>,
    "crm_id": <STRING>,
    "text": <INTEGER>,
    "active": <BOOLEAN>
    "from_date": <STRING>
    "to_date": <STRING>
    "contact_id_list": <LIST<STRING>>
    "for_all_contact": <BOOLEAN>
}

Pełen opis pól i dostępne wartości znajdziesz w CRMNotice

Response Body

{
    "data": <CRMNotice>
}
Nazwa Rodzaj Opis Zasób
data <CRMNotice> Obiekt CRMNotice

Response Code

Status Opis
200 Rekordy zostały pobrane pomyślnie
400 Nieprawidłowe dane
404 Nie znaleziono zasobu

Example

curl -X PUT \
$CONPEEK_URL/crm_notice/64476899cd16c07f5a58a26b \
-H 'Authorization: '$CONPEEK_KEY \
-H 'Content-Type: application/json' \
-d '{
    "name": "KomunikatTestowy",
    "crm_id": "5d8b810eabe2604896f8d196",
    "type": "CONTACT"
}'
import requests
import os
from urllib import parse

crm_notice_id = "64476899cd16c07f5a58a26b"
url = parse.urljoin(os.environ["CONPEEK_URL"], f"/crm_notice/{crm_notice_id}")

payload = {
    "name": "KomunikatTestowy",
    "crm_id": "5d8b810eabe2604896f8d196",
    "type": "CONTACT"
}

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();
$crm_notice_id = "64476899cd16c07f5a58a26b";

$payload = array(
    "name" => "KomunikatTestowy",
    "crm_id" => "5d8b810eabe2604896f8d196",
    "type" => "CONTACT"
);

curl_setopt_array($curl, array(
    CURLOPT_URL => getenv("CONPEEK_URL")."/crm_notice/$crm_notice_id",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_POSTFIELDS => 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;
}