VMware Networking Community
rajala
Contributor
Contributor

NSX-T 2.4 API https://nsxtmgr/api/v1/transport-zones?included_fields=transport_type is not returning response with the fields given in the included_fields but returning all the fields

Hi

The response returned by nsx-t mgr for API request "https://nsxtmgr/api/v1/transport-zones?included_fields=transport_type " is below, but the expected response is the result with only the transport_type field. I'm doing anything wrong in the API request. Any help regarding this would be of great help.

{

    "results": [

        {

            "transport_type": "VLAN",

            "host_switch_name": "T0UplinkTZ",

            "host_switch_id": "79892d16-3d8e-4870-9053-f102b6437ced",

            "transport_zone_profile_ids": [

                {

                    "resource_type": "BfdHealthMonitoringProfile",

                    "profile_id": "52035bb3-ab02-4a08-9884-18631312e50a"

                }

            ],

            "host_switch_mode": "STANDARD",

            "nested_nsx": false,

            "is_default": false,

            "resource_type": "TransportZone",

            "id": "480be7ab-143b-477a-9622-07b76da235dc",

            "display_name": "T0UplinkTZ",

            "_create_user": "admin",

            "_create_time": 1558149399089,

            "_last_modified_user": "admin",

            "_last_modified_time": 1558149399089,

            "_system_owned": false,

            "_protection": "NOT_PROTECTED",

            "_revision": 0,

            "_schema": "/v1/schema/TransportZone"

        },

        {

            "transport_type": "VLAN",

            "host_switch_name": "buildservers",

            "host_switch_id": "df3a3520-de9f-4d6c-b32c-3860b7eae525",

            "transport_zone_profile_ids": [

                {

                    "resource_type": "BfdHealthMonitoringProfile",

                    "profile_id": "52035bb3-ab02-4a08-9884-18631312e50a"

                }

            ],

            "host_switch_mode": "STANDARD",

            "nested_nsx": false,

            "is_default": false,

            "resource_type": "TransportZone",

            "id": "88457d0c-02b8-46b4-8435-aec52fc490de",

            "display_name": "VLANTZ",

            "_create_user": "admin",

            "_create_time": 1557533712561,

            "_last_modified_user": "admin",

            "_last_modified_time": 1557533712561,

            "_system_owned": false,

            "_protection": "NOT_PROTECTED",

            "_revision": 0,

            "_schema": "/v1/schema/TransportZone"

        },

        {

            "transport_type": "OVERLAY",

            "host_switch_name": "buildservers",

            "host_switch_id": "df3a3520-de9f-4d6c-b32c-3860b7eae525",

            "transport_zone_profile_ids": [

                {

                    "resource_type": "BfdHealthMonitoringProfile",

                    "profile_id": "52035bb3-ab02-4a08-9884-18631312e50a"

                }

            ],

            "host_switch_mode": "STANDARD",

            "nested_nsx": false,

            "is_default": false,

            "resource_type": "TransportZone",

            "id": "d9cec7ce-7f4e-448a-b445-f3b3244e9822",

            "display_name": "buildservers",

            "_create_user": "admin",

            "_create_time": 1557361221147,

            "_last_modified_user": "admin",

            "_last_modified_time": 1557361221147,

            "_system_owned": false,

            "_protection": "NOT_PROTECTED",

            "_revision": 0,

            "_schema": "/v1/schema/TransportZone"

        }

    ],

    "result_count": 3,

    "sort_by": "display_name",

    "sort_ascending": true

}

Thanks

Mahi

Reply
0 Kudos
7 Replies
daphnissov
Immortal
Immortal

That parameter doesn't seem to work for me either. If you want to filter on transport zones of a given type, you can just include the filter transport_zone=<type>

GET https://FQDN/api/v1/transport-zones?transport_type=OVERLAY

{

  "results" : [ {

    "transport_type" : "OVERLAY",

    "host_switch_name" : "CZ-N-VDS",

    "host_switch_id" : "6e00c8f7-f227-4689-b443-fffa23451664",

    "transport_zone_profile_ids" : [ {

      "resource_type" : "BfdHealthMonitoringProfile",

      "profile_id" : "52035bb3-ab02-4a08-9884-18631312e50a"

    } ],

    "host_switch_mode" : "STANDARD",

    "nested_nsx" : false,

    "is_default" : false,

    "resource_type" : "TransportZone",

    "id" : "e93980e2-c36c-45a7-942e-d2be05b2bb62",

    "display_name" : "TZ-Overlay",

    "description" : "",

    "tags" : [ ],

    "_create_user" : "admin",

    "_create_time" : 1556489993723,

    "_last_modified_user" : "admin",

    "_last_modified_time" : 1556489993723,

    "_system_owned" : false,

    "_protection" : "NOT_PROTECTED",

    "_revision" : 0,

    "_schema" : "/v1/schema/TransportZone"

  } ],

  "result_count" : 1,

  "sort_by" : "display_name",

  "sort_ascending" : true

Reply
0 Kudos
rajala
Contributor
Contributor

Thank you. My requirement is filtering out fields my application is not interested in, and not filtering the results based on the transport_type.

Thanks

Mahi

Reply
0 Kudos
daphnissov
Immortal
Immortal

A workaround would be to just have your application parse the keys you want and extract their value. Disregard the rest. Since these are transport zones, it's unlikely the GET call will return a huge number of results.

Reply
0 Kudos
rajala
Contributor
Contributor

I gave transport-zone as an example. I want to filter out fields in transport nodes, logical-switches, logical-ports, e.t.c that returns many results

Thanks

Mahi

Reply
0 Kudos
daphnissov
Immortal
Immortal

You may need to open a support case and get them to investigate. It also doesn't seem to return the filter results in 2.4.1 which was just released Tuesday. Seems like it must be a bug.

Reply
0 Kudos
mrprolin
Contributor
Contributor

Hi, I'm also currently having the same problem with security policies. Has anyone found a solution to this problem yet? Or is it just a bug that has yet to be fixed?

Reply
0 Kudos
daphnissov
Immortal
Immortal

Have you opened a support case?

Reply
0 Kudos