Edit customer
Put
bash
https://api.bunce.so/v1/customers/bulk-update
Update multipe customer records.
Request
Route Parameters email
Body Parameters required
email string<email> not required | Customer's email address. Will only be updated if existing customer's email is invalid |
customer_id string not required | Customer's email address |
first_name string not required | Customer's first name |
last_name string not required | Customer's last name |
phone_no string not required | Customer's phone number |
bash
curl --request PUT \
--url https://api.bunce.so/v1/customers/bulk-update \
--header 'Content-Type: application/json' \
--header 'X-Authorization: sk_live_************************' \
--data '{
"customers" : [
{
"first_name": "Richard-Updated",
"last_name": "Mophy-Edited",
"phone_no": "+2348106420637",
"email" : "new-email@bunce.so",
"customer_id": "01JMKK8N0CJ0TTCX292P3JJCWT"
},
{
"first_name": "Ekpo Edited",
"last_name": "Mica Updated",
"phone_no": "+2348106420637",
"email": "fake-email@gmail",
"customer_id": "01JMKK8N0CJ0TTCX292P3JJCW890"
},
{
"customer_id": "01JMJ38J3DY08M2FQ6HTCX1BX4",
"first_name": "john Edited",
"last_name": "luke Edited",
"email": "john.3@gmail.com",
"phone_no": "+2348106420633"
}
]
}'
go
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
url := "https://api.bunce.so/v1/customers/bulk-update"
payload := strings.NewReader("{\n \"customers\": [\n {\n \"first_name\": \"Richard-Updated\",\n \"last_name\": \"Mophy-Edited\",\n \"phone_no\": \"+2348106420637\",\n \"email\": \"new-email@bunce.so\",\n \"customer_id\": \"01JMKK8N0CJ0TTCX292P3JJCWT\"\n },\n {\n \"first_name\": \"Ekpo Edited\",\n \"last_name\": \"Mica Updated\",\n \"phone_no\": \"+2348106420637\",\n \"email\": \"fake-email@gmail\",\n \"customer_id\": \"01JMKK8N0CJ0TTCX292P3JJCW890\"\n },\n {\n \"customer_id\": \"01JMJ38J3DY08M2FQ6HTCX1BX4\",\n \"first_name\": \"john Edited\",\n \"last_name\": \"luke Edited\",\n \"email\": \"john.3@gmail.com\",\n \"phone_no\": \"+2348106420633\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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/customers/bulk-update`
let = {
: 'PUT',
: {
'X-Authorization': 'sk_live_************************',
'Content-Type': 'application/json',
},
: '{"first_name":"John","last_name":"Doe","email":"johndoe@example.com","phone_no":"+23481999999999"}',
}
(, )
.then(() => .json())
.then(() => .())
.catch(() => .('error:' + ))
php
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->append('{
"customers" : [
{
"first_name": "Richard-Updated",
"last_name": "Mophy-Edited",
"phone_no": "+2348106420637",
"email" : "new-email@bunce.so",
"customer_id": "01JMKK8N0CJ0TTCX292P3JJCWT"
},
{
"first_name": "Ekpo Edited",
"last_name": "Mica Updated",
"phone_no": "+2348106420637",
"email": "fake-email@gmail",
"customer_id": "01JMKK8N0CJ0TTCX292P3JJCW890"
},
{
"customer_id": "01JMJ38J3DY08M2FQ6HTCX1BX4",
"first_name": "john Edited",
"last_name": "luke Edited",
"email": "john.3@gmail.com",
"phone_no": "+2348106420633"
}
]
}');
$request->setRequestUrl('https://api.bunce.so/v1/customers/bulk-update');
$request->setRequestMethod('PUT');
$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/customers/bulk-update"))
.header("X-Authorization", "sk_live_************************")
.header("Content-Type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"customers\": [\n {\n \"first_name\": \"Richard-Updated\",\n \"last_name\": \"Mophy-Edited\",\n \"phone_no\": \"+2348106420637\",\n \"email\": \"new-email@bunce.so\",\n \"customer_id\": \"01JMKK8N0CJ0TTCX292P3JJCWT\"\n },\n {\n \"first_name\": \"Ekpo Edited\",\n \"last_name\": \"Mica Updated\",\n \"phone_no\": \"+2348106420637\",\n \"email\": \"fake-email@gmail\",\n \"customer_id\": \"01JMKK8N0CJ0TTCX292P3JJCW890\"\n },\n {\n \"customer_id\": \"01JMJ38J3DY08M2FQ6HTCX1BX4\",\n \"first_name\": \"john Edited\",\n \"last_name\": \"luke Edited\",\n \"email\": \"john.3@gmail.com\",\n \"phone_no\": \"+2348106420633\"\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": "9e4d744e-af84-4efb-9634-09e9f53c80c6",
"attribute_id": "9e44002a-4ef9-48d9-b201-7ead97adcfa7",
"attribute_name": "Student Name",
"customer_email": "dami@example.com",
"attribute_data_type": "text",
"attribute_value": "Sunday Nnamani"
},
{
"id": "9e4d744e-af8a-4554-b31c-832b4f24b88c",
"attribute_id": "9e44007b-c09c-4f41-9341-a5fe170fa5c2",
"attribute_name": "Admission Date",
"customer_email": "dami@example.com",
"attribute_data_type": "date",
"attribute_value": "2009-09-03"
}
],
"message": "Customer attributes successfully updated"
}