Skip to main content
6-Contributor
February 23, 2022
Question

Using REST API to get a list of all WTParts

  • February 23, 2022
  • 1 reply
  • 3743 views

Is there a way to use the rest api to get a list of all wtparts and their attributes?

1 reply

16-Pearl
February 28, 2022

Hi @PhilK 

 

You can get parts and their attributes but there does seem to be a limit for how many parts in a single query.

 

I can get 140,000 parts with query for a part Numbers containing 'M', but if I make the criteria and broader I get an error, so suspecting the limit is 200,000.

 

https://<mywindchillhost>/Windchill/servlet/odata/v5/ProdMgmt/Parts?$filter=contains(Number%2C'M')&$count=false

 

10-Marble
March 14, 2023

Hi,

 

Yes this is a silly problem that we're also struggling with.

 

So ther requirement is to give Windchill a list of part number and then it needs to bring properties back of all the WTparts that was listed


Tried it via a saved Search Query endpoints supplying part number via KeyWord parameter but for some reasons it omits some parts in the response so doing it via SavedSearch End Point does not work correct. If I run the exact save query in Windchill Front end I get correct list:

 

https://<Wchillhost>/Windchill/servlet/odata/v4/SavedSearch/SavedQueries('OR%3Awt.query.SavedQuery%3A1294983587')/PTC.SavedSearch.ExecuteSavedSearch(Keyword='BN064295%3BBN064517_01%3BBN067254%3BBN067255%3BBN067521%3BBN067521-01%3BBN067521-02%3BBN067521-04%3BBN067521-04001%3BBN067794%3BBN067796%3BBN067797%3BBN067797-01%3BBN067797-02%3BBN067797-03%3BBN067797-04%3BBN067799%3BBN067799-01%3BBN067831%3BBN067833%3BBN067837%3BBN067840%3BBN067842%3BBN067848')


Is it possible to get WTParts out of Windchill with Rest API specifiying the list of WT parts?

17-Peridot
March 14, 2023

You can use a QB parameter and pass in a part number, then QB can report the attributes that you need. Use a python script to call this QB report repeatedly, once per part. 

The python script is not difficult, but I don't have time at the moment to give the details.