Update a Value List
PATCH https://api.fraudio.com/v1/value-lists/:value_list_id
Endpoint Overview
The "Update Value List" endpoint allows you to modify and adjust a specific value list using its unique identifier. This capability ensures that as your organization's requirements change, the reusable values referenced by your rules can evolve to match.
If you face any challenges when updating a value list or need clarity on certain aspects of this endpoint, don't hesitate to contact our Support Team. We're eager to help.
Request Parameters
Path Parameters
The endpoint requires the following path parameter:
value_list_id: The unique identifier (UUID) of the value list you wish to update.
Example Request With Path Parameter
PATCH https://api.fraudio.com/v1/value-lists/123e4567-e89b-12d3-a456-426614174000
Request Body
The body of the request should contain the fields of the value list you wish to update. You can replace all entries with entries, or apply incremental changes with entriesToAdd and entriesToRemove. Do not combine entries with entriesToAdd or entriesToRemove.
You cannot change slug or matchType while non-archived rules still reference the value list.
Example:
{
"displayName": "Blocked countries updated",
"entriesToAdd": ["cn"],
"entriesToRemove": ["kp"]
}
Request parameters: Field Reference Table
| Field | Data Type | Description |
|---|---|---|
| displayName | String | Updated human-readable name. Optional; send only fields you want to change. |
| slug | String | Updated slug. Optional. Cannot change while non-archived rules still reference the list. |
| entries | Array of String | Full replacement of all entries. Optional. Do not combine with entriesToAdd or entriesToRemove. |
| entriesToAdd | Array of String | Values to add. Optional. Do not combine with entries. |
| entriesToRemove | Array of String | Values to remove. Optional. Do not combine with entries. |
| matchType | String | Updated match type. Optional. Cannot change while non-archived rules still reference the list. |
| status | String | Updated status. Optional. Can be enabled or archived. Prefer DELETE to archive. |
Response Parameters
| Status Code | Status Message | Description | Schema |
|---|---|---|---|
200 | OK | Standard response for successful HTTP requests when updating a value list. | 200 OK - Value List updated response |
400 | Bad Request | Response when the request body is malformed or contains invalid data. | Problem response |
404 | Not Found | Response when the specified value list ID does not exist. | Problem response |
4xx, 500, 501, 502, 503, 504 | error | Various error messages for unsuccessful HTTP requests. | Problem response |
Code Samples
- Shell
- Python
- Java
- Perl
- PHP
curl -X PATCH 'https://api.fraudio.com/v1/value-lists/YOUR_VALUE_LIST_ID_HERE' \
-H 'Content-Type: application/json' \
-H "authorization: Bearer $ACCESS_TOKEN" \
-d '{
"displayName": "Blocked countries updated",
"entriesToAdd": ["cn"],
"entriesToRemove": ["kp"]
}'
import os
import requests
value_list_id = "YOUR_VALUE_LIST_ID_HERE"
value_lists_endpoint = f"https://api.fraudio.com/v1/value-lists/{value_list_id}"
access_token = os.environ["ACCESS_TOKEN"]
headers = {
"authorization": f"Bearer {access_token}",
"Content-Type": "application/json",
}
data = {
"displayName": "Blocked countries updated",
"entriesToAdd": ["cn"],
"entriesToRemove": ["kp"]
}
r = requests.patch(value_lists_endpoint, headers=headers, json=data)
print(r.json())
package com.fraudio;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class UpdateValueList {
public static void main(String[] args) throws IOException, URISyntaxException, InterruptedException {
String valueListId = "YOUR_VALUE_LIST_ID_HERE";
String valueListEndpoint = "https://api.fraudio.com/v1/value-lists/" + valueListId;
String accessToken = System.getenv("ACCESS_TOKEN");
String requestBody = "{\"displayName\":\"Blocked countries updated\",\"entriesToAdd\":[\"cn\"],\"entriesToRemove\":[\"kp\"]}";
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI(valueListEndpoint))
.header("authorization", String.format("Bearer %s", accessToken))
.header("Content-Type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString(requestBody))
.build();
HttpClient client = HttpClient.newHttpClient();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
String responseBody = response.body();
System.out.println("Response Code: " + response.statusCode() + "\nResponse Body: " + responseBody);
}
}
use LWP::UserAgent;
use HTTP::Request::Common;
my $value_list_id = "YOUR_VALUE_LIST_ID_HERE"; # Replace with your specific value list ID
my $value_list_endpoint = 'https://api.fraudio.com/v1/value-lists/' . $value_list_id;
my $access_token = $ENV{"ACCESS_TOKEN"};
my $request_body = '{
"displayName": "Blocked countries updated",
"entriesToAdd": ["cn"],
"entriesToRemove": ["kp"]
}';
my $req = HTTP::Request->new(PATCH => $value_list_endpoint);
$req->header('authorization' => "Bearer $access_token", "Content-Type" => "application/json");
$req->content($request_body);
my $ua = LWP::UserAgent->new;
my $resp = $ua->request($req);
my $message = $resp->decoded_content;
print "Received reply: $message";
<?php
$value_list_id = "YOUR_VALUE_LIST_ID_HERE"; // Replace with your specific value list ID
$value_list_endpoint = "https://api.fraudio.com/v1/value-lists/" . $value_list_id;
$access_token = $_SERVER["ACCESS_TOKEN"];
$request_body = json_encode([
"displayName" => "Blocked countries updated",
"entriesToAdd" => ["cn"],
"entriesToRemove" => ["kp"]
]);
$options = [
"http" => [
"header" =>
"authorization: Bearer $access_token\r\n" .
"Content-Type: application/json\r\n",
"method" => "PATCH",
"content" => $request_body
],
];
$context = stream_context_create($options);
$result = file_get_contents($value_list_endpoint, false, $context);
print $result;
?>