Intercepting Entity Endpoints

Our Android app uses some of entity endpoints of Xdata server.
Now we need integrate our Android app to sister company ERP which has totally diffrent API.
Is it possibile to somehow intercept entity methods (mostly get), so we could make call to another ERP, get response and return Entity as we know as result.
Or should we just change entity calls to separate endpoints?

Hi Mika,
I believe it's easier that you use separate endpoints. The Aurelius entity endpoints are fully customized, supporting complex queries like $filter, $orderby, etc.. I assume your different API doesn't support any of it. Even a simple GET has $expand and other features.

If you still want to give it a try, you can use middleware to intercept the responses and provide custom feedback.

One "creative" way of doing it would be using server-side events. Even though it doesn't support replacing the response directly, you could request your other API and then raise a specific exception type with the proper data.

Then use OnModuleException event to catch that exception and return the response you want.

I still think specific endpoints gives you more full control.

Thanks,
This supports my own toughts.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.