How to use the REST API inside Windchill?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How to use the REST API inside Windchill?
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?
- Labels:
-
API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
Please find "Windchill REST Services User's Guide" guide which may be useful for you in attachment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
