The request header is an extra piece of information that is send to the web service. It contains metadata or details needed for executing of the request. You can add 2 types of information.
Name | Description |
---|---|
Accept |
Specify the format of the requested data. You can choose between: |
Authorization | Specify the username and password via basic authentication. |
var request = new XMLHttpRequest(); ... request.setRequestHeader("Accept","application/xml"); request.setRequestHeader("Authorization","Basic " + Base64.encode ("User:Password")); ...In the following JavaScript example we prepare a request to find an article by index 'Number' and value '1'. We want to get the fields 'Number', 'DscLng1', and 'SalesPrice' from the field list 'fields'.
var request = new XMLHttpRequest(); ... request.setRequestHeader("Number", "1"); request.setRequestHeader("Fields", "Number,DscLng1,SalesPrice"); ...