curl --request POST \
--url https://api.merchantops.ai/api/products/{product_key}/variants/bulk/find-replace/preview \
--header 'Content-Type: application/json' \
--data '
{
"find": "<string>",
"property_key": "<string>",
"variant_keys": [
"<string>"
],
"case_sensitive": false,
"expected_will_change": 1,
"replace": ""
}
'import requests
url = "https://api.merchantops.ai/api/products/{product_key}/variants/bulk/find-replace/preview"
payload = {
"find": "<string>",
"property_key": "<string>",
"variant_keys": ["<string>"],
"case_sensitive": False,
"expected_will_change": 1,
"replace": ""
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
find: '<string>',
property_key: '<string>',
variant_keys: ['<string>'],
case_sensitive: false,
expected_will_change: 1,
replace: ''
})
};
fetch('https://api.merchantops.ai/api/products/{product_key}/variants/bulk/find-replace/preview', 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 => "https://api.merchantops.ai/api/products/{product_key}/variants/bulk/find-replace/preview",
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([
'find' => '<string>',
'property_key' => '<string>',
'variant_keys' => [
'<string>'
],
'case_sensitive' => false,
'expected_will_change' => 1,
'replace' => ''
]),
CURLOPT_HTTPHEADER => [
"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 := "https://api.merchantops.ai/api/products/{product_key}/variants/bulk/find-replace/preview"
payload := strings.NewReader("{\n \"find\": \"<string>\",\n \"property_key\": \"<string>\",\n \"variant_keys\": [\n \"<string>\"\n ],\n \"case_sensitive\": false,\n \"expected_will_change\": 1,\n \"replace\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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("https://api.merchantops.ai/api/products/{product_key}/variants/bulk/find-replace/preview")
.header("Content-Type", "application/json")
.body("{\n \"find\": \"<string>\",\n \"property_key\": \"<string>\",\n \"variant_keys\": [\n \"<string>\"\n ],\n \"case_sensitive\": false,\n \"expected_will_change\": 1,\n \"replace\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.merchantops.ai/api/products/{product_key}/variants/bulk/find-replace/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"find\": \"<string>\",\n \"property_key\": \"<string>\",\n \"variant_keys\": [\n \"<string>\"\n ],\n \"case_sensitive\": false,\n \"expected_will_change\": 1,\n \"replace\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"selected": 123,
"unchanged": 123,
"will_change": 123,
"samples": [
{
"after": "<string>",
"before": "<string>",
"variant_key": "<string>"
}
],
"skipped": [
{
"reason": "missing_value",
"variant_key": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}Preview Variant Find Replace
Dry run of a literal find-and-replace inside one text property.
Returns how many of the selected variants would change (the number the dialog asks the user to type), sample before/after pairs and the variants that are skipped and why. Computed by the SAME function the apply route uses, on the same inputs — nothing is written.
Authentication Required: variant:write — a dry run of a write,
reachable only from a dialog already gated on it.
curl --request POST \
--url https://api.merchantops.ai/api/products/{product_key}/variants/bulk/find-replace/preview \
--header 'Content-Type: application/json' \
--data '
{
"find": "<string>",
"property_key": "<string>",
"variant_keys": [
"<string>"
],
"case_sensitive": false,
"expected_will_change": 1,
"replace": ""
}
'import requests
url = "https://api.merchantops.ai/api/products/{product_key}/variants/bulk/find-replace/preview"
payload = {
"find": "<string>",
"property_key": "<string>",
"variant_keys": ["<string>"],
"case_sensitive": False,
"expected_will_change": 1,
"replace": ""
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
find: '<string>',
property_key: '<string>',
variant_keys: ['<string>'],
case_sensitive: false,
expected_will_change: 1,
replace: ''
})
};
fetch('https://api.merchantops.ai/api/products/{product_key}/variants/bulk/find-replace/preview', 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 => "https://api.merchantops.ai/api/products/{product_key}/variants/bulk/find-replace/preview",
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([
'find' => '<string>',
'property_key' => '<string>',
'variant_keys' => [
'<string>'
],
'case_sensitive' => false,
'expected_will_change' => 1,
'replace' => ''
]),
CURLOPT_HTTPHEADER => [
"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 := "https://api.merchantops.ai/api/products/{product_key}/variants/bulk/find-replace/preview"
payload := strings.NewReader("{\n \"find\": \"<string>\",\n \"property_key\": \"<string>\",\n \"variant_keys\": [\n \"<string>\"\n ],\n \"case_sensitive\": false,\n \"expected_will_change\": 1,\n \"replace\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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("https://api.merchantops.ai/api/products/{product_key}/variants/bulk/find-replace/preview")
.header("Content-Type", "application/json")
.body("{\n \"find\": \"<string>\",\n \"property_key\": \"<string>\",\n \"variant_keys\": [\n \"<string>\"\n ],\n \"case_sensitive\": false,\n \"expected_will_change\": 1,\n \"replace\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.merchantops.ai/api/products/{product_key}/variants/bulk/find-replace/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"find\": \"<string>\",\n \"property_key\": \"<string>\",\n \"variant_keys\": [\n \"<string>\"\n ],\n \"case_sensitive\": false,\n \"expected_will_change\": 1,\n \"replace\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"selected": 123,
"unchanged": 123,
"will_change": 123,
"samples": [
{
"after": "<string>",
"before": "<string>",
"variant_key": "<string>"
}
],
"skipped": [
{
"reason": "missing_value",
"variant_key": "<string>"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}Path Parameters
Cookies
Body
Body for BOTH the preview (dry run) and the apply route.
Literal text to find (never a regex).
1Variant-level property to edit.
11 - 5000 elementsDefault: case-insensitive matching.
Apply only: the will_change count the user confirmed from the preview. When set and it differs from the count recomputed at apply time, the write is refused with error 'will_change_mismatch' and the recomputed count. Ignored by preview.
x >= 0Literal replacement; may be empty (deletes the match).
Response
Successful Response
Distinct variant keys in the request.
Variants whose value contains no occurrence.
Variants whose value would change (the confirm count).
At most 10.
Show child attributes
Show child attributes
Show child attributes
Show child attributes