Skip to content

Edit customer

Put
bash
https://api.bunce.so/v1/customers/{customer_id}

Update an existing customer records.

Request

Route Parameters email

Body Parameters required

email string<email> not requiredCustomer's email address
first_name string not requiredCustomer's first name
last_name string not requiredCustomer's last name
phone_no string not requiredCustomer's phone number
bash
curl --request PUT \
  --url https://api.bunce.so/v1/customers/0000 \
  --header 'Content-Type: application/json' \
  --header 'X-Authorization: sk_live_************************' \
  --data '{
  "first_name": "John",
  "last_name": "Doe",
  "email": "johndoe@example.com",
  "phone_no": "+23481999999999"
}'
go
import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

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

payload := strings.NewReader("{\n  \"first_name\": \"John\",\n  \"last_name\": \"Doe\",\n  \"email\": \"johndoe@example.com\",\n  \"phone_no\": \"+23481999999999\"\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/${req.params.customer_id}`

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('{
  "first_name": "John",
  "last_name": "Doe",
  "email": "johndoe@example.com",
  "phone_no": "+23481999999999"
}');

$request->setRequestUrl('https://api.bunce.so/v1/customers/0000');
$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/0000"))
    .header("X-Authorization", "sk_live_************************")
    .header("Content-Type", "application/json")
    .method("PUT", HttpRequest.BodyPublishers.ofString("{\n  \"first_name\": \"John\",\n  \"last_name\": \"Doe\",\n  \"email\": \"johndoe@example.com\",\n  \"phone_no\": \"+23481999999999\"\n}"))
    .build();

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

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

Response

json
{
  "message": "Customer updated successfully",
  "success": true
}