cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
52
Views
1
Helpful
2
Replies
Cisco Employee

REST API to get specific interface MAC?

 

Hi team,

 

    I’m trying to get specific interface MAC,I use this:http://10.79.44.247:8080/api/operational/devices/device/pe0/live-status/interfaces, and get this result:

 

    <collection xmlns:y="http://tail-f.com/ns/rest">

 

  <interfaces xmlns="urn:ios-stats">

 

    <type>GigabitEthernet</type>

 

    <name>1</name>

 

    <ip-address>10.79.44.146/24</ip-address>

 

    <mac-address>000c.29df.5079</mac-address>

 

  </interfaces>

 

  <interfaces xmlns="urn:ios-stats">

 

    <type>GigabitEthernet</type>

 

    <name>2</name>

 

    <ip-address>192.168.0.2/24</ip-address>

 

    <mac-address>000c.29df.5083</mac-address>

 

  </interfaces>

 

  <interfaces xmlns="urn:ios-stats">

 

    <type>GigabitEthernet</type>

 

    <name>3</name>

 

    <ip-address>100.0.0.1/24</ip-address>

 

    <mac-address>000c.29df.508d</mac-address>

 

  </interfaces>

 

</collection>

 

 

  But how can I get specific interface’s MAC via REST,saying interface GigabitEthernet 3,I’ve tried:

 

  1.http://10.79.44.247:8080/api/operational/devices/device/pe0/live-status/interfaces/GigabitEthernet/3

 

  2.http://10.79.44.247:8080/api/operational/devices/device/pe0/live-status/interfaces{GigabitEthernet%203}

 

  3.http://10.79.44.247:8080/api/operational/devices/device/pe0/live-status/interfaces/{GigabitEthernet+3}

 

  …

 

  Neither works

 

  Could you shed some light on this?

 

  Thanks!

 

 

             Yuanchao Su

 

Everyone's tags (4)
2 REPLIES 2
Highlighted
Cisco Employee

Re: REST API to get specific interface MAC?

 

Hi,

 

 

I suspect that you need the key:

 

  list interfaces {

 

    config false;

 

    key "type name";

 

 

 

Perhaps try:

 

…/interfaces/type,name

 

 

Thanks,

 

Bilal.

 

Highlighted
Cisco Employee

Re: REST API to get specific interface MAC?

 

it works

 

Thanks Bilal.

Yuanchao Su

 

This widget could not be displayed.