Community discussions

MikroTik App
 
AThorp
just joined
Topic Author
Posts: 3
Joined: Thu Feb 13, 2020 12:19 am

REST API access to GPS data

Wed May 19, 2021 6:50 am

I have set up my LtAP Mini with a GPS and configured it so that I can query the router via the REST API in v7 of RouterOS.

I can access the GPS settings via cURL with:
curl -k -u admin: https://10.155.101.214/rest/system/gps

I would really like to be able to access the GPS data using this method, but don't seem to be able to. I've tried adding /method onto the end of the request string with no luck, and a bunch of other similar things.

Does anyone know what the command I'm looking for is? Ideally to return the GPS data as a JSON.
 
denissMT
MikroTik Support
MikroTik Support
Posts: 49
Joined: Wed May 26, 2021 12:00 pm

Re: REST API access to GPS data

Wed Jul 07, 2021 12:35 pm

You can use a command like this:
curl -k -u admin: -X POST https://ip_address/rest/system/gps/monitor --data '{"once":""}' -H "content-type: application/json"

HTTP GET will only return the data that is available using "print" command, like, for example, "ip address print". Since GPS uses "system gps monitor" command (and not "system gps print"), you need to use HTTP POST.

Who is online

Users browsing this forum: No registered users and 15 guests