Skip to content

Update customer attribute value

Post
bash
https://api.bunce.so/v1/attributes/post-customer-value

Create an attribute value for a customer.

If successful, your response includes a copy of the new customer attribute value entity. 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

attribute_id string<uuid> requiredAttribute Identifier
customer_email string<email> requiredCustomer Email
attribute_value string requiredAttribute Value
bash
curl --request POST \
  --url https://api.bunce.so/v1/attributes/post-customer-value \
  --header 'Content-Type: application/json' \
  --header 'X-Authorization: sk_live_************************' \
  --data '{
  "attribute_id": "9bb64536-6bad-4980-bd16-439e26cf7975",
  "customer_email": "johndoe@example.com",
  "attribute_value": "2009-09-03"
}'
go
import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

url := "https://api.bunce.so/v1/attributes/post-customer-value"

payload := strings.NewReader("{\n \"attribute_id\": \"9bb64536-6bad-4980-bd16-439e26cf7975\",\n \"customer_email\": \"johndoe@example.com\",\n \"attribute_value\": \"2009-09-03\",\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/post-customer-value'

let  = {
  : 'POST',
  : {
    'X-Authorization': 'sk_live_************************',
    'Content-Type': 'application/json',
  },
  : '{"attribute_id": "9bb64536-6bad-4980-bd16-439e26cf7975", "customer_email": "johndoe@example.com", "attribute_value": "2009-09-03"}',
}

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

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

$body = new http\Message\Body;
$body->append('{
  "attribute_id": "9bb64536-6bad-4980-bd16-439e26cf7975",
  "customer_email": "johndoe@example.com",
  "attribute_value": "2009-09-03"
}');

$request->setRequestUrl('https://api.bunce.so/v1/attributes/post-customer-value');
$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/post-customer-value"))
    .header("X-Authorization", "sk_live_************************")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\n \"attribute_id\": \"9bb64536-6bad-4980-bd16-439e26cf7975\",\n \"customer_email\": \"johndoe@example.com\",\n \"attribute_value\": \"2009-09-03\",\n}"))
    .build();

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

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

Response

json
{
  "success": true,
  "data": {
    "id": "9bb645a1-19e6-4165-8b9a-399ab4567064",
    "attribute_id": "9bb64536-6bad-4980-bd16-439e26cf7975",
    "attribute_name": "Date of Birth",
    "customer_email": "johndoe@example.com",
    "attribute_data_type": "date",
    "attribute_value": "2009-09-03"
  },
  "message": "Customer Attribute value successfully created"
}