Skip to content

Attributes

The attributes API allows you create and manage attributes on your integration.

Create an attribute

Post
bash
https://api.bunce.so/v1/attributes

Creates an attribute.

If successful, your response includes a copy of the new attribute entity. 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

name string requiredAttribute name
data_type string<text,timestamp,numeric> requiredAttribute Data Type
bash
curl --request POST \
  --url https://api.bunce.so/v1/attributes \
  --header 'Content-Type: application/json' \
  --header 'X-Authorization: sk_live_************************' \
  --data '{
  "name": "Date of Birth",
  "data_type": "date",
}'
go
import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

url := "https://api.bunce.so/v1/attributes"

payload := strings.NewReader("{\n  \"name\": \"Date of Birth\",\n  \"data_type\": \"date\",\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'

let  = {
  : 'POST',
  : {
    'X-Authorization': 'sk_live_************************',
    'Content-Type': 'application/json',
  },
  : '{"name":"Date of Birth","data_type":"date"}',
}

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

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

$body = new http\Message\Body;
$body->append('{
  "name": "Date of Birth",
  "data_type": "date",
}');

$request->setRequestUrl('https://api.bunce.so/v1/attributes');
$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"))
    .header("X-Authorization", "sk_live_************************")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\n  \"name\": \"Date of Birth\",\n  \"data_type\": \"date\",\n}"))
    .build();

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

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

Response

json
{
  "data": {
    "id": "018c76f4-01b8-7c6b-a54b-6b681fc78295",
    "data_type": "date",
    "name": "Date of Birth"
  },
  "message": "Attribute created successfully",
  "success": true
}