wm.b2b.cxml.shared.data:recordListToHTTPNameValuePairs
WmcXML12. Converts a list of records into a name/value pair string for use as parameters in an HTTP GET or an HTTP FORM POST request.
The record in the list must contain only string elements; it cannot contain subrecords. Record fields that are not mapped will not appear in the name/value pair string.
Input Parameters
recordList | List of records to make into a name/value pair string. Each record must contain only string fields. |
urlEncode | If set to true, the name/value pair string is returned URL encoded. |
stringToPrepend | If set, this string is pre-pended to the name/value pair string. |
Output Parameters
string | Name/value pair string. The string is URL encoded if urlEncode was set to true. |
Usage Notes
If recordList contains records with the fields field_a and field_b, the record list will be encoded as:
<field_a>=<field_a_value1>&<field_b>=<field_b_value1>&<field_a>=<field_a_value2>
&<field_b>=<field_b_value2>
where:
<field_a_value1>represents the value of
field_a in the first record.
<field_b_value1>represents the value of
field_b in the first record.
<field_a_value2>represents the value of
field_a in the second record.
<field_b_value2>represents the value of
field_b in the second record.
If urlEncode is set to true, the name/value pair string will be returned URL encoded. If stringToPrepend is set, its value will be prepended to the name/value pair string. A common use of urlEncode and stringToPrepend is for creating an HTTP GET request.
You would set urlEncode to true and stringToPrepend as the BASE URL for the GET request. For example, if stringToPrepend is set to http://aGetRequest.html?, the resulting string would be http://aGetRequest.html?<name-value pair string >.