How to get subfolders via the REST API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How to get subfolders via the REST API
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
That helped me get to the solution. Thanks Thiagarajan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Still looking into it, thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
