REST API hit count

Hi team,
Im using CUBA platform 7.2.4… Here i need REST api hit count from the server…how can i get the hit count from cuba…

KannanSubramaniyam

1 Like

Hi,
REST API add-on publishes BeforeRestInvocationEvent and AfterRestInvocationEvent on each REST controller invocation. You can define a listener in your app. Something like this:

@Component
public class RestHitCounter {

    private static final Logger log = LoggerFactory.getLogger(RestHitCounter.class);

    @EventListener
    public void onBeforeRestInvocationEvent(BeforeRestInvocationEvent event) {
        log.info("BeforeRestInvocationEvent received");
    }
}

Thanks man…