Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Do you know why the count number retrieved in Navigate's Service is different from the count number retrieved in WRS?
When I created and ran the service in Navigate, I got odata.count: 35050.
But the result of the search in WRS was 34179.
When I logged the url accessed from Navigate and accessed it, it was 34179, so the numbers are different only on the Navigate screen.
Why is this difference in count results?
I am sorry if there are any errors in the text, as I am translating from Japanese.
Hi @沙竹_10532172
Could you please provide more details like endpoint of WRS and Thingworx Service used to fetch data from Windchill
/VR
Thanks for the reply.
This is the code for service.
I am running zuban with "*".
const selectAttribute = "ZUBAN%2CVersion%2CState%2CCreatedBy%2CCreatedOn%2CModifiedBy%2CLastModified%2CFolderLocation";
const commonURL = "servlet/odata/v4/DocMgmt/Documents?%24select="+selectAttribute;
var accessURL=commonURL+"&%24filter=ZUBAN%20eq%20''";
if(zuban!=null){
accessURL=commonURL+"&%24filter=ZUBAN"+encodeURIComponent(" eq '"+zuban+"'")+"&%24count=true" ;
if(zuban.length==1){
if(zuban=='*'){accessURL=commonURL+"&%24filter=ZUBAN%20eq%20''&%24count=true";}
}
if(zuban.length>1){
if(zuban=='**'){accessURL=commonURL+"&%24filter=ZUBAN%20eq%20''";}
if(zuban.slice(0,1)=='*' && zuban.slice(-1)=='*' && zuban.length>2){
accessURL=commonURL+"&%24filter=contains(ZUBAN,'" + zuban.substr(1, zuban.length-2) + "')"+"&%24count=true";}
if(zuban.slice(0,1)!='*' && zuban.slice(-1)=='*'){
accessURL=commonURL+"&%24filter=startswith(ZUBAN,'" + zuban.substr(0, zuban.length-1) + "')"+"&%24count=true";}
if(zuban.slice(0,1)=='*' && zuban.slice(-1)!='*'){
accessURL=commonURL+"&%24filter=endswith(ZUBAN,'" + zuban.substr(1) + "')"+"&%24count=true";}
}
}
var headerObject = new Object();
headerObject["Content-type"] = "application/json";
var header = JSON.stringify(headerObject);
var params = {
proxyScheme: undefined /* STRING */,
headers: header /* JSON */,
ignoreSSLErrors: undefined /* BOOLEAN */,
useNTLM: undefined /* BOOLEAN */,
workstation: undefined /* STRING */,
useProxy: undefined /* BOOLEAN */,
withCookies: undefined /* BOOLEAN */,
proxyHost: undefined /* STRING */,
url: me.WindchillUrl + accessURL,
timeout: 3600 /* NUMBER ,{"defaultValue":60}*/,
proxyPort: undefined /* INTEGER */,
password: me.WindchillUserPassword /* STRING */,
domain: undefined /* STRING */,
username: me.WindchillUserId /* STRING */
};
// response: JSON
var response = Resources["ContentLoaderFunctions"].GetJSON(params);
var result = response;
This is the RequestURL for WRS.
http://<host-name>/Windchill/servlet/odata/v2/CADDocumentMgmt/CADDocuments?%24select=ZUBAN%2CVersion%2CState%2CCreatedBy%2 CCreatedOn%2CModifiedBy%2CLastModified%2CFolderLocation&%24filter=ZUBAN%20eq%20''&%24count=true
Please help us.
Hi @沙竹_10532172
Are you using the same credentials for both Thingworx Rest Call & Windchill Rest Call?
I can see in Thingworx, you are using the fixed username and password to fetch data from the Windchill system.
/VR
You seem to be using two different endpoints:
Navigate uses "servlet/odata/v4/DocMgmt/Documents" your WRS endpoint is "servlet/odata/v2/CADDocumentMgmt/CADDocuments"
One endpoint is for WTDocuments, the other is for EPMDocuments.
Additionally the versions "v4" and "v2" can also be important.
It could be that a newer version has slightly different behaviour than an older version.