Overriding the default CRUD implementations

Is it possible to completely override the GET method for a particular resource using server-side scripting?

We are looking at using stored procedures for as much of our CRUD operations as we can. Rather than have the implementation details on the client I want to use the Service.Resource.SELECT, Service.Resource.INSERT, Service.Resource.UPDATE, and Service.Resource.DELETE events to call the appropriate stored procedure from the API.

According to the docs these events fire BEFORE the call goes to the database. Is it possible to prevent the default call to the DB and instead issue my own API call via platform.api.GET\POST\PUT\DELETE ?

If not stopped by an exception thrown by pre-process scripts, then the default call to the DB will always be made. However, you could design a post-process script to make a different call and return the results of that call to the client instead.

Apologies for the necro-post, put +1 for some way to gracefully stop further processing in pre-processing scripts apart from throwing an error.

I’ve overriden the DELETE verb so that it’s a soft-delete.But the implementation thereof requires me to throw an error, so that the actual delete doesn’t happen. Which is a little messy.

1 Like