Description

The addTCPPortObject operation handles configuration related to TCPPortObject model. 
This API call is not allowed on the standby unit in an HA pair.

HTTP request

POST /api/fdm/v6/object/tcpports

Data Parameters

Parameter Required Type Description
name True string A mandatory unicode alphanumeric string containing a unique name for the Port Object, from 1 to 128 characters without spaces. The string cannot include HTML tag. The check for duplicates is performed with a case insensitive search.
description False string An optional unicode alphanumeric string containing a description of the Port Object, up to 200 characters. The string cannot include HTML tags
Field level constraints: length must be between 0 and 200 (inclusive). (Note: Additional constraints might exist)
isSystemDefined False boolean A Boolean value, TRUE or FALSE (the default). The TRUE value indicates that this object is a system defined object
port True string A mandatory string representing a port or a port range. Valid port numbers are 1 to 65535. To specify a port range, separate the numbers with a hyphen, for example, 22-45. The second port number must be larger than the first port number. The string can only include digits or the hyphen symbol.
Field level constraints: cannot be null, must be a valid port from 1 to 65535 or a valid port range. (Note: Additional constraints might exist)
type True string A UTF8 string, all letters lower-case, that represents the class-type. This corresponds to the class name.

Example

curl -X POST \
    --header "Accept: application/json" \
    --header "Authorization: Bearer ${ACCESS_TOKEN}" \
    --header "Content-Type: application/json" \
    -d '{
        "description": "string",
        "id": "string",
        "isSystemDefined": true,
        "name": "string",
        "port": "string",
        "type": "tcpportobject",
        "version": "string"
    }' \
    "https://${HOST}:${PORT}/api/fdm/v6/object/tcpports"
from bravado.requests_client import RequestsClient
from bravado.client import SwaggerClient


def get_client(host, token):
    http_client = RequestsClient()
    http_client.ssl_verify = False
    http_client.set_api_key(
        host,
        "Bearer {}".format(token),
        param_name="Authorization",
        param_in="header"
    )
    return SwaggerClient.from_url(
        "https://{}/apispec/ngfw.json".format(host),
        http_client=http_client,
        config={
            "validate_responses": False,
            "validate_swagger_spec": False
        }
    )


def add_tcp_port_object(client, body):
    return client.PortObject.addTCPPortObject(
        body=body
    ).response().result


if __name__ == "__main__":
    host = "ftd.example.com"
    token = "access_token"
    client = get_client(host, token)

    body = {'description': 'string',
 'isSystemDefined': True,
 'name': 'string',
 'port': 'string',
 'type': 'tcpportobject'}

    add_tcp_port_object(client, body)