Supporting GET for Custom Event Handlers

Are there any plans to support GET as well as the current POST for when loading Custom Event Handlers? It would be good so some Custom Event Handlers could be invoked just by loading a URL in the browser and the various var1=value1&var2=value2 parameters in the URL could then be accessed by the Java CBL code.

Hi Simon,

Is the only benefit of this approach that you can trigger an event from the browser? Would it be for testing purposes? If so, there are other alternatives which are just as accessible (and/or simple). For example:

  1. using curl
  2. using a browser extension like this one: https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo

Otherwise, please clarify what the actual use-case might be.

Regards,
Mark

Hi,

Yes it’s to trigger an event from the browser. An automatic e-mail is sent after a registration process that contains a couple of links in it, one is set to approve and one is set to reject the registration request. The way I do it now is to have a JS enabled HTML file with the BE JS SDK that uses JS to get the GET parameters and run the correct business logic via the JS SDK to modify the registration request’s status in the BE… if that makes sense.

Cheers,
Simon

What if one of the arguments is a complex type (with child objects in the hierarchy…)? How would you handle it in a GET query? It can get quite complicated very quickly. If we make a change and introduce an alternative approach, it needs to be fairly universal.

Regards,
Mark

Ah indeed, I see the problem now. It wouldn’t have total support for all features that POST does.

We will be introducing server-side scripting in JS fairly soon. You will be able to handle it in custom JS code with that approach.

Regards,
Mark

I just came across a similar business need which is kind of related to this topic so I’ll just add it here. The idea is to support being able to set the app ID and secret key with in the JSON body as well as the HTTP headers. Or maybe something similar to the file service where you can support set the app ID in the URL itself.

The reason is, I’m using a 3rd party plugin that has a field where I set the URL of a server that can receive a JSON based POST. It’s used to send the Apple iOS App Store receipt data after a successful in-app purchase. I’m able to add extra fields to the JSON body (eg. app ID and secret key) but I’m unable to modify the the HTTP headers.