Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
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?
I got this tip from one of my Windchill colleagues...
Can you try with
"Latest": true
instead of latestiteration : 1?
Thanks,
but,
This also doesn't work. It says "Latest" is Invalid property
Could you please post the complete request here?
Including any headers for Post, that contain any additional parameters.
This might help in seeing if there's anything off in the request itself.
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
yes, but unfortunately I can't help you here.
Someone from the Windchill Customization team might - you might have to open a Support Case for this one.
ok, Thank you.
Hi shindemayur,
have you already a solution for this issue?
This will give what you are looking for
GET <windchill_server>:<port>/Windchill/servlet/odata/DocMgmt/Documents?$expand=Revisions
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.
Try the REST Call/URL here in a browser or your favorite rest client like postman.
Thanks amarsingh for help.
just beginner for windchill software.so please help me some few question for it.
1. <windchill_server>:<Port> : which server name write in it?
please can you explain me in deepth.?
Thank you in advance
GET <windchill_server>:<port>/Windchill/servlet/odata/DocMgmt/Documents?$expand=Revisions
Assuming you have access to a windchill server and that windchill is accessed as:
http://windchill.yourdomain.com:80/Windchill
you can access the below REST call with this URL
http://windchill.yourdomain.com:80/Windchill/servlet/odata/DocMgmt/Documents?$expand=Revisions
As the above REST call is a GET call you can try the above URL in a browser and you will get the response in xml format.
You want to try non GET operations like POST, DELETE, PATCH, etc, with more control over your REST request, use a REST client like Postman. With tools like Postman, you can get the REST response in JSON also by adding header
Content-Type: application/json
Thank you so much for quick answer.
just asking question because i m bignner for it
However i don't know how to access server of windchill.so please let me know briefly.
i have created trial account on winchill website.but i can't found any domain .
so please can you explain me initiate process for get server of ' http://windchill.yourdomain.com:80 ' .
http://windchill.yourdomain.com:80/Windchill
thank you in advance
Hello amarsingh
Can you provide direction for how to install on PTC cloud and where do i get windchill software for restful api ?
Thank you in advance