Skip to main content
POST
/
api
/
buckets
Create a bucket
curl --request POST \
  --url http://localhost/api/api/buckets \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "active_indicator": true,
  "description": "<string>",
  "rule_id": 123,
  "rule_setting": {},
  "activate_rule": true
}
'
import requests

url = "http://localhost/api/api/buckets"

payload = {
"name": "<string>",
"active_indicator": True,
"description": "<string>",
"rule_id": 123,
"rule_setting": {},
"activate_rule": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
active_indicator: true,
description: '<string>',
rule_id: 123,
rule_setting: {},
activate_rule: true
})
};

fetch('http://localhost/api/api/buckets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "http://localhost/api/api/buckets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'active_indicator' => true,
'description' => '<string>',
'rule_id' => 123,
'rule_setting' => [

],
'activate_rule' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "http://localhost/api/api/buckets"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"active_indicator\": true,\n \"description\": \"<string>\",\n \"rule_id\": 123,\n \"rule_setting\": {},\n \"activate_rule\": true\n}")

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

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("http://localhost/api/api/buckets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"active_indicator\": true,\n \"description\": \"<string>\",\n \"rule_id\": 123,\n \"rule_setting\": {},\n \"activate_rule\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("http://localhost/api/api/buckets")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"active_indicator\": true,\n \"description\": \"<string>\",\n \"rule_id\": 123,\n \"rule_setting\": {},\n \"activate_rule\": true\n}"

response = http.request(request)
puts response.read_body
{
  "bucket_rules": [
    {}
  ],
  "rule_id": 123,
  "rule_setting": {},
  "activate_rule": true,
  "last_timestamp": "<string>",
  "modified_by": {
    "id": 123
  },
  "created_by": {
    "id": 123
  }
}

Authorizations

Authorization
string
header
required

JWT token obtained from AWS Cognito or custom authentication service

Body

A ModelSerializer that takes an additional fields argument that controls which fields should be displayed.

name
string
required
Required string length: 1 - 255
active_indicator
boolean
description
string
rule_id
integer
write-only
rule_setting
object
write-only
activate_rule
boolean
write-only

Response

201 - application/json

Bucket created successfully.

bucket_rules
object[]

List of bucket rules.

rule_id
integer

Rule ID.

rule_setting
object

Rule settings.

activate_rule
boolean

Activate rule.

last_timestamp
string

Last timestamp.

modified_by
object
created_by
object