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
attribute_id string<uuid> required | Attribute Identifier |
customer_email string<email> | Customer Email ( Required if customer_id is not present in the request row ) |
customer_id string<email> | Customer ID ( Required if customer_email is not present in the request row ) |
attribute_value string required | Attribute Value |
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.
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": "9e44002a-4ef9-48d9-b201-7ead97adcfa7",
"customer_email" : "john.6@gmail.com",
"value": "Dami Adeleke"
},
{
"id": "9e44007b-c09c-4f41-9341-a5fe170fa5c2",
"customer_id" : "01JMKHZE5B2J0F2RDK7SKR2PN1",
"value": "2012-09-03T14:30:00Z"
}
]
}'
go
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
url := "https://api.bunce.so/v1/attributes/customers"
payload := strings.NewReader("{\n \"attributes\": [\n {\n \"id\": \"9e44002a-4ef9-48d9-b201-7ead97adcfa7\",\n \"customer_email\": \"john.6@gmail.com\",\n \"value\": \"Dami Adeleke\"\n },\n {\n \"id\": \"9e44007b-c09c-4f41-9341-a5fe170fa5c2\",\n \"customer_id\": \"01JMKHZE5B2J0F2RDK7SKR2PN1\",\n \"value\": \"2012-09-03T14:30:00Z\"\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": "9e44002a-4ef9-48d9-b201-7ead97adcfa7",
"customer_email" : "john.6@gmail.com",
"value": "Dami Adeleke"
},
{
"id": "9e44007b-c09c-4f41-9341-a5fe170fa5c2",
"customer_id" : "01JMKHZE5B2J0F2RDK7SKR2PN1",
"value": "2012-09-03T14:30:00Z"
}
]
}`,
}
(, )
.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": "9e44002a-4ef9-48d9-b201-7ead97adcfa7",
"customer_email" : "john.6@gmail.com",
"value": "Dami Adeleke"
},
{
"id": "9e44007b-c09c-4f41-9341-a5fe170fa5c2",
"customer_id" : "01JMKHZE5B2J0F2RDK7SKR2PN1",
"value": "2012-09-03T14:30:00Z"
}
]
}');
$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\": \"9e44002a-4ef9-48d9-b201-7ead97adcfa7\",\n \"customer_email\": \"john.6@gmail.com\",\n \"value\": \"Dami Adeleke\"\n },\n {\n \"id\": \"9e44007b-c09c-4f41-9341-a5fe170fa5c2\",\n \"customer_id\": \"01JMKHZE5B2J0F2RDK7SKR2PN1\",\n \"value\": \"2012-09-03T14:30:00Z\"\n }\n ]\n}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Response
json
{
"success": true,
"data": [
{
"id": "9e6823d3-e6e2-42b3-8ebc-60abcd88660f",
"attribute_id": "9e44002a-4ef9-48d9-b201-7ead97adcfa7",
"attribute_name": "Student Name",
"customer_email": "john.6@gmail.com",
"attribute_data_type": "text",
"attribute_value": "Dami Adeleke"
},
{
"id": "9e6823d3-e71b-4221-b6be-9ec79cdadac5",
"attribute_id": "9e44007b-c09c-4f41-9341-a5fe170fa5c2",
"attribute_name": "Admission Date",
"customer_email": "invalid01JMKHZE5B2J0F2RDK7SKR2PN1@example.invalid",
"attribute_data_type": "date",
"attribute_value": "2012-09-03T14:30:00Z"
}
],
"message": "Customer attributes successfully updated"
}