Informacje

Uwierzytelnianie wymagane
Format odpowiedzi json
Metoda HTTP PUT

PUT customer_field_group_items/:id

Ostatnia modyfikacja 1970-01-02 01:00:00

Edycja rekordu pól specjalnych klienta.

URL

https://your-system-name.thulium.com/api/customer_field_group_items/:id

Parametry

values

wymagany

Lista wartości dla pól w grupie. Identyfikatory pól można uzyskać poprzez zasób customer_field_groups Przykładowa wartość: { "field_id": 12, "value": "phone" }

Przykładowy request

PUT https://your-system-name.thulium.com/api/customer_field_group_items/32
Dane { "values": [ { "field_id": 12, "value": "phone" }, { "field_id": 8, "value": 13 }, { "field_id": 10, "value": "comment" } ] }

Przykładowy response

<!-- pusty -->

Przykładowe wywołanie


PHP
<?php
$data = '{
    "values": [
        {
            "field_id": 12,
            "value": "phone"
        },
        {
            "field_id": 8,
            "value": 13
        },
        {
            "field_id": 10,
            "value": "comment"
        }
    ]
}';

$request = curl_init('https://your-system-name.thulium.com/api/customer_field_group_items/32');
curl_setopt($request, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json; charset=utf-8',
    'Content-Length: ' . mb_strlen($data)
));
curl_setopt($request, CURLOPT_USERPWD, 'api_user:api_pass');
curl_setopt($request, CURLOPT_TIMEOUT, 30);
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
curl_setopt($request, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($request, CURLOPT_POSTFIELDS, $data);

$response = curl_exec($request);
if ($response) {
    $httpCode = curl_getinfo($request, CURLINFO_HTTP_CODE);
    if ($httpCode == 200){
        print_r(json_decode($response));
    } else {
        echo $response;
    }
} else {
    trigger_error(curl_error($request), E_USER_WARNING);
}

curl_close($request);
JAVA
public class Example {
    public static void main(String[] args) throws Exception {
        ThuliumRestClient restClient = new ThuliumRestClient("api_user", "api_pass", true);

        ThuliumRestClient.ThuliumRestResponse response = restClient.put("https://your-system-name.thulium.com/api/customer_field_group_items/32", "{
    \"values\": [
        {
            \"field_id\": 12,
            \"value\": \"phone\"
        },
        {
            \"field_id\": 8,
            \"value\": 13
        },
        {
            \"field_id\": 10,
            \"value\": \"comment\"
        }
    ]
}");
        System.out.println(response);
    }
}

CURL
curl -u api_user:api_pass -k -X PUT -H "Content-type: application/json" -d '{
    "values": [
        {
            "field_id": 12,
            "value": "phone"
        },
        {
            "field_id": 8,
            "value": 13
        },
        {
            "field_id": 10,
            "value": "comment"
        }
    ]
}' "https://your-system-name.thulium.com/api/customer_field_group_items/32"

HTTPie
echo '{
    "values": [
        {
            "field_id": 12,
            "value": "phone"
        },
        {
            "field_id": 8,
            "value": 13
        },
        {
            "field_id": 10,
            "value": "comment"
        }
    ]
}' | http -a api_user:api_pass PUT https://your-system-name.thulium.com/api/customer_field_group_items/32