Skip to content

Update customer device

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

Update customer device.

If successful, your response includes a boolean response. 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

Route Parameters attribute_id (string<uuid>)

Body Parameters required

current_device_token string requiredCurrent Device Token of device you want to update
device_type string<ios,android> nullableNew value for Device Type
device_token string nullableNew value for Device Token
bash
curl --request PATCH \
  --url https://api.bunce.so/v1/customers/0000/devices \
  --header 'Content-Type: application/json' \
  --header 'X-Authorization: sk_live_************************' \
  --data '{
      "device_type": "ios",
      "device_token": "39494938"
}'
go
import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

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

payload := strings.NewReader("{\n  \"current_device_token\": \"anwkjnci39\", \n  \"device_type\": \"android\",\n  \"device_token\": \"949494949\",\n}")

req, _ := http.NewRequest("PATCH", 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/0000/devices'

let  = {
  : 'PATCH',
  : {
    'X-Authorization': 'sk_live_************************',
    'Content-Type': 'application/json',
  },
  : '{ "current_device_token":"shviw943ibv934", "device_type":"ios", "device_token":"58949kdkd"}',
}

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

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

$body = new http\Message\Body;
$body->append('{
  "current_device_token": "387y4r87wy87f234",
  "device_token": "149djjdd",
  "device_type": "android"
}');

$request->setRequestUrl('https://api.bunce.so/v1/customers/0000/devices');
$request->setRequestMethod('PATCH');
$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/devices"))
    .header("X-Authorization", "sk_live_************************")
    .header("Content-Type", "application/json")
    .method("PATCH", HttpRequest.BodyPublishers.ofString("{\n  \"current_device_token\": \"ciw80uc30iw894\",\n  \"device_type\": \"ios\",\n  \"device_token\": \"13949eiddkdkd\",\n }"))
    .build();

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

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

Response

json
{
  "data": [],
  "message": "Customer device token updated successfully",
  "success": true
}