• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get host MAC via REST API inside container
#1
Hi all,

we need the MAC address of the host system inside a container on the Hilscher netPI.
For me it seemed to be a suitable solution to get the LAN settings, and also the MAC, from the Hilscher REST API.

As described in this thread, we first logged in with the admin user to get the authentication cookie.

Code:
curl -L -k -X POST 'https://<HOST-IP>/login' -H 'Content-Type: application/json' -d '{"username":"admin","password":"<PASSWORD>"}'


With the authentication cookie we are able to get various information from the API. The following requests all worked.
Code:
curl -L -k -X GET 'htps://<HOST-IP>/?page=infocenter' -H 'Cookie: <COOKIE>'

Code:
curl -L -k -X GET 'htps://<HOST-IP>/get/devicestatus/getCPUStatus' -H 'Cookie: <COOKIE>'

Code:
curl -L -k -X POST 'https://<HOST-IP>/system' --header 'Cookie: <COOKIE>; Content-Type: application/x-www-form-urlencoded' -d "argument=reboot"


But the request to get the LAN settings always responds the following:
Code:
{"status":"Failed","message":"Permission denied"}


Here's the request as we tried:
Code:
curl -L -k -X GET 'htps://<HOST-IP>/get/networksettings/lansettings' -H 'Cookie: <COOKIE>'

The admin user has all read & write rights in the application, also for the REST API.


Can anyone imagine what we are doing wrong here?

Is this a good way to get the MAC-address of the host system or is there a better solution?

Many thanks in advance.

Best regards
Benjamin
  Reply


Messages In This Thread
Get host MAC via REST API inside container - by bschandra - October-14th-2020, 01:30 PM
RE: Get host MAC via REST API inside container - by bschandra - November-16th-2020, 09:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  REST API server data communication MGharat 2 2,442 July-21st-2021, 07:01 AM
Last Post: MGharat
  TOSILOCK for CONTAINER COswald 3 2,184 July-13th-2021, 11:32 AM
Last Post: Armin@netPI
  Accessing netPI web UI with REST API Armin@netPI 14 7,741 June-30th-2021, 05:06 AM
Last Post: Armin@netPI
  Access to RTC from my own container application tad 1 3,525 March-19th-2021, 02:58 PM
Last Post: Armin@netPI
  [SOLVED] Starting services/commands/scripts at startup of a container Jonas.Sellmann@outlook.de 9 6,046 March-9th-2021, 08:47 AM
Last Post: WalterSchaefer
  OpenVPN container Armin@netPI 0 1,616 January-3rd-2021, 12:13 PM
Last Post: Armin@netPI
  operating Console of a container on netPI connected to Wi-Fi tethering tad 3 2,612 December-3rd-2020, 12:32 PM
Last Post: tad
  NIOT-E-NPIX-4DI4DO with netpi-netx container WalterSchaefer 3 6,486 November-25th-2020, 01:06 PM
Last Post: zen89
  NPIX-4DI4DO and NetPi-Nodered container issues alhammi 4 7,593 November-16th-2020, 01:35 PM
Last Post: alhammi
  Exporting and importing container images Armin@netPI 3 3,067 May-20th-2020, 11:24 AM
Last Post: COswald

Forum Jump:


Users browsing this thread: 1 Guest(s)