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.v20.2.dll

Declaration

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

Property Value

Type Description
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

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(@"http://northwind.servicestack.net/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();
}
See Also