Contact Free trial Login


compose(Array<String>, Array<String>): String

Uses a custom interpolator to replace URL components with a encodeURIComponent result.


Name Description


A string array that provides the part of the URL to encode.


This example passes in text to encode using $(myText), where myText is a variable defined in the header. Notice that the spaces in the input are encoded in the output URL as %20. Also notice that the entire input to the compose function is surrounded by backticks.


%dw 2.0
import * from dw::core::URL
var myText = " text to encode "
output application/json
{ "composition" : compose `http://asd/$(myText)/text` }


{ "composition": "http://asd/%20text%20to%20encode%20/text" }

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.