# Get forwarding rules - GetBGPServiceFwdRule

## Overview

Get forwarding rules






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `GetBGPServiceFwdRule`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.ckcloudai.com/uaccount/api_manage)                                             | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **ResourceId** | string | Resource ID |**Yes**|
| **Offset** | int | The starting offset for pagination display, default value is 0. |No|
| **Limit** | int | Number of items displayed per page, the default value is 32 |No|
| **RuleIndex** | int | Query the specified rule_id, if not filled in, the default is to get all forwarding rules. |No|
| **BgpIP** | string | Specify the rules under the IP to be queried |No|

### Response Field

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RetCode** | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. |**Yes**|
| **Action** | string | Operation command name. |**Yes**|
| **Message** | string | Returns an error message, providing detailed description when `RetCode` is non-zero. |No|
| **RuleCnt** | int | Data entries that meet the requirements |**Yes**|
| **RuleInfo** | array[[*BGPFwdRule*](#bgpfwdrule)] | Forwarding Rule Information |**Yes**|
| **AvailLoad** | int | The number of rules that can be added under load mode (this parameter is returned only when queried by IP) |No|
| **AvailNonload** | int | The number of rules that can be added in non-load mode (this parameter is returned only when queried by IP) |No|
| **IpRuleExist** | boolean | Does the current configuration rules contain IP rules (This parameter is returned only when queried by IP)? |No|

#### Data Model


#### BGPFwdRule

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **BgpIP** | string | The IP corresponding to the forwarding rule's BGP high defense |No|
| **RuleID** | string | ID of the forwarding rule |No|
| **CreateTime** | int | Creation time, unix format |No|
| **UpdateTime** | int | Update time, unix format |No|
| **BgpIPPort** | int | The default is 0, which is the forwarding port for the IP protocol. The rest can be customized within the range of 0\~65535, but the rule ports configured under the same IP cannot be duplicated. |No|
| **LoadBalance** | string | Whether the type of forwarding protocol is load balancing: Default is "No", you can also choose "Yes". Up to 2 rules can be added for load balancing mode, and up to 8 rules can be added for non-load balancing mode. |No|
| **SourceDetect** | int | Indicates the detection of the source station: The default is 0 which means it's closed, you can also choose 1 to turn it on. |No|
| **BackupIP** | string | Backup source station's IP |No|
| **BackupPort** | int | Backup source site port |No|
| **SourceInfo** | [*FwdSourceInfo*](#fwdsourceinfo) | Source Station Information Structure |No|
| **ClientProxyInfo** | [*FwdClientProxyInfo*](#fwdclientproxyinfo) | Back-to-source IP structure |No|
| **RuleIndex** | int | Database index value of the generated rule |No|
| **Status** | string | Status of the Rule |No|
| **FwdType** | string | The type of forwarding for the configured rules |No|
| **Remark** | string | Note |No|

#### FwdSourceInfo

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Type** | string | Back-to-source Type, divided into IP and Domain |No|
| **Conf** | array[[*FwdSourceInfoConf*](#fwdsourceinfoconf)] | Origin Configuration List |No|

#### FwdClientProxyInfo

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Count** | int | Number of Back-to-source IPs |No|
| **IPList** | array[string] | Back-to-source IP List |No|

#### FwdSourceInfoConf

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Source** | string | Source station, compatible with IP and domain name |No|
| **Port** | int | Source Port |No|
| **Toa** | int | SourceToa |No|
| **IPList** | array[string] | Source IP List |No|

## Example

### Request Example
    
```
https://api.ckcloudai.com/?Action=GetBGPServiceFwdRule
&ResourceId="3327ebd4-5d8a-4aac-b1dc-31bbe20cd7d7"
&Offset=0
&Limit=10
&BgpIP="10.5.12.3"
&RuleIndex= 9759
```

### Response Example
    
```json
{
  "Action": "GetBGPServiceFwdRuleResponse",
  "AvailLoad": 9,
  "AvailNonload": 49,
  "IpRuleExist": true,
  "RetCode": 0,
  "RuleCnt": 1,
  "RuleInfo": [
    {
      "BackupIP": "",
      "BackupPort": 0,
      "BgpIP": "10.5.12.3",
      "BgpIPPort": 0,
      "ClientProxyCount": 12,
      "ClientProxyIPList": "5.5.5.5,6.6.6.6,",
      "ClientProxyInfo": {
        "Count": 12,
        "IPList": [
          "5.5.5.5",
          "6.6.6.6"
        ]
      },
      "CreateTime": 1663828045,
      "FwdType": "IP",
      "LoadBalance": "Yes",
      "Remark": "",
      "RuleID": "ruleid-b639-464b-80d6-10.5.12.3",
      "RuleIndex": 9759,
      "SourceDetect": 0,
      "SourceIPInfo": "1.1.1.1,2.2.2.2",
      "SourceInfo": {
        "Conf": [
          {
            "IPList": [
              "1.1.1.1"
            ],
            "Port": 0,
            "Source": "1.1.1.1",
            "Toa": 200
          },
          {
            "IPList": [
              "2.2.2.2"
            ],
            "Port": 0,
            "Source": "2.2.2.2",
            "Toa": 200
          }
        ],
        "Type": "IP"
      },
      "SourcePort": "0,0",
      "Status": "Success",
      "ToaID": "200",
      "UpdateTime": 1663828047
    }
  ]
}
```





