Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
Version: Windchill 12.1
Use Case: I need to traverse the folder structure in a Windchill Library via the REST API's
Description:
I see there are a few relevant API's.
"/v6/DataAdmin/Containers('"+containerId+"')/Folders" provides us with a way to get the root folder, which I believe is pretty much always "/Default", but how do I get the list of folders in that folder, to recursively traverse the folder structure?
I see there is "/v6/DataAdmin/Containers('"+containerId+"')/Folders('"+folderId+"')" but that only gives me the information about the folder I already have the ID for and does not tell me what subfolders exist in that folder.
Solved! Go to Solution.
In order to get the subfolder in a given folder via the WRS REST API's, include the $expand parameter with a value of "Folders".
This causes the API to include a Folders objects as part of the JSON response and fills in each of the subfolders.
Search the PTC Support site for Windchill REST Services User Guide for more information on the expand parameter.
Hi,
You need to use the '$expand' param. You need to build the expand param based on the level of the folder structure.
Example:
In this case the folder path is "/default/MyFolder"
Thanks,
Thiagarajan
I am guessing you are right about the expand parameter, but what you suggested is not working for me. I get a URI is malformed error.
That helped me get to the solution. Thanks Thiagarajan.
Hi @AdamElkins,
I wanted to see if you got the help you needed.
If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Of course, if you have more to share on your issue, please pursue the conversation.
Thanks,
Anurag
Still looking into it, thanks.
In order to get the subfolder in a given folder via the WRS REST API's, include the $expand parameter with a value of "Folders".
This causes the API to include a Folders objects as part of the JSON response and fills in each of the subfolders.
Search the PTC Support site for Windchill REST Services User Guide for more information on the expand parameter.