Skip to main content
Aug 4, 2017 11:01 AM UTC
Solved

How to mange HTTPS calls from device

Hi,

I have one device that can make HTTP GET and POST to a server, but i dont know how to get this information into Thingworx 7.4.

For example, the package sent by device is like this (from network monitor tool): GET https://servername/push.aspx?id=e89b06c4.


​Questions is: how i get that id parameter (or whatever string comes after the "?") into a string property on my thing?

smayerAnswer
1-Visitor
Jan 22, 2018 2:43 PM UTC

Hi Konrad

You could create a service which gets the id from the Https request. Once you have stripped this you can then put this on to your Thing string id property.


In this example I am using regex:


var httpsRequest = " https://servername/push.aspx?id=e89b06c4";

var myRegexp = /(id=)(.*)/g;

var match = myRegexp.exec(httpsRequest);

me.ID = match[2];

5 replies

5-Regular Member
Aug 4, 2017 6:40 PM UTC

Hello, Konrad.

For communication using https you'd need to have SSL set up on both the client and the server. Is your device set up to handle this?

-- Craig A.

Translate
Aug 7, 2017 6:56 AM UTC

Hi Craig,

I expect so yes.

Anyway, for initial testing, http is enough, but I dont know how to get started.

Thanks,

Konrad

Translate
Aug 8, 2017 8:16 AM UTC

Any recommendations?

Translate
smayer1-VisitorAnswer
1-Visitor
Jan 22, 2018 2:43 PM UTC

Hi Konrad

You could create a service which gets the id from the Https request. Once you have stripped this you can then put this on to your Thing string id property.


In this example I am using regex:


var httpsRequest = " https://servername/push.aspx?id=e89b06c4";

var myRegexp = /(id=)(.*)/g;

var match = myRegexp.exec(httpsRequest);

me.ID = match[2];

Translate
Jan 22, 2018 2:48 PM UTC

Hi Sean,

Thanks for the example, i will try it!

Translate