Create a rule
curl --request POST \
--url https://{site}/wp-json/joinery/v1/rules \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Bulk hardware",
"active": true,
"priority": 10,
"exclusive": false,
"conditions": [
{
"type": "product_category",
"settings": {
"categories": [
17
]
}
}
],
"actions": [
{
"type": "dp_tiered_price",
"settings": {
"tiers": [
{
"min": 10,
"percent": 10
},
{
"min": 50,
"percent": 20
}
]
}
}
]
}
'import requests
url = "https://{site}/wp-json/joinery/v1/rules"
payload = {
"name": "Bulk hardware",
"active": True,
"priority": 10,
"exclusive": False,
"conditions": [
{
"type": "product_category",
"settings": { "categories": [17] }
}
],
"actions": [
{
"type": "dp_tiered_price",
"settings": { "tiers": [
{
"min": 10,
"percent": 10
},
{
"min": 50,
"percent": 20
}
] }
}
]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Bulk hardware',
active: true,
priority: 10,
exclusive: false,
conditions: [{type: 'product_category', settings: {categories: [17]}}],
actions: [
{
type: 'dp_tiered_price',
settings: {tiers: [{min: 10, percent: 10}, {min: 50, percent: 20}]}
}
]
})
};
fetch('https://{site}/wp-json/joinery/v1/rules', 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://{site}/wp-json/joinery/v1/rules",
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' => 'Bulk hardware',
'active' => true,
'priority' => 10,
'exclusive' => false,
'conditions' => [
[
'type' => 'product_category',
'settings' => [
'categories' => [
17
]
]
]
],
'actions' => [
[
'type' => 'dp_tiered_price',
'settings' => [
'tiers' => [
[
'min' => 10,
'percent' => 10
],
[
'min' => 50,
'percent' => 20
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://{site}/wp-json/joinery/v1/rules"
payload := strings.NewReader("{\n \"name\": \"Bulk hardware\",\n \"active\": true,\n \"priority\": 10,\n \"exclusive\": false,\n \"conditions\": [\n {\n \"type\": \"product_category\",\n \"settings\": {\n \"categories\": [\n 17\n ]\n }\n }\n ],\n \"actions\": [\n {\n \"type\": \"dp_tiered_price\",\n \"settings\": {\n \"tiers\": [\n {\n \"min\": 10,\n \"percent\": 10\n },\n {\n \"min\": 50,\n \"percent\": 20\n }\n ]\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://{site}/wp-json/joinery/v1/rules")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Bulk hardware\",\n \"active\": true,\n \"priority\": 10,\n \"exclusive\": false,\n \"conditions\": [\n {\n \"type\": \"product_category\",\n \"settings\": {\n \"categories\": [\n 17\n ]\n }\n }\n ],\n \"actions\": [\n {\n \"type\": \"dp_tiered_price\",\n \"settings\": {\n \"tiers\": [\n {\n \"min\": 10,\n \"percent\": 10\n },\n {\n \"min\": 50,\n \"percent\": 20\n }\n ]\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{site}/wp-json/joinery/v1/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Bulk hardware\",\n \"active\": true,\n \"priority\": 10,\n \"exclusive\": false,\n \"conditions\": [\n {\n \"type\": \"product_category\",\n \"settings\": {\n \"categories\": [\n 17\n ]\n }\n }\n ],\n \"actions\": [\n {\n \"type\": \"dp_tiered_price\",\n \"settings\": {\n \"tiers\": [\n {\n \"min\": 10,\n \"percent\": 10\n },\n {\n \"min\": 50,\n \"percent\": 20\n }\n ]\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"name": "Bulk hardware",
"active": true,
"priority": 10,
"exclusive": false,
"conditions": [
{
"type": "product_category",
"settings": {
"categories": [
17
]
}
}
],
"actions": [
{
"type": "dp_tiered_price",
"settings": {
"tiers": [
{
"min": 10,
"percent": 10
},
{
"min": 50,
"percent": 20
}
]
}
}
]
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}Rules
Create a rule
POST
/
rules
Create a rule
curl --request POST \
--url https://{site}/wp-json/joinery/v1/rules \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Bulk hardware",
"active": true,
"priority": 10,
"exclusive": false,
"conditions": [
{
"type": "product_category",
"settings": {
"categories": [
17
]
}
}
],
"actions": [
{
"type": "dp_tiered_price",
"settings": {
"tiers": [
{
"min": 10,
"percent": 10
},
{
"min": 50,
"percent": 20
}
]
}
}
]
}
'import requests
url = "https://{site}/wp-json/joinery/v1/rules"
payload = {
"name": "Bulk hardware",
"active": True,
"priority": 10,
"exclusive": False,
"conditions": [
{
"type": "product_category",
"settings": { "categories": [17] }
}
],
"actions": [
{
"type": "dp_tiered_price",
"settings": { "tiers": [
{
"min": 10,
"percent": 10
},
{
"min": 50,
"percent": 20
}
] }
}
]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Bulk hardware',
active: true,
priority: 10,
exclusive: false,
conditions: [{type: 'product_category', settings: {categories: [17]}}],
actions: [
{
type: 'dp_tiered_price',
settings: {tiers: [{min: 10, percent: 10}, {min: 50, percent: 20}]}
}
]
})
};
fetch('https://{site}/wp-json/joinery/v1/rules', 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://{site}/wp-json/joinery/v1/rules",
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' => 'Bulk hardware',
'active' => true,
'priority' => 10,
'exclusive' => false,
'conditions' => [
[
'type' => 'product_category',
'settings' => [
'categories' => [
17
]
]
]
],
'actions' => [
[
'type' => 'dp_tiered_price',
'settings' => [
'tiers' => [
[
'min' => 10,
'percent' => 10
],
[
'min' => 50,
'percent' => 20
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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://{site}/wp-json/joinery/v1/rules"
payload := strings.NewReader("{\n \"name\": \"Bulk hardware\",\n \"active\": true,\n \"priority\": 10,\n \"exclusive\": false,\n \"conditions\": [\n {\n \"type\": \"product_category\",\n \"settings\": {\n \"categories\": [\n 17\n ]\n }\n }\n ],\n \"actions\": [\n {\n \"type\": \"dp_tiered_price\",\n \"settings\": {\n \"tiers\": [\n {\n \"min\": 10,\n \"percent\": 10\n },\n {\n \"min\": 50,\n \"percent\": 20\n }\n ]\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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://{site}/wp-json/joinery/v1/rules")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Bulk hardware\",\n \"active\": true,\n \"priority\": 10,\n \"exclusive\": false,\n \"conditions\": [\n {\n \"type\": \"product_category\",\n \"settings\": {\n \"categories\": [\n 17\n ]\n }\n }\n ],\n \"actions\": [\n {\n \"type\": \"dp_tiered_price\",\n \"settings\": {\n \"tiers\": [\n {\n \"min\": 10,\n \"percent\": 10\n },\n {\n \"min\": 50,\n \"percent\": 20\n }\n ]\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{site}/wp-json/joinery/v1/rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Bulk hardware\",\n \"active\": true,\n \"priority\": 10,\n \"exclusive\": false,\n \"conditions\": [\n {\n \"type\": \"product_category\",\n \"settings\": {\n \"categories\": [\n 17\n ]\n }\n }\n ],\n \"actions\": [\n {\n \"type\": \"dp_tiered_price\",\n \"settings\": {\n \"tiers\": [\n {\n \"min\": 10,\n \"percent\": 10\n },\n {\n \"min\": 50,\n \"percent\": 20\n }\n ]\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"name": "Bulk hardware",
"active": true,
"priority": 10,
"exclusive": false,
"conditions": [
{
"type": "product_category",
"settings": {
"categories": [
17
]
}
}
],
"actions": [
{
"type": "dp_tiered_price",
"settings": {
"tiers": [
{
"min": 10,
"percent": 10
},
{
"min": 50,
"percent": 20
}
]
}
}
]
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}Authorizations
applicationPasswordcookieNonce
A WordPress application password (Users → Profile → Application passwords).
Body
application/json
Maximum string length:
190Example:
"Bulk hardware"
Lower runs first.
Don't combine with other rules.
Maximum array length:
20Show child attributes
Show child attributes
Maximum array length:
20Show child attributes
Show child attributes
Example:
[ { "type": "dp_tiered_price", "settings": { "tiers": [ { "min": 10, "percent": 10 }, { "min": 50, "percent": 20 } ] } } ]
Response
The new rule.
Example:
1
Maximum string length:
190Example:
"Bulk hardware"
Lower runs first.
Don't combine with other rules.
Maximum array length:
20Show child attributes
Show child attributes
Maximum array length:
20Show child attributes
Show child attributes
Example:
[ { "type": "dp_tiered_price", "settings": { "tiers": [ { "min": 10, "percent": 10 }, { "min": 50, "percent": 20 } ] } } ]