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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Retrive Mashup (Url) based on its name

drieder
16-Pearl

Retrive Mashup (Url) based on its name

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

ACCEPTED SOLUTION

Accepted Solutions
mnarang
17-Peridot
(To:drieder)

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 

View solution in original post

4 REPLIES 4
mnarang
17-Peridot
(To:drieder)

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 

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?

mnarang
17-Peridot
(To:drieder)

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 .

Hello @mnarang,

 

thank you for your detailed explanation. I guess I have to use GET Requests in order to access the Mashup, right? How does the remaining URL look like then?

 

Is it 

 https://server:ip/Thingworx/Mashups/MashupName

or

https://server:ip/Thingworx/Mashups/MashupName?x-thingworx-session=true

 

and the Request Header probably

"appKey" : "appKeyValue" ?

 

Regards,

Dominik 

 

Edit: 

https://server:ip/Thingworx/Mashups/MashupName?x-thingworx-session=true

worked for me with the above header

Announcements


Top Tags