Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
MartinJS
New Contributor

FortiOS API - virtual-wan/member missing interface string

Fortinet made a change to their FortiOS API get /api/v2/monitor/virtual-wan/members call from version 7.4.* onwards which changed the response. We're making this call to a device running 7.4.8 (via the FortiManager proxy but hopefully that shouldn't make a difference) and the response we're getting is missing the Interface string.

{
"result": [
{
"data": [
{
"response": {
"build": 2795,
"http_method": "GET",
"name": "members",
"path": "virtual-wan",
"results": [
{
"link": "up",
"rx_bandwidth": 17698,
"rx_bytes": 10694535825,
"state_changed": 1753381417,
"tx_bandwidth": 19306,
"tx_bytes": 2152017150
},

The documentation has a little red asterisk next to Interface, but no mention why or what it means:

 

https://fndn.fortinet.net/index.php?/fortiapi/1-fortios/5140/1/virtual-wan/

 

Does anyone have any ideas how we can make the interface string appear please?

1 Solution
MartinJS

Sorry it took a while for the post to appear but meanwhile we've solved this:

Here is the explanation:

 

When we make calls to that endpoint we use a set of filter parameters to make the API only return the fields that we want (we try to be good API citizens and be as efficient as we can be making API calls). 

 

With the older FortiOS API, the interface name is part of the JSON structure, so we didn't specify we wanted 'interface' back as part of the response, eg:

 

We send this:

 

    "resource": "/api/v2/monitor/virtual-wan/members?format=link|rx_bandwidth|rx_bytes|state_changed|tx_bandwidth|tx_bytes",

 

 

..and we got back this:

 

    },

                                "VPN2": {

                                    "link": "up",

                                    "rx_bandwidth": 5760,

                                    "rx_bytes": 540113826,

                                    "session": 4,

                                    "state_changed": 1753254017,

                                    "tx_bandwidth": 20668,

                                    "tx_bytes": 1362208182

                                },

 

With the newer FortiOS version, the response has changed and the interface name has moved to the body of the response, because we weren't explicitly selecting 'interface' in our filter, we didn't get it back:

 

    {

                                    "link": "up",

                                    "rx_bandwidth": 8507,

                                    "rx_bytes": 10329308034,

                                    "state_changed": 1752487770,

                                    "tx_bandwidth": 3465,

                                    "tx_bytes": 4164459580

                                },

 

...specify 'interface' in the filter, and...:

 

    {

                                    "interface": "WAN1",

                                    "link": "up",

                                    "rx_bandwidth": 9394,

                                    "rx_bytes": 10329379660,

                                    "state_changed": 1752487770,

                                    "tx_bandwidth": 3767,

                                    "tx_bytes": 4164494145

                                },

 

What a pain...

View solution in original post

3 REPLIES 3
Anthony_E
Community Manager
Community Manager

Hello Martin,


Thank you for using the Community Forum. I will seek to get you an answer or help. We will reply to this thread with an update as soon as possible.


Thanks,

Anthony-Fortinet Community Team.
MartinJS

Sorry it took a while for the post to appear but meanwhile we've solved this:

Here is the explanation:

 

When we make calls to that endpoint we use a set of filter parameters to make the API only return the fields that we want (we try to be good API citizens and be as efficient as we can be making API calls). 

 

With the older FortiOS API, the interface name is part of the JSON structure, so we didn't specify we wanted 'interface' back as part of the response, eg:

 

We send this:

 

    "resource": "/api/v2/monitor/virtual-wan/members?format=link|rx_bandwidth|rx_bytes|state_changed|tx_bandwidth|tx_bytes",

 

 

..and we got back this:

 

    },

                                "VPN2": {

                                    "link": "up",

                                    "rx_bandwidth": 5760,

                                    "rx_bytes": 540113826,

                                    "session": 4,

                                    "state_changed": 1753254017,

                                    "tx_bandwidth": 20668,

                                    "tx_bytes": 1362208182

                                },

 

With the newer FortiOS version, the response has changed and the interface name has moved to the body of the response, because we weren't explicitly selecting 'interface' in our filter, we didn't get it back:

 

    {

                                    "link": "up",

                                    "rx_bandwidth": 8507,

                                    "rx_bytes": 10329308034,

                                    "state_changed": 1752487770,

                                    "tx_bandwidth": 3465,

                                    "tx_bytes": 4164459580

                                },

 

...specify 'interface' in the filter, and...:

 

    {

                                    "interface": "WAN1",

                                    "link": "up",

                                    "rx_bandwidth": 9394,

                                    "rx_bytes": 10329379660,

                                    "state_changed": 1752487770,

                                    "tx_bandwidth": 3767,

                                    "tx_bytes": 4164494145

                                },

 

What a pain...

Anthony_E
Community Manager
Community Manager

Thank you for sharing the solution Martin :)

Anthony-Fortinet Community Team.
Announcements
Check out our Community Chatter Blog! Click here to get involved
Labels
Top Kudoed Authors