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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

How to get subfolders via the REST API

AdamElkins
12-Amethyst

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.

ACCEPTED SOLUTION

Accepted Solutions

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".

AdamElkins_0-1736542894787.png

This causes the API to include a Folders objects as part of the JSON response and fills in each of the subfolders.

AdamElkins_1-1736542942031.png

Search the PTC Support site for Windchill REST Services User Guide for more information on the expand parameter.

 

View solution in original post

6 REPLIES 6
tm-4
12-Amethyst
(To:AdamElkins)

Hi,

You need to use the '$expand' param. You need to build the expand param based on the level of the folder structure. 

Example:

tm4_0-1732660962012.png

In this case the folder path is "/default/MyFolder"

 

Thanks,

Thiagarajan

 

 

AdamElkins
12-Amethyst
(To:tm-4)

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.

AdamElkins
12-Amethyst
(To:tm-4)

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".

AdamElkins_0-1736542894787.png

This causes the API to include a Folders objects as part of the JSON response and fills in each of the subfolders.

AdamElkins_1-1736542942031.png

Search the PTC Support site for Windchill REST Services User Guide for more information on the expand parameter.

 

Announcements

Top Tags