Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Hello all,
I'm trying to work with the java api and I use the examples found on PTC_IntegrationsBuilderGuide_Integrity_11_2.pdf
IntegrationPointFactory integrationPointFactory = IntegrationPointFactory.getInstance();
try {
IntegrationPoint integrationPoint = integrationPointFactory.createIntegrationPoint(hostName, port, APIVersion.API_4_16);
Session session = integrationPoint.createNamedSession(null, null, userName, password);
CmdRunner cmdRunner = session.createCmdRunner();
Command cmd = new Command(Command.SI, "about");
Response response = cmdRunner.execute(cmd);
...
what is wrong in my test code ? Is the session correctly created ?
It is difficult to know without seeing the error message returned but there is another sample code block in knowledgebase article CS159760 which you could try.
There are some server-side properties which allow you to define a default API user and password. Found in the <IntegrityServer>\config\properties\is.properties file:
mksis.apiSession.defaultUser=MyUser
mksis.apiSession.defaultPassword=MyPassword
Setting the above values will allow API connections to be made without explicitly defining user credentials in your code. This must be a valid user within Integrity and have the appropriate permissions for the operations you will be doing with your code. Note that making changes to the is.properties file requires an Integrity Server service restart before they are recognized.
I found a solution to connect using the default user/password defined in the ILM Client Preferences.
Just execute command si connect...