FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

12731 questions

15120 answers

24266 comments

47321 members

0 votes
455 views 9 comments
by

Hi,

I can read Modbus TCP data with RUT240, OK.

I'd like to upload the data to our cloud server. Server requires basic auth (username/password). Data JSON template is ok, but how to include login information?

I have instructions made for CURL, if this may help?

curl -X POST --user user123:password123\

-H "Content-Type:application/json" \

-d '{"name":"data1",

value":"1"}]

}' \

"https://{server-url}/devices"

Last line can be input into URL field, but cannot get it work with authentication.. And can this feature be used with POST action at all?

1 Answer

0 votes
by

Hello, 

Regarding this query of yours could you try using the tab name custom header?? 


You can find more information on this link: https://wiki.teltonika-networks.com/view/RUT240_Modbus#Modbus_Data_to_Server

The server would be receiving this kind of POST message: 


Host: 192.168.1.178:4032
Accept: */*
curl -X POST --user user123:password123
Content-Length: 65
Content-Type: application/x-www-form-urlencoded

[{"TS": "1602485320", "D": "12/10/2020 10:48:40", "data": [410]}]



I hope it helps 

Regards,
Jerome
 

by

Thank you for your answer.

I'm not sure what to write into "custom headers"? That CURL command is for Linux command line, right? Based on my Google search, header for authentication would be something:

Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l

 But I cannot get any traffic into server.


2nd question:

- If I used MQTT for the same purpose, how can make authentication there? I have demo Broker running and it requires basic authentication also. But in MQTT version, there isn't any username/password fields available?

BR, Simo

by
Hello,

I have checked it with RUT9XX and RUTXXX series routers and the Use credentials for MQTT is available I will be checking with the team about the implementation of the said feature on RUT2XX series if it is under development or is there any plan of implementation of this one.

Once i receive answers from them i will let you know

Thank you and have a nice day!

Regads,
Jerome
by
Do you have more guidance for authentication? I didn't really get what to use for "custom headers" in my case.
by
Hello,

I am currently checking it with the team what solutions are available on the issue you are having currently waiting for reply on their side.

Regards,
Jerome
by

Hello,

I have received feedback from our HQ about the MQTT Credential option:

Try the attached TEST FW with MQTT Use Credentials option.
Please check if this specific function works properly now.
Since this is a TEST version of the Firmware, designed to address specific issues, use it only with a handful of devices; you should not use it for your whole fleet.
Once we receive positive feedback from you – these changes will be included into next Master Firmware release version.

 Firmware Link: https://we.tl/t-fZOiCJRhMR

Note: without final confirmation that the issue has been resolved these changes will not be included into Master Firmware version, hence shall not be included from the Factory.

I will be waiting feedback from your side. 

Thank you and have a nice day!

Regards,
Jerome

by

Hi!

This firmware works! I can send data via MQTT to my flespi.io MQTT broker.


Could you give more info about HTTPS custom headers? I need to add:

  • Authentication (basic / base64)
    • Content-Type:application/json
  • Content type
    • Authorization:Basic xxxxxxxxxxxxxxxxxxxxxxxxxxx

I tried as shown in the picture, but no traffic is generated to our servers. 

by

Hello,

Could you try adding only 1 custom header and test if you are able to authenticate the router to send the data to your http server?

So if clients username and password is: user123:password123 client need to convert it to base64 ->
https://cryptii.com/pipes/text-to-base64 and use that in MODBUS Data to Server.

In base64 it would be: dXNlcjEyMzpwYXNzd29yZDEyMw==
In custom header write: Authentication: Basic dXNlcjEyMzpwYXNzd29yZDEyMw==


Hope it helps

Regards,
Jerome

by

I got it working, thank you!

All HTTP customer header must be like this, without quotes. Authentication (username:pass) can be used also, Base64 encoded Authorization:Basic xxxxxxxxxxxxxxxxxxxxxxx Content-Type:application/json "host" header is not needed, system generates it automatically from Host URL. I tested with RTU240 internal values via Modbus. JSON format was like this: {"name":"%s","v":%a} %a value works without quotes " " and outputs plain number. If you add quotes, the values will be like [value] / Simo

by

Hello,

It's nice to hear that it you made it working. smiley

Thank you and have a nice day!

Regards,
Jerome