Skip to main content
1-Visitor
June 4, 2018
Solved

Retrive Mashup (Url) based on its name

  • June 4, 2018
  • 4 replies
  • 2838 views

Hello everyone,

 

I want to use some Mashups in a WebView during Android development. The Mashup name will be a property from a thing.

 

Is it possible to access this mashup via a specific Url or Rest call which already does the login?

 

I am aware that https://<ThingworxServer:port>/Mashups/MashupName opens the Mashup, but a login popup shows up that I want to avoid. Note that the app already has an App Key available, could it maybe be used for that?

 

Something like https://Server:port/Login=Appkey/Mashups/MashupName ? Or a Sequence of Rest calls that achieve the same? I am open for other suggestions as well.

 

Anyway, thank you very much for your help.

 

Best Regards,

Dominik

Best answer by mnarang

Hello ,

 

Mashup can be accessed through app key that will not require a login prompt .The below article can help you on this -

 

https://www.ptc.com/en/support/article?n=CS227935

 

 

Thanks ,

Mukul Narang 

4 replies

mnarang5-Regular MemberAnswer
5-Regular Member
June 4, 2018

Hello ,

 

Mashup can be accessed through app key that will not require a login prompt .The below article can help you on this -

 

https://www.ptc.com/en/support/article?n=CS227935

 

 

Thanks ,

Mukul Narang 

drieder1-VisitorAuthor
1-Visitor
June 4, 2018

Hello @mnarang,

 

thank you, this works just like I wanted. But I read that this method is depricated because of security reasons and it is suggested to pass the app Key in the header instead.

 

I am not familiar with the usage of headers in Url requests, could you provide me an example how an Url with the app key in the header would look like?

 

Regards,

Dominik

 

Edit: my url looks like this 

 

https://server:port/Thingworx/Mashups/MashupName?appKey=appKeyValue&x-thingworx-session=true

 

does this already use the app key in the header by any chance?

5-Regular Member
June 4, 2018

Nope ,this is what you are passing the app key in URL directly .This is a security risk as the app key is exposed in the URL .So from Thingworx 8.0 onwards you can send app key in request header (request which is being sent to thingworx server) you can declare the app key in header element of the request(Request header of any GET/POST request that is sent for Thingworx Server) .But for this you need to switch this on this feature in Thingworx composer so that it can identify the app key which is sent in request header part .To on this feature in Thingworx you can go to System -> PlatformSubsystem .Under configuration tab of PlatformSubsytem you can see a setting under Platform Subsystem Setting with name Allow Application Key as URL Parameter .Just check that checkbox this will allow you to use the app key as url parameter .