Replace a value rule set
curl --request PUT \
--url https://api.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Winter launch",
"rules": [
{
"adjustSign": "INCREASE",
"adjustValue": 10,
"criteria": [
{
"criteriaType": "AGE",
"criteriaValueTypes": [
"example"
],
"criteriaValues": [
"example"
],
"operator": "CONTAINS"
}
],
"name": "Winter launch"
}
]
}
'import requests
url = "https://api.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId}"
payload = {
"name": "Winter launch",
"rules": [
{
"adjustSign": "INCREASE",
"adjustValue": 10,
"criteria": [
{
"criteriaType": "AGE",
"criteriaValueTypes": ["example"],
"criteriaValues": ["example"],
"operator": "CONTAINS"
}
],
"name": "Winter launch"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Winter launch',
rules: [
{
adjustSign: 'INCREASE',
adjustValue: 10,
criteria: [
{
criteriaType: 'AGE',
criteriaValueTypes: ['example'],
criteriaValues: ['example'],
operator: 'CONTAINS'
}
],
name: 'Winter launch'
}
]
})
};
fetch('https://api.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId}', 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.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Winter launch',
'rules' => [
[
'adjustSign' => 'INCREASE',
'adjustValue' => 10,
'criteria' => [
[
'criteriaType' => 'AGE',
'criteriaValueTypes' => [
'example'
],
'criteriaValues' => [
'example'
],
'operator' => 'CONTAINS'
]
],
'name' => 'Winter launch'
]
]
]),
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 := "https://api.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId}"
payload := strings.NewReader("{\n \"name\": \"Winter launch\",\n \"rules\": [\n {\n \"adjustSign\": \"INCREASE\",\n \"adjustValue\": 10,\n \"criteria\": [\n {\n \"criteriaType\": \"AGE\",\n \"criteriaValueTypes\": [\n \"example\"\n ],\n \"criteriaValues\": [\n \"example\"\n ],\n \"operator\": \"CONTAINS\"\n }\n ],\n \"name\": \"Winter launch\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Winter launch\",\n \"rules\": [\n {\n \"adjustSign\": \"INCREASE\",\n \"adjustValue\": 10,\n \"criteria\": [\n {\n \"criteriaType\": \"AGE\",\n \"criteriaValueTypes\": [\n \"example\"\n ],\n \"criteriaValues\": [\n \"example\"\n ],\n \"operator\": \"CONTAINS\"\n }\n ],\n \"name\": \"Winter launch\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Winter launch\",\n \"rules\": [\n {\n \"adjustSign\": \"INCREASE\",\n \"adjustValue\": 10,\n \"criteria\": [\n {\n \"criteriaType\": \"AGE\",\n \"criteriaValueTypes\": [\n \"example\"\n ],\n \"criteriaValues\": [\n \"example\"\n ],\n \"operator\": \"CONTAINS\"\n }\n ],\n \"name\": \"Winter launch\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"name": "<string>",
"rules": [
{
"adjustSign": "INCREASE",
"adjustValue": 500,
"criteria": [
{}
],
"name": "<string>",
"id": "<string>",
"status": "<string>"
}
],
"valueRuleSetId": "<string>"
}{
"error": {
"code": "<string>",
"details": {},
"message": "<string>",
"param": "<string>",
"retryHint": "<string>",
"retryable": true,
"type": "<string>"
}
}广告系列
Replace a value rule set
Ad Accounts. Changes the ad account without starting or raising spend; audited. Replaces a Meta value rule set with the rules you send, so any rule left out is deleted. THIS IS A FULL REPLACE, NOT A PATCH. Meta’s update is declarative: the body you send becomes the rule set. GET /apis/v1/ads/value-rule-sets/{valueRuleSetId} FIRST. Keep a rule or criterion by echoing its id. Create one by including the object WITHOUT an id. Delete one by OMITTING it from the array.
PUT
https://api.aisa.one
/
apis
/
v1
/
ads
/
value-rule-sets
/
{valueRuleSetId}
Replace a value rule set
curl --request PUT \
--url https://api.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Winter launch",
"rules": [
{
"adjustSign": "INCREASE",
"adjustValue": 10,
"criteria": [
{
"criteriaType": "AGE",
"criteriaValueTypes": [
"example"
],
"criteriaValues": [
"example"
],
"operator": "CONTAINS"
}
],
"name": "Winter launch"
}
]
}
'import requests
url = "https://api.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId}"
payload = {
"name": "Winter launch",
"rules": [
{
"adjustSign": "INCREASE",
"adjustValue": 10,
"criteria": [
{
"criteriaType": "AGE",
"criteriaValueTypes": ["example"],
"criteriaValues": ["example"],
"operator": "CONTAINS"
}
],
"name": "Winter launch"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Winter launch',
rules: [
{
adjustSign: 'INCREASE',
adjustValue: 10,
criteria: [
{
criteriaType: 'AGE',
criteriaValueTypes: ['example'],
criteriaValues: ['example'],
operator: 'CONTAINS'
}
],
name: 'Winter launch'
}
]
})
};
fetch('https://api.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId}', 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.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Winter launch',
'rules' => [
[
'adjustSign' => 'INCREASE',
'adjustValue' => 10,
'criteria' => [
[
'criteriaType' => 'AGE',
'criteriaValueTypes' => [
'example'
],
'criteriaValues' => [
'example'
],
'operator' => 'CONTAINS'
]
],
'name' => 'Winter launch'
]
]
]),
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 := "https://api.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId}"
payload := strings.NewReader("{\n \"name\": \"Winter launch\",\n \"rules\": [\n {\n \"adjustSign\": \"INCREASE\",\n \"adjustValue\": 10,\n \"criteria\": [\n {\n \"criteriaType\": \"AGE\",\n \"criteriaValueTypes\": [\n \"example\"\n ],\n \"criteriaValues\": [\n \"example\"\n ],\n \"operator\": \"CONTAINS\"\n }\n ],\n \"name\": \"Winter launch\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Winter launch\",\n \"rules\": [\n {\n \"adjustSign\": \"INCREASE\",\n \"adjustValue\": 10,\n \"criteria\": [\n {\n \"criteriaType\": \"AGE\",\n \"criteriaValueTypes\": [\n \"example\"\n ],\n \"criteriaValues\": [\n \"example\"\n ],\n \"operator\": \"CONTAINS\"\n }\n ],\n \"name\": \"Winter launch\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Winter launch\",\n \"rules\": [\n {\n \"adjustSign\": \"INCREASE\",\n \"adjustValue\": 10,\n \"criteria\": [\n {\n \"criteriaType\": \"AGE\",\n \"criteriaValueTypes\": [\n \"example\"\n ],\n \"criteriaValues\": [\n \"example\"\n ],\n \"operator\": \"CONTAINS\"\n }\n ],\n \"name\": \"Winter launch\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"name": "<string>",
"rules": [
{
"adjustSign": "INCREASE",
"adjustValue": 500,
"criteria": [
{}
],
"name": "<string>",
"id": "<string>",
"status": "<string>"
}
],
"valueRuleSetId": "<string>"
}{
"error": {
"code": "<string>",
"details": {},
"message": "<string>",
"param": "<string>",
"retryHint": "<string>",
"retryable": true,
"type": "<string>"
}
}请求规范
- 方法与路径: PUT /apis/v1/ads/value-rule-sets/{valueRuleSetId}
- 可用状态: enabled
- 请求 URL 模板:
https://api.aisa.one/apis/v1/ads/value-rule-sets/{valueRuleSetId} - valueRuleSetId: path; 必填
- connectionId: query; 必填
{
"operationId": "put_aisa_ads_apis_v1_ads_value_rule_sets_valuerulesetid",
"method": "PUT",
"path": "/apis/v1/ads/value-rule-sets/{valueRuleSetId}",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [
{
"description": "Platform value rule set id.",
"in": "path",
"name": "valueRuleSetId",
"required": true,
"schema": {
"type": "string"
}
},
{
"description": "The ads connection (adc_...) the request runs on: one of yours, from GET /apis/v1/ads/connections. On a request with a JSON body it may be sent as a top-level body member instead.",
"in": "query",
"name": "connectionId",
"required": true,
"schema": {
"pattern": "^adc_[0-9A-Za-z]+$",
"type": "string"
}
}
],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"example": {
"connectionId": "adc_7f3k2m9q",
"name": "Winter launch",
"rules": [
{
"adjustSign": "INCREASE",
"adjustValue": 10,
"criteria": [
{
"criteriaType": "AGE",
"criteriaValueTypes": [
"example"
],
"criteriaValues": [
"example"
],
"operator": "CONTAINS"
}
],
"name": "Winter launch"
}
]
},
"schema": {
"additionalProperties": true,
"properties": {
"connectionId": {
"description": "The ads connection (adc_...), when not sent as the connectionId query parameter.",
"pattern": "^adc_[0-9A-Za-z]+$",
"type": "string"
},
"name": {
"description": "Required: the update replaces the whole set.",
"maxLength": 255,
"minLength": 1,
"type": "string"
},
"rules": {
"description": "The COMPLETE rule list. Omitting a rule deletes it on Meta.",
"items": {
"additionalProperties": false,
"description": "One bid-adjustment rule. Rules are evaluated in ARRAY ORDER and only the first matching rule adjusts the bid for an overlapping audience, so the order is semantic.",
"properties": {
"adjustSign": {
"description": "Direction of the adjustment. There is no signed value field.",
"enum": [
"INCREASE",
"DECREASE"
],
"type": "string"
},
"adjustValue": {
"description": "Unsigned percentage magnitude. `INCREASE` accepts 1-1000, `DECREASE` accepts 1-90. 0 is out of range on both.",
"maximum": 1000,
"minimum": 1,
"type": "integer"
},
"criteria": {
"description": "All criteria on a rule must match for the rule to fire.",
"items": {
"additionalProperties": false,
"description": "One matching condition inside a value rule. `criteriaValues` and `criteriaValueTypes` are POSITIONALLY paired: same length, same order.",
"properties": {
"criteriaType": {
"description": "The dimension being matched. `OMNI_CHANNEL` (conversion location: APP, INSTANT_FORM, PHONE_CALL, WEBSITE) is accepted even though Meta's own enum table omits it.",
"enum": [
"AGE",
"GENDER",
"OS_TYPE",
"DEVICE_PLATFORM",
"LOCATION",
"PLACEMENT",
"OMNI_CHANNEL",
"AUDIENCE_LABEL"
],
"type": "string"
},
"criteriaValueTypes": {
"description": "One entry per `criteriaValues` entry, in the same order.",
"items": {
"type": "string"
},
"minItems": 1,
"type": "array"
},
"criteriaValues": {
"description": "The values to match. `AGE`: ranges such as `18-24`, `18+` or a custom `18-26`. A range whose upper bound is 65 is NOT allowed (use `18+` instead of `18-65`). `LOCATION`: Targeting-Search keys.",
"items": {
"type": "string"
},
"minItems": 1,
"type": "array"
},
"id": {
"description": "Platform criterion id. Echo it on `PUT` to KEEP this criterion, omit it to CREATE a new one. A criterion left out of the array entirely is DELETED.",
"type": "string"
},
"operator": {
"description": "Required on every criterion. `CONTAINS` is currently the only value Meta supports.",
"enum": [
"CONTAINS"
],
"type": "string"
}
},
"required": [
"criteriaType",
"criteriaValueTypes",
"criteriaValues",
"operator"
],
"type": "object"
},
"maxItems": 4,
"minItems": 1,
"type": "array"
},
"id": {
"description": "Platform rule id. Echo it on `PUT` to KEEP this rule, omit it to CREATE a new one. A rule left out of the array entirely is DELETED.",
"type": "string"
},
"name": {
"maxLength": 255,
"minLength": 1,
"type": "string"
},
"status": {
"description": "Meta returns `ACTIVE` here but documents no enum for the field. Treat it as a passthrough: echo whatever the `GET` returned, and do not synthesize values.",
"type": "string"
}
},
"required": [
"adjustSign",
"adjustValue",
"criteria",
"name"
],
"type": "object"
},
"maxItems": 10,
"minItems": 1,
"type": "array"
}
},
"required": [
"name",
"rules"
],
"type": "object"
}
}
},
"required": true
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
费用与请求规则
此操作不另收费。 广告投放费用由广告平台向已连接的广告账户另行收取。授权
查询参数
请求体
application/json