Skip to content

Update customer attribute value

Post
bash
https://api.bunce.so/v1/attributes/customers

Create an attribute value for customers.

If successful, your response includes a copy of the new customer attributes values. If there is an error with any of the parameters, it will return a 422 HTTP status code with details in an error object.

Request

Body Parameters required

id string<uuid> requiredAttribute Identifier
customer_id stringCustomer ID ( Required if customer_email and customer object is not present in the request row )
customer_email string<email>Customer Email ( Required if customer_id and customer object is not present in the request row )
customer arrayCustomer to add attribute value to. ( Required if customer_id and customer_email is not present in the request row )
value string requiredAttribute Value

Customer Object

customer arrayCustomer to add attribute value to.
  • customer_id string required if email is not present
  • email email required if customer_id is not present
  • first_name string optional
  • last_name string optional
  • phone_no string optional
  • devices array optional

For attributes values that are of the timestamp data type, values are expected to be in YYYY-MM-DDTHH:MM:SSZ (UTC) format. values for timestamp datatype not in the format will be skipped.


Devices Field

The devices field is an optional array of device objects. Each device object should contain the following fields:

  • device_type (string): The type of device (e.g., ios, android).
  • device_token (string): The token associated with the device.
bash
curl --request POST \
  --url https://api.bunce.so/v1/attributes/customers \
  --header 'Content-Type: application/json' \
  --header 'X-Authorization: sk_live_************************' \
  --data '{
    "attributes" : [
        {
            "id": "9f171295-6935-400c-af6b-fd628a46bc71",
            "customer_email" : "verynewcustomer@gmail.com",
            "value": "Developer"
        },
        {
            "id": "9f171295-6935-400c-af6b-fd628a46bc71",
            "customer_id" : "new_id_100",
            "value": "Developer"
        },
        {
            "id": "9f171295-6935-400c-af6b-fd628a46bc71",
            "customer": {
                "customer_id" : "290000",
                "first_name": "Dami Edited",
                "last_name": "Robert Edited",
                "phone_no": "08106489348",
                "email": "mfon9000@gmail.com",
                "devices" : [
                    {
                        "device_type" : "ios",
                        "device_token": "111118766834283"
                    }
                ]
            },
            "value": "Product Manager"
        }
    ]
}'
go
import (
    "fmt"
    "strings"
    "net/http"
    "io/ioutil"
)

url := "https://api.bunce.so/v1/attributes/customers"

payload := strings.NewReader("{\n \"attributes\": [\n {\n \"id\": \"9f171295-6935-400c-af6b-fd628a46bc71\",\n \"customer_email\": \"verynewcustomer@gmail.com\",\n \"value\": \"Developer\"\n },\n {\n \"id\": \"9f171295-6935-400c-af6b-fd628a46bc71\",\n \"customer_id\": \"new_id_100\",\n \"value\": \"Developer\"\n },\n {\n \"id\": \"9f171295-6935-400c-af6b-fd628a46bc71\",\n \"customer\": {\n \"customer_id\": \"290000\",\n \"first_name\": \"Dami Edited\",\n \"last_name\": \"Robert Edited\",\n \"phone_no\": \"08106489348\",\n \"email\": \"mfon9000@gmail.com\"\n },\n \"value\": \"Product Manager\"\n }\n ]\n}")


req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-Authorization", "sk_live_************************")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
js
import  from 'node-fetch'

let  = 'https://api.bunce.so/v1/attributes/customers'

let  = {
  : 'POST',
  : {
    'X-Authorization': 'sk_live_************************',
    'Content-Type': 'application/json',
  },
  : `{
    "attributes" : [
        {
            "id": "9f171295-6935-400c-af6b-fd628a46bc71",
            "customer_email" : "verynewcustomer@gmail.com",
            "value": "Developer"
        },
        {
            "id": "9f171295-6935-400c-af6b-fd628a46bc71",
            "customer_id" : "new_id_100",
            "value": "Developer"
        },
        {
            "id": "9f171295-6935-400c-af6b-fd628a46bc71",
            "customer": {
                "customer_id" : "290000",
                "first_name": "Dami Edited",
                "last_name": "Robert Edited",
                "phone_no": "08106489348",
                "email": "mfon9000@gmail.com",
                "devices" : [
                    {
                        "device_type" : "ios",
                        "device_token": "111118766834283"
                    }
                ]
            },
            "value": "Product Manager"
        }
    ]
}`,
}

(, )
  .then(() => .json())
  .then(() => .())
  .catch(() => .('error:' + ))
php
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
    "attributes" : [
        {
            "id": "9f171295-6935-400c-af6b-fd628a46bc71",
            "customer_email" : "verynewcustomer@gmail.com",
            "value": "Developer"
        },
        {
            "id": "9f171295-6935-400c-af6b-fd628a46bc71",
            "customer_id" : "new_id_100",
            "value": "Developer"
        },
        {
            "id": "9f171295-6935-400c-af6b-fd628a46bc71",
            "customer": {
                "customer_id" : "290000",
                "first_name": "Dami Edited",
                "last_name": "Robert Edited",
                "phone_no": "08106489348",
                "email": "mfon9000@gmail.com",
                "devices" : [
                    {
                        "device_type" : "ios",
                        "device_token": "111118766834283"
                    }
                ]
            },
            "value": "Product Manager"
        }
    ]
}');

$request->setRequestUrl('https://api.bunce.so/v1/attributes/customers');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders([
  'X-Authorization' => 'sk_live_************************',
  'Content-Type' => 'application/json'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
java
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.bunce.so/v1/attributes/customers"))
    .header("X-Authorization", "sk_live_************************")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\n \"attributes\": [\n {\n \"id\": \"9f171295-6935-400c-af6b-fd628a46bc71\",\n \"customer_email\": \"verynewcustomer@gmail.com\",\n \"value\": \"Developer\"\n },\n {\n \"id\": \"9f171295-6935-400c-af6b-fd628a46bc71\",\n \"customer_id\": \"new_id_100\",\n \"value\": \"Developer\"\n },\n {\n \"id\": \"9f171295-6935-400c-af6b-fd628a46bc71\",\n \"customer\": {\n \"customer_id\": \"290000\",\n \"first_name\": \"Dami Edited\",\n \"last_name\": \"Robert Edited\",\n \"phone_no\": \"08106489348\",\n \"email\": \"mfon9000@gmail.com\"\n },\n \"value\": \"Product Manager\"\n }\n ]\n}"))
    .build();


HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());

System.out.println(response.body());

Response

json
{
  "success": true,
  "data": {
    "saved": [],
    "errors": {
      "0": "Provided value is not a valid format for timestamp attribute. ISO 8601 format is required. Example: 2022-01-01T12:00:00+00:00"
    }
  },
  "message": "Customer attributes successfully updated."
}