Skip to main content
11-Garnet
July 25, 2019
Solved

RESTFul get representation URL

  • July 25, 2019
  • 1 reply
  • 8191 views

Hello,

well I have a problem that I cannot solve and I need help or guidance how to solve it. I am trying to get EPMDocument's (Creo part) visual representation (a .pvs file) using RESTFul query. Here is my query (for testing purposes we are using Swagger):

GET --header 'Accept: application/json' 'http://<wct-server>:<port>/Windchill/servlet/rest/visualization/objects/OR:wt.epm.EPMDocument:147522537'

on our windchill installations (I am using WcT 11.0 M030 CPS13) the result looks like:

{
 "id": "...",
 "attributes": {
 "representations": [
 {
 "id": "OR:wt.viewmarkup.DerivedImage:....",
 "attributes": {
 "default": true,
 "launchCreoView": "http://<Wct-server>:<port>/Windchill/wtcore/jsp/wvs/edrview.jsp?objref=OR%3Awt.viewmarkup.DerivedImage%3A422931&url=http%3A%2F%2Fhades.fsb.hr%3A90%2FWindchill%2Fservlet%2FWindchillAuthGW%2Fcom.ptc.wvs.server.util.WVSContentHelper%2FredirectDownload%2Fcad-0000001809_prt.pvs%3FContentHolder%3Dwt.viewmarkup.DerivedImage%253A422931%26HttpOperationItem%3Dwt.content.ApplicationData%253A422958%26u8%3D1&u8=1&forceuseplugin=true",
"threedthumbnail": ...
}

but on the client's installation (they are using WcT 11.0 M020) the "launchCreoView" string looks like:

"launchCreoView": "creoview://?wcparams=eyJhdHRyaWJ1dGVzIjp7InVybGJhc2UiOiJodHRwOi8vaHJ6YWdqMTMyYS53Yy5sb2NhbDo4MDgwL1dpbmRjaGlsbCIsInNlc3Npb25pZCI6InVKRVBqbzc0TS1xNlNzMGhxdEdIanZIbXpZUS4xdGgiLCJ1c2VyaWQiOiJocjJ1MDA0OSJ9LCJpZCI6ImN2In0="

 

It is noticeable that clients URL starts with creoview:// and ours starts with httpd:// 

And this is a problem, we were unable to figure out why URLs are different. We raise a call at the PTC support, but they don't know the answer (3 months past since).

So I am asking this community does anybody has any idea what to do and how to change this behavior.

Thank you!

Nenad

 

Best answer by fivig

Hello,

 

to get a list of related representations use the query:

 

http://wnc_host/Windchill/servlet/odata/v1/CADDocumentMgmt/CADDocuments('VR%3Awt.epm.EPMDocument%3A87859')/Representations

 

Responce will have url to pvt

 

"ThreeDThumbnailURL": {
"URL": "http://wnc_host/Windchill/servlet/WindchillAuthGW/com.ptc.wvs.server.util.WVSContentHelper/redirectDownload/01-72530_prt.pvt?ContentHolder=wt.viewmarkup.DerivedImage%3A106120&HttpOperationItem=wt.content.ApplicationData%3A106132&u8=1",
"Label": "01-72530_prt.pvt",
"FileSize": "8074",
"MimeType": "x-unknown/x-unknown",
"Format": "Unknown",
"ID": "OR:wt.content.ApplicationData:106132",
"FileName": "01-72530_prt.pvt",
"LastModified": "2019-05-10 07:10:28.0",
"CreatedOn": "2019-05-10 07:10:28.0",
"Description": null,
"Comments": null
}

 

You have to parse this JSON and use URL property value to download pvt.

If you want to have service in Windchill which will return e.g latest related pvt, you have to programing custom rest service or servlet or JSP (which will parse JSON and redirect to the endpoint URL).

1 reply

fivig5-Regular MemberAnswer
5-Regular Member
July 30, 2019

Hello,

 

to get a list of related representations use the query:

 

http://wnc_host/Windchill/servlet/odata/v1/CADDocumentMgmt/CADDocuments('VR%3Awt.epm.EPMDocument%3A87859')/Representations

 

Responce will have url to pvt

 

"ThreeDThumbnailURL": {
"URL": "http://wnc_host/Windchill/servlet/WindchillAuthGW/com.ptc.wvs.server.util.WVSContentHelper/redirectDownload/01-72530_prt.pvt?ContentHolder=wt.viewmarkup.DerivedImage%3A106120&HttpOperationItem=wt.content.ApplicationData%3A106132&u8=1",
"Label": "01-72530_prt.pvt",
"FileSize": "8074",
"MimeType": "x-unknown/x-unknown",
"Format": "Unknown",
"ID": "OR:wt.content.ApplicationData:106132",
"FileName": "01-72530_prt.pvt",
"LastModified": "2019-05-10 07:10:28.0",
"CreatedOn": "2019-05-10 07:10:28.0",
"Description": null,
"Comments": null
}

 

You have to parse this JSON and use URL property value to download pvt.

If you want to have service in Windchill which will return e.g latest related pvt, you have to programing custom rest service or servlet or JSP (which will parse JSON and redirect to the endpoint URL).

nbojcetic11-GarnetAuthor
11-Garnet
August 1, 2019

Hi fivigg,

thank your for your answer. I did some testing and here is what I found. Using the suggested query on the EPMDocument has two possible outcome. First is when you query representation of the EPMDocument (presumably that additional files are not created, like dxf, step, etc.) then the result is empty string:

QUERY: http://wnc_host//Windchill/servlet/odata/v1/CADDocumentMgmt/CADDocuments%28'OR:wt.epm.EPMDocument:426946'%29/Representations

RESULT: { "@odata.context": "http://wnc_host/Windchill/servlet/odata/v1/Visualization/$metadata#CADDocuments('OR:wt.epm.EPMDocument:426946')/Representations", "value": [] }

 

but when the EPMDocument has additional files created then result is different:

{ "@odata.context": "http://wnc_host/Windchill/servlet/odata/v1/Visualization/$metadata#CADDocuments('VR:wt.epm.EPMDocument:433400')/Representations",

"value": [ { "AdditionalFiles": [

{ "URL": "http://wnc_host/Windchill/servlet/WindchillAuthGW/com.ptc.windchill.enterprise.wvs.saveWVSObject.utils.SaveWVSObjectHelper/saveWVSObject/cad-0000001866_drw.plt?annotations=true&oid=OR%3Awt.content.ApplicationData%3A434427&fileType=plt&u8=1", "Label": "cad-0000001866_drw.plt", "FileSize": "19729", "MimeType": "x-unknown/x-unknown", "Format": "Unknown", "ID": "OR:wt.content.ApplicationData:434427", "FileName": "cad-0000001866_drw.plt", "LastModified": "2019-07-07 16:18:39.0", "CreatedOn": "2019-07-07 16:18:39.0", "Description": null, "Comments": null },

{ "URL": "http://wnc_host/Windchill/servlet/WindchillAuthGW/com.ptc.windchill.enterprise.wvs.saveWVSObject.utils.SaveWVSObjectHelper/saveWVSObject/dxf_cad-0000001866_drw.dxf?annotations=true&oid=OR%3Awt.content.ApplicationData%3A434442&fileType=dxf&u8=1", "Label": "dxf_cad-0000001866_drw.dxf", "FileSize": "25712", "MimeType": "image/vnd.dxf", "Format": "DXF", "ID": "OR:wt.content.ApplicationData:434442", "FileName": "dxf_cad-0000001866_drw.dxf", "LastModified": "2019-07-07 16:18:39.0", "CreatedOn": "2019-07-07 16:18:39.0", "Description": null, "Comments": null }, ...

 

for some reasons the pvs visualization type is not included in the list it is added as a separate object: "CreoViewURL": { "URL": "creoview://?wcparams=eyJhdHRyaWJ1dGVzIjp7InVybGJhc2UiOiJodHRwOi8vaGFkZXMuZnNiLmhyOjkwL1dpbmRjaGlsbCIsInNlc3Npb25pZCI6IkxVMkJuWjk1aG5jY3B1c1FzSWNITDd0SmdxWS41aWo1IiwidXNlcmlkIjoibmVzbyJ9LCJpZCI6ImN2In0=", "Label": "default" },

 

But I was able to get visualization only for EPMDocument - Drawing, for part or assembly result was an empty string. My problem is to retrieve a URL to part or assembly visualization (the .pvs file) but on different WcT installations i got different results:

on our server: "launchCreoView": "http://:/Windchill ..."

on the client server: "launchCreoView": "creoview://?wcparams=..."

and nobody knows why the URL is different and how to change it. Your suggestion to create my own servlet is the path that I am considering very seriously.

 

Best regards!

Nenad

1-Visitor
August 2, 2019

Hello,

 

You need to frame URL in below format.. Launching this URL will launch the default visualization in creo view.

https://<host>/Windchill/wtcore/jsp/wvs/edrview.jsp?url=https://<plm>/Windchill/servlet/WindchillAuthGW/com.ptc.wvs.server.ui.UIHelper/getPartStructureED&partid=OR:wt.part.WTPart:<oid>&levels=-1&partstructure=1

 

Thanks,

Shyam