Skip to main content
1-Visitor
December 27, 2018
Question

How to get latest revision of a document using Rest API ?

  • December 27, 2018
  • 2 replies
  • 8852 views

Hello, 

I am using Windchill 11.1 M010.

I want to get latest revision of a document using Rest API.

 

I tried to use filter,

$filter : latestiteration eq '1',

 

but, this gives "Invalid expression".

 

Is there any way to get the latest revision of a document through Rest API?

 

 

2 replies

16-Pearl
December 27, 2018

I got this tip from one of my Windchill colleagues...

Can you try with

 

"Latest": true

 

instead of latestiteration : 1?

 

1-Visitor
December 27, 2018

Thanks,

but,

This also doesn't work. It says "Latest" is Invalid property

1-Visitor
December 28, 2018

Hello,

below I am sharing my Javascript code. In this code, I am passing typeID, and properties (attributes),  also in a $filter I am setting criteria, so there I want to set a filter to fetch only latest version documents.

 

var params = {
type: 'GET',
url: me.getRestUrl() + "/structure/objects",
queryParams: {
'$select': properties,

'$filter': "endswith(number ,'"+number+"') and state eq 'Released' ",

'navigationCriteria': navigationCriteria,
'typeId': selectedTypeId,

}
};
// result: JSON
var jsonResult = me.processJSONRequest(params);

 

 

 

 

I tried with,

$filter : "latestIteration eq '1'",

but this displays all the version of a document. eg. A.1 and B.1 and B.2

I only want to fetch the latest i.e B.2

 

12-Amethyst
June 7, 2019

This will give what you are looking for 

GET <windchill_server>:<port>/Windchill/servlet/odata/DocMgmt/Documents?$expand=Revisions
1-Visitor
June 17, 2019

hello Team,

Can you explain me how to use restful web service of windchill.

please let me know that initializing process to call restful web service of windchill.

Thank you in advance.

 

12-Amethyst
June 17, 2019

Try the REST Call/URL here in a browser or your favorite rest client like postman.