Skip to main content
PATCH
/
api
/
whitelist
/
{id}
Update a Whitelist record
curl --request PATCH \
  --url http://localhost/api/api/whitelist/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "rules": [
    123
  ],
  "bucket": "<string>",
  "subject": "<string>"
}
'
import requests

url = "http://localhost/api/api/whitelist/{id}"

payload = {
"rules": [123],
"bucket": "<string>",
"subject": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({rules: [123], bucket: '<string>', subject: '<string>'})
};

fetch('http://localhost/api/api/whitelist/{id}', 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/whitelist/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'rules' => [
123
],
'bucket' => '<string>',
'subject' => '<string>'
]),
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/whitelist/{id}"

payload := strings.NewReader("{\n \"rules\": [\n 123\n ],\n \"bucket\": \"<string>\",\n \"subject\": \"<string>\"\n}")

req, _ := http.NewRequest("PATCH", 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.patch("http://localhost/api/api/whitelist/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rules\": [\n 123\n ],\n \"bucket\": \"<string>\",\n \"subject\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("http://localhost/api/api/whitelist/{id}")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rules\": [\n 123\n ],\n \"bucket\": \"<string>\",\n \"subject\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": 123,
  "rules": [
    123
  ],
  "bucket": "<string>",
  "subject": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "created_by": 123,
  "modified_by": 123
}
{
"detail": "<string>",
"code": "<string>",
"field_errors": {}
}
{
"detail": "<string>",
"code": "<string>",
"field_errors": {}
}

Authorizations

Authorization
string
header
required

JWT token obtained from AWS Cognito or custom authentication service

Path Parameters

id
integer
required

A unique integer value identifying this whitelist.

Body

application/json

Whitelist modification request payload

rules
integer[]

List of rule IDs

bucket
string

Bucket identifier

subject
string

Subject identifier

Response

Whitelist record updated successfully

Whitelist object with all details

id
integer
required

Whitelist record ID

rules
integer[]

List of rule IDs

bucket
string

Bucket identifier

subject
string

Subject identifier

created_at
string<date-time>

Creation timestamp

updated_at
string<date-time>

Last update timestamp

created_by
integer

ID of user who created the record

modified_by
integer

ID of user who last modified the record