<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Consuming Rest in Plugin Project</title><link>https://answers.axonivy.com/questions/3834/consuming-rest-in-plugin-project</link><description>&lt;p&gt;Currently, I face the difficulties that there are some lacking libraries when I consuming rest API in Ivy plugin
I follow this instruction : &lt;a href="https://answers.axonivy.com/questions/2477/how-to-register-my-code-that-runs-on-every-engine-startup"&gt;https://answers.axonivy.com/questions/2477/how-to-register-my-code-that-runs-on-every-engine-startup&lt;/a&gt;
When user logs in, logs out or gets time-out, I want to call rest service to do some stuff:
&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/call_rest.png"&gt;&lt;/p&gt;
&lt;p&gt;But I get an error like this when calling rest service in the plugin: 
&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/error_FGhNT7s.png"&gt;&lt;/p&gt;
&lt;p&gt;Currently, I just add some dependencies like this picture into the plugin but it doesn't work
&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/hint.png"&gt;&lt;/p&gt;
&lt;p&gt;Do you have any hint or any suggestion for this problem?
Thanks in advance :)&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/3834/consuming-rest-in-plugin-project" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 11 Jun 2019 04:34:33 -0400</lastBuildDate><item><title>Comment by Reguel Wermelinger on Genzer Hawker's question</title><link>https://answers.axonivy.com/questions/3834/consuming-rest-in-plugin-project#3849</link><description>&lt;p&gt;not answering your question, but I'd wrap authorization header setup in a JAX-RS feature. Then you could enable it globally in the 'Rest Clients' configuration. No explicit invocation on clients is required therefore.
A sample is shown in the ConnectivityDemos: com.axonivy.connectivity.rest.client.filter.TwitterOAuthFilter&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Tue, 11 Jun 2019 04:34:33 -0400</pubDate><guid>https://answers.axonivy.com/questions/3834/consuming-rest-in-plugin-project#3849</guid></item><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/3834/consuming-rest-in-plugin-project/3848</link><description>&lt;p&gt;I do not see the point in using the plain JAX-RS api to solve this issue. With such a solution you will loose all ivy features around REST api usage. Such as enhanced logging, monitoring and environment based configurations....&lt;/p&gt;
&lt;p&gt;With &lt;code&gt;Ivy.rest().client(myClientNameFromRestClientConfigurations)&lt;/code&gt; you should be fine.&lt;/p&gt;
&lt;p&gt;&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/ivyRestApi_getClientByName.png"&gt;&lt;/p&gt;
&lt;p&gt;Further samples on this approach can be found in the &lt;code&gt;ConnectivityDemos&lt;/code&gt;. E.g. in  &lt;code&gt;com.axonivy.connectivity.rest.client.PersonClient&lt;/code&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Tue, 11 Jun 2019 04:29:53 -0400</pubDate><guid>https://answers.axonivy.com/questions/3834/consuming-rest-in-plugin-project/3848</guid></item></channel></rss>