Description

Request URL

Network API v2.0

POST /v2.0/security-group-rules

Request Paramters

Parameter Value Style Description
X-Auth-Token User Token header
direction Ingress or egress plain
ethertype Must be IPv4 or IPv6 plain
security_group_id security_group ID plain
port_range_min (Optional) The minimum port number plain
port_range_max (Optional) The maximum port number plain
protocol (Optional) <tcp|udp|icmp|null> plain
remote_group_id (Optional) plain
remote_ip_prefix (Optional) plain

Request Json

{
    "security_group_rule": {
        "direction": "ingress",
        "ethertype": "IPv4",
        "security_group_id": "2b799530-dca1-4c59-8543-9e38d607a7f1"
        "port_range_min": "80",
        "port_range_max": "80",
        "protocol": "tcp",
    }
}

Normal response codes

201

Error response codes

When the same rule is already created for 409 port_range_max and port_range_min.

Example

curl -i -X POST \
-H "Accept: application/json" \
-H "X-Auth-Token: 0925897a3d4543218ff0dcd2bb378a8e" \
-d '{"security_group_rule": {"direction": "ingress", "ethertype": "IPv4", "security_group_id": "c8084620-075c-4932-bbc0-508908df56ca", "port_range_min": "80", "port_range_max": "80", "protocol": "tcp"}}' \
https://networking.tyo1.cloud.z.com/v2.0/security-group-rules
HTTP/1.1 201 Created
Server: openresty/1.7.10.1
Date: Fri, 08 May 2015 12:26:42 GMT
Content-Type: application/json
Content-Length: 320
Connection: keep-alive

{
  "security_group_rule": {
    "remote_group_id": null,
    "direction": "ingress",
    "remote_ip_prefix": null,
    "protocol": "tcp",
    "ethertype": "IPv4",
    "tenant_id": "22394afc818d471ca2f0308c06ae7460",
    "port_range_max": 80,
    "port_range_min": 80,
    "id": "11a7f5c8-e9d1-4353-923a-bc103a412ba6",
    "security_group_id": "c8084620-075c-4932-bbc0-508908df56ca"
  }
}