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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Windchill Rest API

Darquise
11-Garnet

Windchill Rest API

Hi,

I am new to using Windchill REST API, therefore, I'm just playing around for now.

But I would like to know how to GET all the xml documents from a specific folder. How can I do this?

I tried the following:

eg.

GET /DynamicDocuments

$filter @odata.type eq #PTC.DynamicDocMgmt.DynamicDocument

Error:

"message": "The system query option '$filter' has the not-allowed value '@odata.type eq #PTC.DynamicDocMgmt.DynamicDocument'."

7 REPLIES 7
Fadel
22-Sapphire I
(To:Darquise)

try this :

Fadel_0-1706784361147.png

 

Fadel_1-1706784424281.png

 

 

Fede
Darquise
11-Garnet
(To:Fadel)

It kinda worked. However, I just realized that our xmls and organized in sub folders. Hence why I trying to work with the type. E,.g downlaod all xml documents with a certain subtype of DynamicDocument. 

 

I scrolled down to our subtype in WRS, e.g. GET /DynamicDocuments/PTC.DynamicDocMgmt.Condition 

But all I get is metadata. How can I get the latest version of the full xml document?

Fadel
22-Sapphire I
(To:Darquise)

Can you share some screenshot , I don't follow you

Fede
Darquise
11-Garnet
(To:Fadel)

We have a folder within Products and then a bunch of sub-folders which contain the xml dita files. If I use the folder $filter would I have to use a filter for every sub-folder? If I use the type $filter, can it extract the full xml file based on the object type, e.g. Condition?

Essentially, I want all the xml files within the /ma_conditions folder, not just the metadata, we want the content.

 

Darquise_0-1707156398434.png

 

Fadel
22-Sapphire I
(To:Darquise)

you have to do it in 2 steps  :

1- Get the ID of dynamic documents within the given folder, not sure if this can be done using REST https://www.ptc.com/en/support/article/CS328649 

 

2- Get the content ,I'm using below :

https://PP-2112171334VE.portal.ptc.io:443/Windchill/servlet/odata/v5/DynamicDocMgmt/DynamicDocuments('OR%3Awt.epm.EPMDocument%3A5662935')/PrimaryContent

 Note this will return the url to XML not the content directly as xml 

Fadel_0-1707733362555.png

 

Fede
rleir
17-Peridot
(To:Fadel)

@Darquise 

Try something like ?$expand=Folders($levels=max) 

 

page 26 and 35 in https://www.ptc.com/support/-/media/support/refdocs/Windchill_REST_Services/2,-d-,5/wrs.pdf?sc_lang=en

(and search in this document for 'folder', it occurs many times here)

 then filter on folder name. 

?$filter=Folder/Name eq ''<name>"

 

I have not done this myself. Good luck!

Darquise
11-Garnet
(To:rleir)

Looks like we will try a different route. Perhaps content will be exported, uploaded to AWS and use API from AWS. I'm not a developer therefore I struggled getting the above suggestions to work. I'm sure they are all good options, but I don't know API 😞

Top Tags