-->

how to define IP subnet's status using api

2019-09-10 03:07发布

问题:

I got subnet's detail information using api but i don't know how to decide status & description of subnet .

softlayer control's subnet detail / my page's subnet detail

回答1:

Try the following rest request:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Network_Subnet/$subnetId/getIpAddresses?objectMask=mask[guestNetworkComponentBinding]

Method: Get

Replace: $user, $apiKey and $subnetId with your own information

This is the logic for:

Status:

If the "guestNetworkComponentBinding" is not empty, the status is "In Use"

Description:

If the ""guestNetworkComponentBinding" is not empty, the description is "Primary IP"

References:

  • SoftLayer_Network_Subnet::getIpAddresses