How to add Correlation Token parameter to web api request?

699 views Asked by At

I'm using web api without deep understanding what it is, just knowing that each editable entity become a resource, that means has the uri, when web api provides the interpretation of PUT, POST, GET, DELETE HTTP commands to support CRUD operations. But what if for tracing/logging purpose I need to send correlation token together with e.g. GET request? Are there any recommendations and techniques to add to the HTTP request/routing "technical parameters"?

1

There are 1 answers

0
Roman Pokrovskij On BEST ANSWER

I have found something that need to be tested https://webapicorrelator.codeplex.com/ But actually I would prefer just to understand how it could work...

Or just add it to the heder using jquery ajax headers:

return $.ajax({
            // have to use synchronous here, else the function
            // will return before the data is fetched
            url: url,
            data: { ElectrodeId: electrodeId },
            headers: { "X-CorrelationToken": correlationToken }, 
            method: "POST",
            dataType: "json",
            success: function (data) {

            }