Base solution for your next web application
Open Closed

Automatically adding query string #11333

fawad29 created

Angular Project • "name": "abp-zero-template", • "version": "10.0.0", • "abp-ng2-module": "^6.2.0", • "abp-web-resources": "^5.3.0", • Nebula Core version 10.0.0. • Abp (6.0.0)

I need to send a couple of values in querystring for all my create and update methods. I cannot change below method in service-proxies.ts because it will get overwritten all the time.

     * @param body (optional) 
     * @return Success
    updateWizard(body: MyWizardDataInputDto | undefined): Observable<ResponseOutputDto> {
        let url_ = this.baseUrl + "/api/services/app/MyEntity/UpdateWizard";
        url_ = url_.replace(/[?&]$/, "");

        const content_ = JSON.stringify(body);

        let options_ : any = {
            body: content_,
            observe: "response",
            responseType: "blob",
            headers: new HttpHeaders({
                "Content-Type": "application/json-patch+json",
                "Accept": "text/plain"

        return this.http.request("put", url_, options_).pipe(_observableMergeMap((response_ : any) => {
            return this.processUpdateWizard(response_);
        })).pipe(_observableCatch((response_: any) => {
            if (response_ instanceof HttpResponseBase) {
                try {
                    return this.processUpdateWizard(<any>response_);
                } catch (e) {
                    return <Observable<ResponseOutputDto>><any>_observableThrow(e);
            } else
                return <Observable<ResponseOutputDto>><any>_observableThrow(response_);

Above function is called by my ts component shown below.

this._myEntity.updateWizard(this.wizardData).subscribe(result => {            
        }, error => {

We have hundreds of updateWizard/InsertWizard functions for all entities so we are looking for a dynamic solution for appending two paramters as query string, so that our ExtendedAuditStore can get these values for auditing purposes.


3 Answer(s)
  • 0
    ismcagdas created
    Support Team
  • 0
    fawad29 created

    Thanks ismcagdas,

    I need to add CorrelationId on the client side. I have added CorrelationId on the server side so that the first api request received on the server and all subsequent api request from the server side has the same CorrelationId. However, in our system, when user clicks on a menu link, it may generate 10 different api requests from the angular frontend. Because these are different api request from the client side, all will have different correlation id on the server.

    Consider a scenario below.

    1. User clicks on a menu link My Customers
    2. It generates two api requests to the server. Lets call them Request A and Request B.
    3. Server receives Request A, adds a Correlation Id (123) to HttpContext.Items. Request A further calls InsertMethod1 and InsertMethod2. Audit stores correct correlation id 123 to all audit entries of Request A.
    4. Meanwhile, Server receives Request B, adds a correlation Id (456) to HttpContext.Items. Adds CorrelationId of 456 to audit.

    Both Requests A and B were generated because of one action i.e user clicking on menu My Customers so I need to store same correlation id for both Request A and B. I thought best way would be to intercept the request on the client side and add the same correlation id to header of both Requests. On the server side, I can simply use the header correlation id for audit. Can you suggest how to handle this?


  • 0
    ismcagdas created
    Support Team


    If you create an Angular interceptor, it will be executed for Requests A and B separately. Could you share how can you understand if Requests A and B are executed when user clicks "My Customers" menu link ?

    1. Do want all requests made during the initialization of an Angular component use the same Correlation Id ?
    2. Which Correlation Id should be used when user clicks a button (for example refresing the my customers table) on My customers page ? Will it be same as the one in page initialization or different ?

    Basically, how will you determine which requests should use the same correlation Id ?