TRB143 API not working

Hi there,

does the API für the TRB143 work?

I send a http-request from node red. But I only get back a html-string.
The request to get the token works.

Is there maybe something wrong?

In the picture you can see my request an the response.

Thank you for help.

Hello,

I’m not very familiar with Node-RED, but in order to use API, you need to ensure that you are running RutOS 07.06 or greater. In order to make the API call to get the device status, you first need to authenticate to the device by making a POST call to /api/login:

{
    "method": "POST",
    "url": "/api/login",
    "headers": {
        "Content-Type": "application/json"
    },
    "body": {
        "data": {
            "username": "admin",
            "password": "admin"
        }
    }
}

Make sure JSON headers are included. The device will return a token, which can be used to make further calls. Keep in mind, that the token will expire if not used for 300 seconds.
Then to get the device status information, you can make a GET call to /api/system/device/status with the following lines included in the header:

"Content-Type: application/json"
"Authorization: Bearer <SESSION_TOKEN>"

Replace <SESSION_TOKEN> with the token received from the login request.
All of this, and a lot more information (including endpoints, response templates, explanations, examples and tutorials) can be found here:
https://developers.teltonika-networks.com/
It must also be noted, that the both documentation and API are still in development and will be updated frequently, thus use it with caution.

Hope this helps!

Best regards,

Tanks for your help.

In the request-url i forgot the “/api”. Now it works perfectly.

Sorry :laughing:

Glad to hear that!

Best regards,

This topic was automatically closed after 15 days. New replies are no longer allowed.