Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hello.
I am writing java code in Windchill, one of the parts of the code is getting a representation.
The REST API has a method for getting representation.
How do I use the REST API? How do I get user credentials to send requests?
Hi,
Please find "Windchill REST Services User's Guide" guide which may be useful for you in attachment.
Hello @VladiSlav
If you use Java code in a Windchill, why do you want to use the RestAPI ?
I would use a standard api to get visualization(representation)
Representation defaultRep = RepresentationHelper.service.getDefaultRepresentation(epm);
or
Representation defaultRep = RepresentationHelper.service.getRepresentations(epm);
epm can be object that have representation (EPMDocument, WTPart, WTDocument, MPMOperation atc.)
I know it is not answer to your question but I would recommend to use it.
PetrH
HelesicPetr, thank you very much for your answer, this is what you need. But we still want to learn how to use the REST API, and for this we need to get the login and password of the active user?
Hi @VladiSlav
Actually I don't have so much experience with the RestAPI but as I know, you can not retrieve password from LDAP.
You can get just login name with
WTPrincipal currentuser = SessionHelper.getPrincipal();
if (currentuser instanceof WTUser)
{
WTUser user = (WTUser) currentuser;
String loginName = user.getAuthenticationName();
}
PetrH
I would like to just add generally If I needed to use RESTAPI I usually use static user and password which I use to call restAPI. So I didn't need to retrieve password.
PetrH