Interceptors and REST calls

Hello all.

I'm working on getting my hands dirty with some low-level interceptors in preparation for writing some of my own.  I did the basic "Hello World" one from the T-Cast by Ron Wilson, and now I'm trying my hand at the examples from the TessituraPluginSamples.  The problem I think I'm having is that the UriMatch from the ExamplePluginConfig isn't being met by the application.

For example, the FilterCountriesDataPlugin is supposed to be triggered on a REST call for GET including the string "/ReferenceData/Countries", but that call doesn't seem to be made.  Running a trace while adding addresses showed me calls directly to TR_COUNTRY, but no URL calling /ReferenceData/Countries.  I was able to get the desired outcome by changing the UriMatch to "*/Countries" and passing in a qualifying URL from a RESTClient plugin for Firefox, but not through the application.

Another of the example plugins, PreventAddressChangesForSelectedConstituentsPlugin, is supposed to be triggered on a REST call including "/Constituents/*/Addresses/*" but that doesn't seem to be happening either.  I tried changing the UriMatch to "/CRM/Addresses" and then "*/Addresses" and passing a qualifying URL from the RESTClient plugin, but was not able to trigger the plugin.

One interceptor I'd like to create would block users from converting an individual to a household if they have a certain attribute, so I ran a trace while going through that process but didn't see any calls to /ConvertToHousehold.

Is there a resource out there for finding out what processes go through the REST API?  There are a lot of interesting possibilities spelled out in the REST API documentation, but I'm having trouble finding where they're called.

Thanks very much!

Nathan

Parents
  • Hi Nathan,

    Are you on V12? There is a selection of handy debug tools available in that version that let you see what calls are being made against the REST services by the application. You can find them under Help in the tool bar, or hitting Ctrl + Shift + D.

    I have also found Wireshark particularly useful for tracing REST calls, the added bonus with this tool is you can see the data being passed back and forth between the client and the server in addition to the HTTP verb and URI.

    You are correct, there doesn't appear to be a call to /ReferenceData/Countries where it might seem logical (e.g., adding an address to a constituent.) I wonder if the intended usage is in an application other than Tess, perhaps a website?

    I think the PreventAddressChanges plugin is buggy. Take a closer look at the IsAddressChangeOperation method, it returns false for a GET request (and subsequently won't send the email) but the plugin is configured for GETs only. To make it work in a REST client you'd need to alter that method, or change the config and maybe try a DELETE (I think you'd need to build up a request body for a PUT or POST and that reeks of effort.). Note you would need to alter this plugin a fair bit to get it to actually work in the client.

    When you convert a consituent to a HOusehold there is a POST to /CRM/Constituents/*/ConvertToHousehold, so try registering your plugin against that. 

    Shameless plug: I'm doing a peer to peer on interceptors at the conference this year with Jon Ballinger and Paul Kappel.  Come along and check it out!

    Cheers,

    Patrick.

  • Patrick,

    Thank you very much for the suggestions.  I'll definitely be following up on them!  And I'll see you at the conference, that's exactly the kind of session I'm looking for.  Jon has been very kind about answering my questions, too.

    Nathan

    P.S.  By the way, our test environment is v12 and we're very close to upgrading our production environment.  I've gone back and forth between trying to develop something for v11 and v12, but 12 is my focus now.



    [edited by: Nathan Wigham at 8:23 AM (GMT -6) on 20 May 2014]
Reply
  • Patrick,

    Thank you very much for the suggestions.  I'll definitely be following up on them!  And I'll see you at the conference, that's exactly the kind of session I'm looking for.  Jon has been very kind about answering my questions, too.

    Nathan

    P.S.  By the way, our test environment is v12 and we're very close to upgrading our production environment.  I've gone back and forth between trying to develop something for v11 and v12, but 12 is my focus now.



    [edited by: Nathan Wigham at 8:23 AM (GMT -6) on 20 May 2014]
Children
No Data