Skip to content

Instantly share code, notes, and snippets.

@eballisty
Created August 26, 2016 20:13
Show Gist options
  • Save eballisty/ce8c1beb889e0d6adf0079d52a85ba0f to your computer and use it in GitHub Desktop.
Save eballisty/ce8c1beb889e0d6adf0079d52a85ba0f to your computer and use it in GitHub Desktop.
Register Method with Mura's API
public void function onSiteRequestStart(required struct $) output=false {
var APIUtility = $.siteConfig().getApi('json', 'v1');
var Service = $.getBean('MyService');
APIUtility.registerMethod('getData', Service.getData);
// then call the method via this url:
// /index.cfm/_api/json/v1/site_id/?method=getData
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment