Skip to content

Create customer device

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

Creates customer devices.

If successful, your response includes a copy of the new device(s) entity in an array.

Request

Path Parameter string<uuid> required

id string<uuid> required
Identifier of the customer entity to work with.

bash
curl --request POST \
  --url https://api.bunce.so/v1/customers/0000/devices \
  --header 'X-Authorization: sk_live_************************'
go
import (
	"fmt"
	"net/http"
	"io/ioutil"
)

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

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("X-Authorization", "sk_live_************************")

	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  = {
  : 'POST',
  : {
    'X-Authorization': 'sk_live_************************',
  },
}

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

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

$request->setRequestUrl('https://api.bunce.so/v1/customers/0000/devices');
$request->setRequestMethod('POST');
$request->setHeaders([
  'X-Authorization' => 'sk_live_************************'
]);

$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_************************")
    .method("POST", HttpRequest.BodyPublishers.noBody())
    .build();

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

Response

json
{
    "devices" : [
        {
            "device_id": "1710dd8fe631-018c7737-0ab2-78f7",
            "device_type": "android",
            "device_token": "874jwejfoiowef5974594"
        },
        {
            "device_id": "018c7737-0ab2-78f7-ba75-1710dd8fe631",
            "device_type": "ios",
            "device_token": "112bbwe348u9839845945675464"
        }
    ]
    
}