Help Center/ Edge Security/ API Reference/ API/ HTTP Protection Rule Management - Geographical Location/ This API is used to create a geolocation access control rule.
Updated on 2024-11-18 GMT+08:00

This API is used to create a geolocation access control rule.

Function

This API is used to create a geolocation access control rule.

URI

POST /v1/edgesec/configuration/http/policies/{policy_id}/geoip-rule

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

policy_id

Yes

String

Policy ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

auth token

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Rule name

description

No

String

Rule description, which contains a maximum of 512 characters.

geo_ip

Yes

String

Select the region code and separate them with a vertical bar (|):\n(Beijing: CN_BJ, Shanghai: CN_SH, Tianjin: CN_TJ, Chongqing: CN_CQ, Guangdong: CN_GD, Zhejiang: CN_ZJ, Jiangsu: CN_JS, Fujian: CN_FJ, Jilin: CN_JL, Liaoning: CN_LN, Taiwan: CN_TW, Guizhou: CN_GZ, Anhui: CN_AH, Heilongjiang: CN_HL, Henan: CN_HA, Sichuan: CN_SC, Hebei: CN_HE, Yunnan: CN_YN, Hubei: CN_HB, Hainan: CN_HI, Qinghai: CN_QH, Hunan: CN_HN, Jiangxi: CN_JX, Shanxi: CN_SX, Shaanxi: CN_SN, Gansu: CN_GS, Shandong: CN_SD, Macao: CN_MO, Hong Kong: CN_HK, Ningxia: CN_NX, Guangxi: CN_GX, Xinjiang: CN_XJ, Tibet: CN_XZ, Inner Mongolia: CN_NM, India: IN, United States: US, Indonesia: ID, Pakistan: PK, Brazil: BR, Nigeria: NG, Bangladesh: BD, Russian Federation: RU, Japan: JP, Mexico: MX, Ethiopia: ET, Philippines: PH, Egypt: EG, Viet Nam: VN, Germany: DE, Turkey: TR, Thailand: TH, France: FR, United Kingdom: GB, Italy: IT, South Africa: ZA, Myanmar: MM, Kenya: KE, United Republic of Tanzania: TZ, Colombia: CO, Spain: ES, Ukraine: UA, Iraq: IQ, Poland: PL, Saudi Arabia: SA, Peru: PE, Uganda: UG, Malaysia: MY, Sudan: SD, Romania: RO, Afghanistan: AF, Canada: CA, Morocco: MA, Chile: CL, Democratic Republic of the Congo: CD, Iran, Islamic Republic of: IR, Korea, Republic of: KR, Angola: AO, Ghana: GH, Mozambique: MZ, Argentina: AR, Algeria: DZ, Nepal: NP, Madagascar: MG, Korea, Democratic People's Republic of: KP, Cameroon: CM, Cote d'Ivoire: CI, Australia: AU, Netherlands: NL, Niger: NE, Sri Lanka: LK, Burkina Faso: BF, Uzbekistan: UZ, Mali: ML, Venezuela: VE, Kazakhstan: KZ, Malawi: MW, Zambia: ZM, Yemen: YE, Belgium: BE, Guatemala: GT, Syrian Arab Republic: SY, Ecuador: EC, Senegal: SN, Chad: TD, Somalia: SO, Zimbabwe: ZW, Guinea: GN, Rwanda: RW, Tunisia: TN, Benin: BJ, Czech Republic: CZ, Bolivia: BO, Cuba: CU, Burundi: BI, Haiti: HT, Cambodia: KH, Greece: GR, Dominican Republic: DO, Sweden: SE, Portugal: PT, Jordan: JO, South Sudan: SS, Azerbaijan: AZ, Hungary: HU, United Arab Emirates: AE, Honduras: HN, Belarus: BY, Tajikistan: TJ, Israel: IL, Austria: AT, Papua New Guinea: PG, Switzerland: CH, Togo: TG, Sierra Leone: SL, Lao People's Democratic Republic: LA, Bulgaria: BG, Serbia: RS, Paraguay: PY, Lebanon: LB, Libya: LY, Nicaragua: NI, El Salvador: SV, Kyrgyzstan: KG, Turkmenistan: TM, Denmark: DK, Singapore: SG, Finland: FI, Slovakia: SK, Norway: NO, Congo: CG, Costa Rica: CR, New Zealand: NZ, Ireland: IE, Oman: OM, Liberia: LR, Central African Republic: CF, Palestine, State of: PS, Mauritania: MR, Panama: PA, Kuwait: KW, Croatia: HR, Georgia: GE, Moldova, Republic of: MD, Uruguay: UY, Bosnia and Herzegovina: BA, Puerto Rico: PR, Mongolia: MN, Armenia: AM, Jamaica: JM, Albania: AL, Lithuania: LT, Qatar: QA, Namibia: NA, Gambia: GM, Botswana: BW, Gabon: GA, Lesotho: LS, Macedonia, the Former Yugoslav Republic of: MK, Slovenia: SI, Latvia: LV, Guinea-Bissau: GW, Kosovo: XK, Bahrain: BH, Trinidad and Tobago: TT, Estonia: EE, Equatorial Guinea: GQ, Timor-Leste: TL, Mauritius: MU, Cyprus: CY, Eswatini: SZ, Djibouti: DJ, Fiji: FJ, Reunion: RE, Comoros: KM, Guyana: GY, Bhutan: BT, Solomon Islands: SB, Montenegro: ME, Luxembourg: LU, Suriname: SR, Cape Verde: CV, Maldives: MV, Western Sahara: EH, Malta: MT, Brunei Darussalam: BN, Guadeloupe: GP, Bahamas: BS, Belize: BZ, Martinique: MQ, Iceland: IS, French Guiana: GF, Vanuatu: VU, Barbados: BB, New Caledonia: NC, French Polynesia: PF, Mayotte: YT, Netherlands Antilles: AN, Sao Tome and Principe: ST, Samoa: WS, Saint Lucia: LC, Guam: GU, Curacao: CW, Kiribati: KI, Micronesia, Federated States of: FM, Grenada: GD, Saint Vincent and the Grenadines: VC, US Virgin Islands: VI, Jersey: JE, Aruba: AW, Tonga: TO, Seychelles: SC, Antigua and Barbuda: AG, Isle of Man: IM, Andorra: AD, Dominica: DM, Cayman Islands: KY, Bermuda: BM, Guernsey: GG, Marshall Islands: MH, Northern Mariana Islands: MP, Greenland: GL, American Samoa: AS, Saint Kitts and Nevis: KN, Faroe Islands: FO, Sint Maarten (Dutch part): SX, Monaco: MC, Liechtenstein: LI, Turks and Caicos Islands: TC, Saint Martin (French part): MF, San Marino: SM, Gibraltar: GI, British Virgin Islands: VG, Åland Islands: AX, Bonaire: BQ, Palau: PW, Cook Islands: CK, Anguilla: AI, Nauru: NR, Wallis and Futuna: WF, Tuvalu: TV, Saint Barthelemy: BL, Saint Pierre and Miquelon: PM, Montserrat: MS, Saint Helena: SH, Falkland Islands (Malvinas): FK, Norfolk Island: NF, Niue: NU, Tokelau: TK, Christmas Island: CX, Holy See (Vatican City State): VA, Cocos (Keeling) Islands: CC, United States Minor Outlying Islands: UM, Pitcairn: PN, South Georgia and the South Sandwich Islands: GS, Antarctica: AQ, Bouvet Island: BV, Eritrea: ER, Heard Island and McDonald Islands: HM, British Indian Ocean Territory: IO, French Southern Territories: TF, Svalbard and Jan Mayen: SJ)

white

Yes

Integer

Protection action:

  • 0: Block
  • 1: Allow
  • 2: Record only

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

id

String

Rule ID

name

String

Rule name

policyid

String

ID of the policy to which the rule belongs

policy_name

String

Name of the policy to which the rule belongs

timestamp

Long

Time when a rule is created

description

String

Rule description

status

Integer

Rule enabling status

geo_ip

String

Geo-location

geo_tag_list

Array of strings

Geographical location list

white

Integer

Block/Allow/Record only

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Standard error code: service name.8-digit code

error_msg

String

Detailed error information.

encoded_authorization_message

String

If the service is integrated with IAM5.0, an IAM response must be returned when access is denied.

Status code: 401

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Standard error code: service name.8-digit code

error_msg

String

Detailed error information.

encoded_authorization_message

String

If the service is integrated with IAM5.0, an IAM response must be returned when access is denied.

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Standard error code: service name.8-digit code

error_msg

String

Detailed error information.

encoded_authorization_message

String

If the service is integrated with IAM5.0, an IAM response must be returned when access is denied.

Example Requests

None

Example Responses

None

Status Codes

Status Code

Description

200

OK

400

Request failed.

401

The token does not have required permissions.

500

Internal server error.

Error Codes

See Error Codes.