WebSDK redirect measurement request

Hey guys,

I wondering if there is a way how I can redirect requests that I make via WebSDK.

My scenario. I have a Angular 16 application that uses the WebSDK. We have many parts in our code that use the MeasurementService from the WebSDK. Now I write a microserice that act as a fasade in front of the measurement API. We want use this microservice instead of the MeasurementService. Now I don’t want search for every snippet in the code that uses the MeasurementService to redirect them to my microservice. I want to redirect all GET requests to /measurement/measurements to my local running microservice.

This all is only for test purposes of my microservice, if still all requests handled proper.

First what I try was to write a interceptor in Angular. But the SDK don’t use the Angular HTTP Client so this was not working.
Then I try to write a proxy.config that I can use in the angular.json (like this here Angular). But this is also not working. I guess this gets in conflict with the proxy settings for the cumulocity endpoint. When I try to login I get this error in browser:

  "status": 404,
  "statusText": "Not Found",
  "url": "http://localhost:4200/tenant/currentTenant"

Any other ideas how to redirect my GET call for measurements?

Hi @David.Richter,

the tutorial application contains a client-interceptor sample that showcases intercepting requests done through the @c8y/client package.
Note that this will not intercept requests coming from the @c8y/ng1-modules angularJS code.


1 Like