cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Get the current session id from the opened mashup

nikkolasep
12-Amethyst

Get the current session id from the opened mashup

Hi all,

 

I'm currently trying to trace down the usage from some mashups. The idea is to create a service that will be triggered by auto refresh every 60 secs containing (user, datetime, mashupname, current session id). Does anyone know how to obtain the current session id from the opened mashup (see the link below). Is there any session parameter that contains this?

 

e.g. https://thingworx-server/Thingworx/Runtime/index.html?mashup=Templatename&forceClose=true&__enableBMF=true&__fromNextGen=8587fe65-9d60-4cb0-bbcb-7d41a78d2169&features=#master=Mastertemplate&mashup=&forceClose=true&features=

 

ACCEPTED SOLUTION

Accepted Solutions
jensc
17-Peridot
(To:nikkolasep)

Hello,

 

You could use the "TW.location.href" function that is available in the Thingworx runtime (expression or validator).

This function gives you the entire URL, so you would have to write some code to get just the token.

 

The following gives some information around the runtime functions in Thingworx: PTC Help Center

 

Hope it helps.

 

Regards,

Jens

View solution in original post

5 REPLIES 5
jensc
17-Peridot
(To:nikkolasep)

Hello,

 

You could use the "TW.location.href" function that is available in the Thingworx runtime (expression or validator).

This function gives you the entire URL, so you would have to write some code to get just the token.

 

The following gives some information around the runtime functions in Thingworx: PTC Help Center

 

Hope it helps.

 

Regards,

Jens

nikkolasep
12-Amethyst
(To:jensc)

I tried to call the function via expression function but I don't get any value. What I did is I created a expression function and write the following:

output = TW.location.href; //Output as a String

I then bind it with a label

Do you know what is the cause of this error or is there another way to get the complete url? 

jensc
17-Peridot
(To:nikkolasep)

Hello,

 

Did you trigger the service in any way?

As an example, you can use the mashups "Loaded" event to trigger the service.

The "Auto Evaluate" doesn't work unless you have an input that changes.

 

Regards,

Jens

nikkolasep
12-Amethyst
(To:jensc)

Yes I'm already aware of it. I just found that the issue is with the extension that interrupts this process or value of TW

nikkolasep
12-Amethyst
(To:jensc)

Otherwise, if I tried to a plain thingworx server or sandbox, it works perfectly as you said and we expected. Thanks for the solution! 

Announcements


Top Tags