Back to Devexpress

UriJsonSource.HeaderParameters Property

corelibraries-devexpress-dot-dataaccess-dot-json-dot-urijsonsource-154bf910.md

latest3.4 KB
Original Source

UriJsonSource.HeaderParameters Property

Provides access to a collection of parameters that the UriJsonSource includes in requests to a JSON endpoint as custom HTTP headers.

Namespace : DevExpress.DataAccess.Json

Assembly : DevExpress.DataAccess.v25.2.dll

NuGet Package : DevExpress.DataAccess

Declaration

csharp
[Browsable(false)]
public HeaderParameterCollection HeaderParameters { get; }
vb
<Browsable(False)>
Public ReadOnly Property HeaderParameters As HeaderParameterCollection

Property Value

TypeDescription
HeaderParameterCollection

Lists header parameters.

|

Remarks

This property stores a collection of header parameters that the UriJsonSource uses to add custom HTTP headers to JSON endpoint requests.

The parameters are added to endpoint requests in the same order in which they are stored in the collection. Change the order of elements in the collection to reposition parameters in endpoint requests.

Example

csharp
public static JsonDataSource CreateDataSourceWithAuthenticationInCode() {
    // Create a new UriJsonSource object and configure authentication data in it
    var jsonSource = new DevExpress.DataAccess.Json.UriJsonSource();
    jsonSource.Uri = new Uri(@"https://northwind.netcore.io/customers.json");

    jsonSource.HeaderParameters.Add(new HeaderParameter("MyAuthHeader1", "secretToken1"));
    jsonSource.HeaderParameters.Add(new HeaderParameter("MyAuthHeader2", "secretToken2"));

    // Create JsonDataSource
    var jsonDataSource = new DevExpress.DataAccess.Json.JsonDataSource() {
        JsonSource = jsonSource
    };
    jsonDataSource.Fill();
}
vb
Public Shared Function CreateDataSourceWithAuthenticationInCode() As JsonDataSource
    ' Create a new UriJsonSource object and configure authentication data in it
    Dim jsonSource = New DevExpress.DataAccess.Json.UriJsonSource()
    jsonSource.Uri = New Uri("https://northwind.netcore.io/customers.json")

        jsonSource.HeaderParameters.Add([New] HeaderParameter("MyAuthHeader1", "secretToken1"))
    jsonSource.HeaderParameters.Add([New] HeaderParameter("MyAuthHeader2", "secretToken2"))

    ' Create JsonDataSource
    Dim jsonDataSource = New DevExpress.DataAccess.Json.JsonDataSource() With {.JsonSource = jsonSource}
    jsonDataSource.Fill()
End Function

See Also

AuthenticationInfo

ConnectionName

UriJsonSource Class

UriJsonSource Members

DevExpress.DataAccess.Json Namespace