Is anyone aware of a guide to writing service interceptors? I have the REST API Documentation which has a small section, but really looking for information on what references I need to include, how to setup the development environment, any actions such as user authentication that need to be completed?
A HelloWorld interceptor tutorial that goes through these would be so helpful if anyone has one...
Hi Everyone,
After much turmoil we finally managed to implement a “Hello world” interceptor that just writes a text file to hard drive. I hope it helps someone.
1. Start a new class library project in VS and name it TestPluginCSharp.
2. Copy Tessitura.Services.Common.Interceptor.Client.dll from your Tessitura service (the one that you are building plug-in for e.g. ConstituentService) bin folder to your new class library bin folder and add project reference to it.
3. Add a class named TestPluginCSharp and add the following code:
using Tessitura.Services.Common.Interceptor.Client;
namespace TestPluginCSharp
{
public class TestPluginCSharp
public static PluginData Operation(PluginData pluginData)
//you'll need the folder set up somewhere on the server for your test file
System.IO.File.WriteAllText(@"C:\Test\test.txt", "Howdy!");
return pluginData;
}
4. Build your project
5. Copy TestPluginCSharp.dll from bin\Debug folder to the service Plugins folder (e.g. ConstituentService\Plugins).
6. Open PluginConfig.xml from ConstituentService\Plugins in your VS and add:
<PluginConfigs>
<PluginConfig>
<UriMatch>Constituents/*</UriMatch>
<Verb>GET</Verb>
<FullPluginName>TestPluginCSharp.TestPluginCSharp</FullPluginName>
<PluginPlacement>PRE</PluginPlacement>
</PluginConfig>
</PluginConfigs>
Note: no preceding forward slash in UriMatch
7. Save PluginConfig
8. You may need to restart Application Pool for Tess in IIS
9. I also have EnablePlugins and ReloadPluginConfig keys set to true in Web.config of the service.
10. In Firefox start RESTClient. Set up OAuth Authorisation as per REST_API_Documentation.doc
11. Set call method to GET
12. Set to address of your service (e.g. https://your_server/Tess/ConstituentService/Constituents/60671061 ) and send request.
13. This should result in test.txt being written to the path at step 2.
Good luck!
Sergei Stenkov
Hi Sergei,
That's a great help, thanks very much!
I don't suppose you've experimented a bit further and tried to get information from the REST Service? So in your example, how you would get the consitutent id 60671061.
Thanks
Hi Simon,
It's all baby steps for me with interceptors. You could search for it I think. When I try executing this search through the REST client it brings back ConstituentSummary containing the ID:
https://tessxxx.xxx.com/Tess/ConstituentService/Constituents/Search?q=""&type=basic&constituentGroups=individuals&ln=stenkov
... and a bit of result: