Welcome to our new portal experience - if you need any assistance or have questions, please click here.

/macs/ API endpoint

Modified on: Tue, 31 Mar, 2026 at 4:08 PM

The /macs/ endpoint is deprecated and should not be used any more, https://api.device42.com/#get-mac-address-with-id. In spite it has been replaced by /switchports/ endpoint we'd recommend to use DOQL API instead of REST calls for GET requests whenever possible. It is a bit more complex but works faster and more flexible. The following query can be used for getting every switch port a server is connected to by providing only a server name, same way as /macs/ endpoint does:

$ curl -s -k -X POST -d "query=select d.name,p.port,p.hwaddress,rd.name,rp.port,rp.hwaddress from view_netport_v1 as p left join view_netport_v1 as rp on p.remote_netport_fk=rp.netport_pk left join view_device_v1 as d on p.device_fk=d.device_pk left join view_device_v1 as rd on rp.device_fk=rd.device_pk where d.name='ADellServer' and p.remote_netport_fk is not null" -u 'u:p' 'https://d42_server/services/data/v1.0/query/'

You can find more information about DOQL queries here, https://docs.device42.com/device42-doql/

DOQL is also used on backend for our Advanced Reporting engine, https://www.device42.com/blog/2018/04/creating-advanced-reports-with-custom-sql/.