get representation from part
Hi so I'm working on this Thing that takes information from windchill, and puts it though a calculator to return times for the part. but is there anyway to use an O data connector or any feature to get a representation from windchill, there is the WRS partGetRepresentation but I do not know how to implement that into a service that can be called with a part Id or number, I currently am using getJSON to get the urls but that needs credentials in the code but is there a way to avoid having to log in each time by doing it another method that doesnt need to login.
var url = "XXXXXXXXXXXXXXXXXX/Windchill/servlet/odata/v7/ProdMgmt/Parts('" + input + "')/Representations";
var result;
try {
var response = Resources["ContentLoaderFunctions"].GetJSON({
url: url,
username: user,
password: pass,
timeout: 10
});
if (response.value && response.value.length > 0) {
var rep = response.value[0];
// Check for valid 2D/3D thumbnail URLs
if (rep.TwoDThumbnailURL && rep.TwoDThumbnailURL.URL) {
var imageURL = rep.TwoDThumbnailURL.URL;
logger.warn("2D image URL: " + imageURL);
try {
var imageResponse = Resources["ContentLoaderFunctions"].LoadImage({
url: imageURL,
username: user,
password: pass
});
result = imageResponse;
} catch (imgErr) {
logger.error("Image load failed: " + imgErr.message);
result = null;
}
} else {
logger.warn("No valid thumbnail URL found.");
result = null;
}
} else {
logger.warn("No representations found.");
result = null;
}
} catch (err) {
logger.error("Windchill fetch failed: " + err.message);
result = null;
}

