doc-exports/docs/waf/api-ref/waf_02_0049.html
Li, Qiao 914011d51b waf_api_1109
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Li, Qiao <qiaoli@huawei.com>
Co-committed-by: Li, Qiao <qiaoli@huawei.com>
2022-11-16 15:31:27 +00:00

419 lines
37 KiB
HTML

<a name="waf_02_0049"></a><a name="waf_02_0049"></a>
<h1 class="topictitle1">Adding a Precise Protection Rule</h1>
<div id="body12814336"><div class="section" id="waf_02_0049__section17318397"><h4 class="sectiontitle">Function Description</h4><p class="msonormal" id="waf_02_0049__p31328306">This API is used to add a precise protection rule.</p>
</div>
<div class="section" id="waf_02_0049__section21647845"><h4 class="sectiontitle">URI</h4><ul id="waf_02_0049__ul54564881"><li id="waf_02_0049__li21321884">URI format<p id="waf_02_0049__p57679236"><a name="waf_02_0049__li21321884"></a><a name="li21321884"></a>POST /v1/{project_id}/waf/policy/{policy_id}/custom</p>
</li><li id="waf_02_0049__li49351081">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="waf_02_0049__table41506548" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Path parameters</caption><thead align="left"><tr id="waf_02_0049__row5093551"><th align="left" class="cellrowborder" valign="top" width="25.507449255074494%" id="mcps1.3.2.2.2.1.2.5.1.1"><p id="waf_02_0049__p9924526"><strong id="waf_02_0049__b133601937201412">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.348265173482652%" id="mcps1.3.2.2.2.1.2.5.1.2"><p id="waf_02_0049__p65689174"><strong id="waf_02_0049__b1752894181410">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.348265173482652%" id="mcps1.3.2.2.2.1.2.5.1.3"><p id="waf_02_0049__p19222862"><strong id="waf_02_0049__b1219111445143">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="39.796020397960206%" id="mcps1.3.2.2.2.1.2.5.1.4"><p id="waf_02_0049__p13547966"><strong id="waf_02_0049__b13813164618144">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="waf_02_0049__row23643471"><td class="cellrowborder" valign="top" width="25.507449255074494%" headers="mcps1.3.2.2.2.1.2.5.1.1 "><p id="waf_02_0049__p36073000">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.2.2.2.1.2.5.1.2 "><p id="waf_02_0049__p36231922">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.2.2.2.1.2.5.1.3 "><p id="waf_02_0049__p49104597">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.2.2.2.1.2.5.1.4 "><p id="waf_02_0049__p18049400">Specifies the project ID.</p>
</td>
</tr>
<tr id="waf_02_0049__row28226873"><td class="cellrowborder" valign="top" width="25.507449255074494%" headers="mcps1.3.2.2.2.1.2.5.1.1 "><p id="waf_02_0049__p4675359">policy_id</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.2.2.2.1.2.5.1.2 "><p id="waf_02_0049__p43159835">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.2.2.2.1.2.5.1.3 "><p id="waf_02_0049__p6285714">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.2.2.2.1.2.5.1.4 "><p id="waf_02_0049__p39380846">Specifies the policy ID.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="waf_02_0049__section60612878"><h4 class="sectiontitle">Request</h4><div class="p" id="waf_02_0049__p915743125319">Request parameters
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="waf_02_0049__table8610164" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Parameter description</caption><thead align="left"><tr id="waf_02_0049__row58352912"><th align="left" class="cellrowborder" valign="top" width="25.507449255074494%" id="mcps1.3.3.2.1.2.5.1.1"><p id="waf_02_0049__p28965449"><strong id="waf_02_0049__b1672611517187">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.348265173482652%" id="mcps1.3.3.2.1.2.5.1.2"><p id="waf_02_0049__p64500002"><strong id="waf_02_0049__b2101155141818">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.26827317268273%" id="mcps1.3.3.2.1.2.5.1.3"><p id="waf_02_0049__p57117635"><strong id="waf_02_0049__b189031657111817">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="39.876012398760125%" id="mcps1.3.3.2.1.2.5.1.4"><p id="waf_02_0049__p63125717"><strong id="waf_02_0049__b142911403191">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="waf_02_0049__row12909439"><td class="cellrowborder" valign="top" width="25.507449255074494%" headers="mcps1.3.3.2.1.2.5.1.1 "><p id="waf_02_0049__p39031658">name</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.3.2.1.2.5.1.2 "><p id="waf_02_0049__p7447742">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17.26827317268273%" headers="mcps1.3.3.2.1.2.5.1.3 "><p id="waf_02_0049__p66396193">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.876012398760125%" headers="mcps1.3.3.2.1.2.5.1.4 "><p id="waf_02_0049__p9382590">Specifies the name of a precise protection rule. The maximum length is 256 characters. Only digits, letters, underscores (_), and hyphens (-) are allowed.</p>
</td>
</tr>
<tr id="waf_02_0049__row17334449"><td class="cellrowborder" valign="top" width="25.507449255074494%" headers="mcps1.3.3.2.1.2.5.1.1 "><p id="waf_02_0049__p61913109">time</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.3.2.1.2.5.1.2 "><p id="waf_02_0049__p48905926">No</p>
</td>
<td class="cellrowborder" valign="top" width="17.26827317268273%" headers="mcps1.3.3.2.1.2.5.1.3 "><p id="waf_02_0049__p1957035">Boolean</p>
</td>
<td class="cellrowborder" valign="top" width="39.876012398760125%" headers="mcps1.3.3.2.1.2.5.1.4 "><p id="waf_02_0049__p11288193815561">Specifies the effect time of the precise protection rule.</p>
<ul id="waf_02_0049__ul52563885311"><li id="waf_02_0049__li1525183805313"><span class="parmvalue" id="waf_02_0049__parmvalue125921355142818"><b>false</b></span>: The rule takes effect immediately.</li><li id="waf_02_0049__li179493215549"><span class="parmvalue" id="waf_02_0049__parmvalue1141418352075"><b>true</b></span>: The rule takes effect at the scheduled time.</li></ul>
</td>
</tr>
<tr id="waf_02_0049__row17392531"><td class="cellrowborder" valign="top" width="25.507449255074494%" headers="mcps1.3.3.2.1.2.5.1.1 "><p id="waf_02_0049__p66617803">start</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.3.2.1.2.5.1.2 "><p id="waf_02_0049__p27332947">No</p>
</td>
<td class="cellrowborder" valign="top" width="17.26827317268273%" headers="mcps1.3.3.2.1.2.5.1.3 "><p id="waf_02_0049__p66485075">Long</p>
</td>
<td class="cellrowborder" valign="top" width="39.876012398760125%" headers="mcps1.3.3.2.1.2.5.1.4 "><p id="waf_02_0049__p16582004">Specifies the time when the precise protection rule takes effect. If <strong id="waf_02_0049__b1841431119596">time</strong> is set to <strong id="waf_02_0049__b8227131615592">true</strong>, either the start time or the end time must be set.</p>
</td>
</tr>
<tr id="waf_02_0049__row15020312"><td class="cellrowborder" valign="top" width="25.507449255074494%" headers="mcps1.3.3.2.1.2.5.1.1 "><p id="waf_02_0049__p8685773">end</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.3.2.1.2.5.1.2 "><p id="waf_02_0049__p32458998">No</p>
</td>
<td class="cellrowborder" valign="top" width="17.26827317268273%" headers="mcps1.3.3.2.1.2.5.1.3 "><p id="waf_02_0049__p11933180">Long</p>
</td>
<td class="cellrowborder" valign="top" width="39.876012398760125%" headers="mcps1.3.3.2.1.2.5.1.4 "><p id="waf_02_0049__p27063494">Specifies the time when the precise protection rule expires. If <strong id="waf_02_0049__b13805143955918">time</strong> is set to <strong id="waf_02_0049__b1805539145916">true</strong>, either the start time or the end time must be set.</p>
</td>
</tr>
<tr id="waf_02_0049__row42244856"><td class="cellrowborder" valign="top" width="25.507449255074494%" headers="mcps1.3.3.2.1.2.5.1.1 "><p id="waf_02_0049__p66390180">conditions</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.3.2.1.2.5.1.2 "><p id="waf_02_0049__p8895496">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17.26827317268273%" headers="mcps1.3.3.2.1.2.5.1.3 "><p id="waf_02_0049__p8702162652812"><a href="#waf_02_0049__table8999745192019">Table 3</a></p>
</td>
<td class="cellrowborder" valign="top" width="39.876012398760125%" headers="mcps1.3.3.2.1.2.5.1.4 "><p id="waf_02_0049__p45752091">Specifies the condition parameters.</p>
</td>
</tr>
<tr id="waf_02_0049__row13191058"><td class="cellrowborder" valign="top" width="25.507449255074494%" headers="mcps1.3.3.2.1.2.5.1.1 "><p id="waf_02_0049__p61842812">action</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.3.2.1.2.5.1.2 "><p id="waf_02_0049__p43211903">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17.26827317268273%" headers="mcps1.3.3.2.1.2.5.1.3 "><p id="waf_02_0049__p10503234"><a href="#waf_02_0049__table10607112511329">Table 4</a></p>
</td>
<td class="cellrowborder" valign="top" width="39.876012398760125%" headers="mcps1.3.3.2.1.2.5.1.4 "><p id="waf_02_0049__p45455597">Specifies the protective action after the precise protection rule is matched.</p>
</td>
</tr>
<tr id="waf_02_0049__row22054494"><td class="cellrowborder" valign="top" width="25.507449255074494%" headers="mcps1.3.3.2.1.2.5.1.1 "><p id="waf_02_0049__p41583556">priority</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.3.2.1.2.5.1.2 "><p id="waf_02_0049__p12824875">No</p>
</td>
<td class="cellrowborder" valign="top" width="17.26827317268273%" headers="mcps1.3.3.2.1.2.5.1.3 "><p id="waf_02_0049__p32181946">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="39.876012398760125%" headers="mcps1.3.3.2.1.2.5.1.4 "><p id="waf_02_0049__p5282171915206">Specifies the priority of a rule being executed. Smaller values correspond to higher priorities. If two rules are assigned with the same priority, the rule added earlier has higher priority. The value ranges from <strong id="waf_02_0049__b13239114610197">0</strong> to <strong id="waf_02_0049__b5340155031918">65535</strong>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="tablenoborder"><a name="waf_02_0049__table8999745192019"></a><a name="table8999745192019"></a><table cellpadding="4" cellspacing="0" summary="" id="waf_02_0049__table8999745192019" frame="border" border="1" rules="all"><caption><b>Table 3 </b><strong id="waf_02_0049__b1162014127287">conditions</strong></caption><thead align="left"><tr id="waf_02_0049__row187946192018"><th align="left" class="cellrowborder" valign="top" width="25.61%" id="mcps1.3.3.3.2.5.1.1"><p id="waf_02_0049__p1810114618208"><strong id="waf_02_0049__b18519164810111">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.09%" id="mcps1.3.3.3.2.5.1.2"><p id="waf_02_0049__p982910912357"><strong id="waf_02_0049__b1440206295">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="21.36%" id="mcps1.3.3.3.2.5.1.3"><p id="waf_02_0049__p15129469208"><strong id="waf_02_0049__b1848933010498">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="35.94%" id="mcps1.3.3.3.2.5.1.4"><p id="waf_02_0049__p1151846112017"><strong id="waf_02_0049__b362213502119">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="waf_02_0049__row18193192042114"><td class="cellrowborder" valign="top" width="25.61%" headers="mcps1.3.3.3.2.5.1.1 "><p id="waf_02_0049__p17915121882118">category</p>
</td>
<td class="cellrowborder" valign="top" width="17.09%" headers="mcps1.3.3.3.2.5.1.2 "><p id="waf_02_0049__p8896173833419">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="21.36%" headers="mcps1.3.3.3.2.5.1.3 "><p id="waf_02_0049__p13919121810219">String</p>
</td>
<td class="cellrowborder" valign="top" width="35.94%" headers="mcps1.3.3.3.2.5.1.4 "><p id="waf_02_0049__p6922118172114">Specifies the condition type. The value can be <strong id="waf_02_0049__b1617276204315">path</strong>, <strong id="waf_02_0049__b15172116134318">user-agent</strong>, <strong id="waf_02_0049__b1917214674313">ip</strong>, <strong id="waf_02_0049__b3173136184315">params</strong>, <strong id="waf_02_0049__b121737612431">cookie</strong>, <strong id="waf_02_0049__b1117313618439">referer</strong>, or <strong id="waf_02_0049__b111748694318">header</strong>.</p>
</td>
</tr>
<tr id="waf_02_0049__row2191142014219"><td class="cellrowborder" valign="top" width="25.61%" headers="mcps1.3.3.3.2.5.1.1 "><p id="waf_02_0049__p17927121862115">index</p>
</td>
<td class="cellrowborder" valign="top" width="17.09%" headers="mcps1.3.3.3.2.5.1.2 "><p id="waf_02_0049__p48971338133418">No</p>
</td>
<td class="cellrowborder" valign="top" width="21.36%" headers="mcps1.3.3.3.2.5.1.3 "><p id="waf_02_0049__p1793021892114">String</p>
</td>
<td class="cellrowborder" valign="top" width="35.94%" headers="mcps1.3.3.3.2.5.1.4 "><ul id="waf_02_0049__ul51027553113"><li id="waf_02_0049__li210211551418">If <strong id="waf_02_0049__b79561522192315">category</strong> is set to <strong id="waf_02_0049__b595622282316">cookie</strong>, <strong id="waf_02_0049__b16956172218233">index</strong> indicates cookie name.</li><li id="waf_02_0049__li9102355812">If <strong id="waf_02_0049__b1585252617239">category</strong> is set to <strong id="waf_02_0049__b168521826122310">params</strong>, <strong id="waf_02_0049__b14852192612236">index</strong> indicates param name.</li><li id="waf_02_0049__li1810217559112">If <strong id="waf_02_0049__b13860101314471">category </strong>is set to <strong id="waf_02_0049__b108602013164719">header</strong>, <strong id="waf_02_0049__b188608132471">index</strong> indicates an option in the header.</li></ul>
</td>
</tr>
<tr id="waf_02_0049__row1191112015214"><td class="cellrowborder" valign="top" width="25.61%" headers="mcps1.3.3.3.2.5.1.1 "><p id="waf_02_0049__p1893714188211">logic</p>
</td>
<td class="cellrowborder" valign="top" width="17.09%" headers="mcps1.3.3.3.2.5.1.2 "><p id="waf_02_0049__p17897103873415">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="21.36%" headers="mcps1.3.3.3.2.5.1.3 "><p id="waf_02_0049__p994051832118">String</p>
</td>
<td class="cellrowborder" valign="top" width="35.94%" headers="mcps1.3.3.3.2.5.1.4 "><p id="waf_02_0049__p6249135565913"><span class="parmvalue" id="waf_02_0049__parmvalue6541735102217"><b>contain</b></span>, <span class="parmvalue" id="waf_02_0049__parmvalue1055193515227"><b>not_contain</b></span>, <span class="parmvalue" id="waf_02_0049__parmvalue1956103518228"><b>equal</b></span>, <span class="parmvalue" id="waf_02_0049__parmvalue1956113512211"><b>not_equal</b></span>, <span class="parmvalue" id="waf_02_0049__parmvalue1957535132213"><b>prefix</b></span>, <span class="parmvalue" id="waf_02_0049__parmvalue857113592220"><b>not_prefix</b></span>, <span class="parmvalue" id="waf_02_0049__parmvalue75743510226"><b>suffix</b></span>, and <span class="parmvalue" id="waf_02_0049__parmvalue12581635172218"><b>not_suffix</b></span> indicate <strong id="waf_02_0049__b659193515223">Include</strong>, <strong id="waf_02_0049__b0601235152215">Exclude</strong>, <strong id="waf_02_0049__b8605353220">Equal to</strong>, <strong id="waf_02_0049__b14601935142214">Not equal to</strong>, <strong id="waf_02_0049__b1261173582217">Prefix is</strong>, <strong id="waf_02_0049__b1462113511222">Prefix is not</strong>, <strong id="waf_02_0049__b96217354223">Suffix is</strong>, and <strong id="waf_02_0049__b126315357226">Suffix is not</strong> respectively.</p>
<p id="waf_02_0049__p072865520416">If <span class="parmname" id="waf_02_0049__parmname1777281044316"><b>category</b></span> is set to <strong id="waf_02_0049__b1277417106439">ip</strong>, <span class="parmname" id="waf_02_0049__parmname4774101094315"><b>logic</b></span> can only be <span class="parmvalue" id="waf_02_0049__parmvalue17775151014317"><b>equal</b></span> or <span class="parmvalue" id="waf_02_0049__parmvalue67750101438"><b>not_equal</b></span>.</p>
</td>
</tr>
<tr id="waf_02_0049__row17189620192110"><td class="cellrowborder" valign="top" width="25.61%" headers="mcps1.3.3.3.2.5.1.1 "><p id="waf_02_0049__p139511118132116">contents</p>
</td>
<td class="cellrowborder" valign="top" width="17.09%" headers="mcps1.3.3.3.2.5.1.2 "><p id="waf_02_0049__p68976382348">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="21.36%" headers="mcps1.3.3.3.2.5.1.3 "><p id="waf_02_0049__p14953818172112">List</p>
</td>
<td class="cellrowborder" valign="top" width="35.94%" headers="mcps1.3.3.3.2.5.1.4 "><p id="waf_02_0049__p39551318112111">Specifies content matching the condition. Currently, only one value is accepted. </p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="waf_02_0049__table10607112511329"></a><a name="table10607112511329"></a><table cellpadding="4" cellspacing="0" summary="" id="waf_02_0049__table10607112511329" frame="border" border="1" rules="all"><caption><b>Table 4 </b><strong id="waf_02_0049__b6602112382816">action</strong></caption><thead align="left"><tr id="waf_02_0049__row186151525163218"><th align="left" class="cellrowborder" valign="top" width="25.69%" id="mcps1.3.3.4.2.5.1.1"><p id="waf_02_0049__p1461816256324"><strong id="waf_02_0049__b03277161934">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.830000000000002%" id="mcps1.3.3.4.2.5.1.2"><p id="waf_02_0049__p177751119143610"><strong id="waf_02_0049__b1952857060">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20.68%" id="mcps1.3.3.4.2.5.1.3"><p id="waf_02_0049__p116201025143210"><strong id="waf_02_0049__b422279724">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="36.8%" id="mcps1.3.3.4.2.5.1.4"><p id="waf_02_0049__p17625142533210"><strong id="waf_02_0049__b33210186311">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="waf_02_0049__row34449423322"><td class="cellrowborder" valign="top" width="25.69%" headers="mcps1.3.3.4.2.5.1.1 "><p id="waf_02_0049__p173849415321">category</p>
</td>
<td class="cellrowborder" valign="top" width="16.830000000000002%" headers="mcps1.3.3.4.2.5.1.2 "><p id="waf_02_0049__p3775619133618">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20.68%" headers="mcps1.3.3.4.2.5.1.3 "><p id="waf_02_0049__p13387241113219">String</p>
</td>
<td class="cellrowborder" valign="top" width="36.8%" headers="mcps1.3.3.4.2.5.1.4 "><p id="waf_02_0049__p94858282213">Specifies the protective action.</p>
<ul id="waf_02_0049__ul1491712301523"><li id="waf_02_0049__li169619511124"><span class="parmvalue" id="waf_02_0049__parmvalue16530112781515"><b>block</b></span>: block.</li><li id="waf_02_0049__li1091753013216"><span class="parmvalue" id="waf_02_0049__parmvalue1652183113155"><b>pass</b></span>: allow.</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="waf_02_0049__section8644993"><h4 class="sectiontitle">Response</h4><div class="p" id="waf_02_0049__p18873142645316">Response parameters
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="waf_02_0049__table30555213" frame="border" border="1" rules="all"><caption><b>Table 5 </b>Parameter description</caption><thead align="left"><tr id="waf_02_0049__row28256362"><th align="left" class="cellrowborder" valign="top" width="42.85571442855714%" id="mcps1.3.4.2.1.2.4.1.1"><p id="waf_02_0049__p7063986"><strong id="waf_02_0049__b15739221497">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.348265173482652%" id="mcps1.3.4.2.1.2.4.1.2"><p id="waf_02_0049__p35312007"><strong id="waf_02_0049__b1067791273">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="39.796020397960206%" id="mcps1.3.4.2.1.2.4.1.3"><p id="waf_02_0049__p41700304"><strong id="waf_02_0049__b7500183884913">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="waf_02_0049__row39758420"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0049__p66315431">id</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0049__p2840802">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0049__p28778414">Specifies the ID of a precise protection rule.</p>
</td>
</tr>
<tr id="waf_02_0049__row57679138"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0049__p41498569">policy_id</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0049__p5940949">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0049__p11454894">Specifies the ID of the policy to which the rule belongs.</p>
</td>
</tr>
<tr id="waf_02_0049__row35985187"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0049__p29119001">name</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0049__p9828880">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0049__p57941807">Specifies the rule name.</p>
</td>
</tr>
<tr id="waf_02_0049__row51714222"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0049__p28102429">conditions</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0049__p61704265"><a href="#waf_02_0049__table15795105212399">Table 6</a></p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0049__p31989529">Specifies the condition parameters in the precise protection rule.</p>
</td>
</tr>
<tr id="waf_02_0049__row53590077"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0049__p45828979">action</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0049__p21159789"><a href="#waf_02_0049__table11869252183917">Table 7</a></p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0049__p36221331">Specifies the protective action after the precise protection rule is matched.</p>
</td>
</tr>
<tr id="waf_02_0049__row9477515"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0049__p29481256">priority</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0049__p39171554">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0049__p175201816103813">Specifies the priority of a rule being executed. Smaller values correspond to higher priorities. If two rules are assigned with the same priority, the rule added earlier has higher priority. The value ranges from <strong id="waf_02_0049__b8461337047">0</strong> to <strong id="waf_02_0049__b10466372415">65535</strong>.</p>
</td>
</tr>
<tr id="waf_02_0049__row19630814152611"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0049__p18257131942020">time</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0049__p4259181962019">Boolean</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0049__p618124395719">Specifies the effect time of the precise protection rule.</p>
<ul id="waf_02_0049__ul132111451508"><li id="waf_02_0049__li12131551506"><span class="parmvalue" id="waf_02_0049__parmvalue139731422173118"><b>false</b></span>: The rule takes effect immediately.</li><li id="waf_02_0049__li5221551506"><span class="parmvalue" id="waf_02_0049__parmvalue181926531872"><b>true</b></span>: The rule takes effect at the scheduled time.</li></ul>
</td>
</tr>
<tr id="waf_02_0049__row172872583236"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0049__p1828985872315">start</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0049__p1928925872320">Long</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0049__p3289658102318">Specifies the time when the precise protection rule takes effect.</p>
</td>
</tr>
<tr id="waf_02_0049__row184061547240"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0049__p134063413241">end</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0049__p140610415249">Long</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0049__p12406114142419">Specifies the time when the precise protection rule expires.</p>
</td>
</tr>
<tr id="waf_02_0049__row89941720172515"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0049__p11994182062511">timestamp</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0049__p799417209254">Long</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0049__p15994102012255">Specifies the time when a precise protection rule is added.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="tablenoborder"><a name="waf_02_0049__table15795105212399"></a><a name="table15795105212399"></a><table cellpadding="4" cellspacing="0" summary="" id="waf_02_0049__table15795105212399" frame="border" border="1" rules="all"><caption><b>Table 6 </b><strong id="waf_02_0049__b1139317965614">conditions</strong></caption><thead align="left"><tr id="waf_02_0049__row18801155273910"><th align="left" class="cellrowborder" valign="top" width="33.086691330866906%" id="mcps1.3.4.3.2.4.1.1"><p id="waf_02_0049__p680445263913"><strong id="waf_02_0049__b85681642510">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="27.117288271172878%" id="mcps1.3.4.3.2.4.1.2"><p id="waf_02_0049__p8807552173910"><strong id="waf_02_0049__b1796991050">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="39.7960203979602%" id="mcps1.3.4.3.2.4.1.3"><p id="waf_02_0049__p11809552173910"><strong id="waf_02_0049__b36481468512">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="waf_02_0049__row1981275223913"><td class="cellrowborder" valign="top" width="33.086691330866906%" headers="mcps1.3.4.3.2.4.1.1 "><p id="waf_02_0049__p1481416526399">category</p>
</td>
<td class="cellrowborder" valign="top" width="27.117288271172878%" headers="mcps1.3.4.3.2.4.1.2 "><p id="waf_02_0049__p181717528397">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.7960203979602%" headers="mcps1.3.4.3.2.4.1.3 "><p id="waf_02_0049__p78191552193916">Specifies the condition type. The value can be <strong id="waf_02_0049__b106121320164312">path</strong>, <strong id="waf_02_0049__b16138202433">user-agent</strong>, <strong id="waf_02_0049__b196139208431">ip</strong>, <strong id="waf_02_0049__b12614172017435">params</strong>, <strong id="waf_02_0049__b16614720164316">cookie</strong>, <strong id="waf_02_0049__b06158202434">referer</strong>, or <strong id="waf_02_0049__b761512024310">header</strong>.</p>
</td>
</tr>
<tr id="waf_02_0049__row198208522393"><td class="cellrowborder" valign="top" width="33.086691330866906%" headers="mcps1.3.4.3.2.4.1.1 "><p id="waf_02_0049__p6823135213395">index</p>
</td>
<td class="cellrowborder" valign="top" width="27.117288271172878%" headers="mcps1.3.4.3.2.4.1.2 "><p id="waf_02_0049__p882745213392">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.7960203979602%" headers="mcps1.3.4.3.2.4.1.3 "><ul id="waf_02_0049__ul5824161113"><li id="waf_02_0049__li282201612114">If <strong id="waf_02_0049__b53114532232">category</strong> is set to <strong id="waf_02_0049__b11319539230">cookie</strong>, <strong id="waf_02_0049__b631125319236">index</strong> indicates cookie name.</li><li id="waf_02_0049__li107272351815">If <strong id="waf_02_0049__b18195195612237">category</strong> is set to <strong id="waf_02_0049__b419565622310">params</strong>, <strong id="waf_02_0049__b161951856182313">index</strong> indicates param name.</li><li id="waf_02_0049__li13822161113">If <strong id="waf_02_0049__b71031017154715">category </strong>is set to <strong id="waf_02_0049__b141031917174718">header</strong>, <strong id="waf_02_0049__b8103191714713">index</strong> indicates an option in the header.</li></ul>
</td>
</tr>
<tr id="waf_02_0049__row88321852153910"><td class="cellrowborder" valign="top" width="33.086691330866906%" headers="mcps1.3.4.3.2.4.1.1 "><p id="waf_02_0049__p983495273920">logic</p>
</td>
<td class="cellrowborder" valign="top" width="27.117288271172878%" headers="mcps1.3.4.3.2.4.1.2 "><p id="waf_02_0049__p128381352133914">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.7960203979602%" headers="mcps1.3.4.3.2.4.1.3 "><p id="waf_02_0049__p17842105216390"><span class="parmvalue" id="waf_02_0049__parmvalue178384020229"><b>contain</b></span>, <span class="parmvalue" id="waf_02_0049__parmvalue57842040162215"><b>not_contain</b></span>, <span class="parmvalue" id="waf_02_0049__parmvalue1578411409220"><b>equal</b></span>, <span class="parmvalue" id="waf_02_0049__parmvalue15785154012227"><b>not_equal</b></span>, <span class="parmvalue" id="waf_02_0049__parmvalue97851640162216"><b>prefix</b></span>, <span class="parmvalue" id="waf_02_0049__parmvalue778616404222"><b>not_prefix</b></span>, <span class="parmvalue" id="waf_02_0049__parmvalue8786240192213"><b>suffix</b></span>, and <span class="parmvalue" id="waf_02_0049__parmvalue14787194072218"><b>not_suffix</b></span> indicate <strong id="waf_02_0049__b19788194062214">Include</strong>, <strong id="waf_02_0049__b4789340182218">Exclude</strong>, <strong id="waf_02_0049__b107894409222">Equal to</strong>, <strong id="waf_02_0049__b7789184062215">Not equal to</strong>, <strong id="waf_02_0049__b1679024082211">Prefix is</strong>, <strong id="waf_02_0049__b11790144022215">Prefix is not</strong>, <strong id="waf_02_0049__b379114405227">Suffix is</strong>, and <strong id="waf_02_0049__b07910402225">Suffix is not</strong> respectively.</p>
<p id="waf_02_0049__p98653711425">If <span class="parmname" id="waf_02_0049__parmname79312519439"><b>category</b></span> is set to <strong id="waf_02_0049__b189442524313">ip</strong>, <span class="parmname" id="waf_02_0049__parmname294112504314"><b>logic</b></span> can only be <span class="parmvalue" id="waf_02_0049__parmvalue5956256431"><b>equal</b></span> or <span class="parmvalue" id="waf_02_0049__parmvalue1995172519431"><b>not_equal</b></span>.</p>
</td>
</tr>
<tr id="waf_02_0049__row7844115211397"><td class="cellrowborder" valign="top" width="33.086691330866906%" headers="mcps1.3.4.3.2.4.1.1 "><p id="waf_02_0049__p198482052183915">contents</p>
</td>
<td class="cellrowborder" valign="top" width="27.117288271172878%" headers="mcps1.3.4.3.2.4.1.2 "><p id="waf_02_0049__p8852155293920">List</p>
</td>
<td class="cellrowborder" valign="top" width="39.7960203979602%" headers="mcps1.3.4.3.2.4.1.3 "><p id="waf_02_0049__p3856135214398">Specifies content matching the condition.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="waf_02_0049__table11869252183917"></a><a name="table11869252183917"></a><table cellpadding="4" cellspacing="0" summary="" id="waf_02_0049__table11869252183917" frame="border" border="1" rules="all"><caption><b>Table 7 </b><strong id="waf_02_0049__b9817121155612">action</strong></caption><thead align="left"><tr id="waf_02_0049__row108771152153912"><th align="left" class="cellrowborder" valign="top" width="33.086691330866906%" id="mcps1.3.4.4.2.4.1.1"><p id="waf_02_0049__p1088015522391"><strong id="waf_02_0049__b44061821169">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="27.117288271172878%" id="mcps1.3.4.4.2.4.1.2"><p id="waf_02_0049__p788305283914"><strong id="waf_02_0049__b1196187592">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="39.7960203979602%" id="mcps1.3.4.4.2.4.1.3"><p id="waf_02_0049__p888585219398"><strong id="waf_02_0049__b10513271166">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="waf_02_0049__row208859523396"><td class="cellrowborder" valign="top" width="33.086691330866906%" headers="mcps1.3.4.4.2.4.1.1 "><p id="waf_02_0049__p888817523397">category</p>
</td>
<td class="cellrowborder" valign="top" width="27.117288271172878%" headers="mcps1.3.4.4.2.4.1.2 "><p id="waf_02_0049__p3890165216399">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.7960203979602%" headers="mcps1.3.4.4.2.4.1.3 "><p id="waf_02_0049__p98611530733">Specifies the protective action.</p>
<ul id="waf_02_0049__ul1186323013318"><li id="waf_02_0049__li2865103017310"><span class="parmvalue" id="waf_02_0049__parmvalue16644175520155"><b>block</b></span>: block.</li><li id="waf_02_0049__li8871133011319"><span class="parmvalue" id="waf_02_0049__parmvalue13011559161517"><b>pass</b></span>: allow.</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="waf_02_0049__section9395143112535"><h4 class="sectiontitle">Examples</h4><p id="waf_02_0049__p452212418295">A rule named <strong id="waf_02_0049__b2652185934915">rule1</strong> is used as an example.</p>
<ul id="waf_02_0049__ul544413135312"><li id="waf_02_0049__li1744423175310">Request example<pre class="screen" id="waf_02_0049__screen8444123145315">{
"name": "rule1",
"time": true,
"start": 1499817600,
"end": 1567817600,
"conditions": [{
"category": "path",
"contents": ["/login"],
"logic": "contain"
},{
"category": "ip",
"logic": "equal",
"contents": ["X.X.1.1"]
}
],
"action": {
"category": "block"
},
"priority": 10
}</pre>
</li></ul>
<ul id="waf_02_0049__ul19445831175312"><li id="waf_02_0049__li944517310536">Response example<pre class="screen" id="waf_02_0049__screen114451331155313">{
"id": "7374ad99c6c448e9a9ca35cb46660a39",
"policy_id": "9tre832yf96784ec8abd8ba61a98064ef",
"name": "rule1",
"time": true,
"start": 1499817600,
"end": 1567817600,
"conditions": [{
"category": "path",
"contents": ["/login"],
"logic": "contain"
},{
"category": "ip",
"logic": "equal",
"contents": ["X.X.1.1"]
}
],
"action": {
"category": "block"
},
"priority": 10,
"timestamp": 1499817600
}</pre>
</li></ul>
</div>
<div class="section" id="waf_02_0049__section10696080"><h4 class="sectiontitle">Status Code</h4><div class="p" id="waf_02_0049__waf_02_0012_a652d4922b7df48fca0a65bc1a38ea5f2"><a href="#waf_02_0049__waf_02_0012_t82c3440f3efb42a38b9d4dc4011a33d0">Table 8</a> describes the normal status code returned by the API.
<div class="tablenoborder"><a name="waf_02_0049__waf_02_0012_t82c3440f3efb42a38b9d4dc4011a33d0"></a><a name="waf_02_0012_t82c3440f3efb42a38b9d4dc4011a33d0"></a><table cellpadding="4" cellspacing="0" summary="" id="waf_02_0049__waf_02_0012_t82c3440f3efb42a38b9d4dc4011a33d0" frame="border" border="1" rules="all"><caption><b>Table 8 </b>Status code</caption><thead align="left"><tr id="waf_02_0049__waf_02_0012_r3d6e2f205c444705bdbb9daaac74e575"><th align="left" class="cellrowborder" valign="top" width="22%" id="mcps1.3.6.2.2.2.4.1.1"><p id="waf_02_0049__waf_02_0012_af3c4073076f24eca88d94e3fa1effdc6">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="19.41%" id="mcps1.3.6.2.2.2.4.1.2"><p id="waf_02_0049__waf_02_0012_en-us_topic_0144911667_p4531342288">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="58.589999999999996%" id="mcps1.3.6.2.2.2.4.1.3"><p id="waf_02_0049__waf_02_0012_ada185614bba24140995b8123b3e9faa8">Meaning</p>
</th>
</tr>
</thead>
<tbody><tr id="waf_02_0049__waf_02_0012_rc7b2adc390904a1ba79e303017797786"><td class="cellrowborder" valign="top" width="22%" headers="mcps1.3.6.2.2.2.4.1.1 "><p id="waf_02_0049__waf_02_0012_a93f3895d44bb4226934cc626ac50e37b">200</p>
</td>
<td class="cellrowborder" valign="top" width="19.41%" headers="mcps1.3.6.2.2.2.4.1.2 "><p id="waf_02_0049__waf_02_0012_en-us_topic_0144911667_p7538425819">OK</p>
</td>
<td class="cellrowborder" valign="top" width="58.589999999999996%" headers="mcps1.3.6.2.2.2.4.1.3 "><p id="waf_02_0049__waf_02_0012_en-us_topic_0144911667_p369874114414">The request has succeeded.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p id="waf_02_0049__waf_02_0012_en-us_topic_0144911667_p482819399522">For details about error status codes, see <a href="waf_02_0085.html">Status Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="waf_02_0047.html">Precise Protection Rules</a></div>
</div>
</div>