({{, (RefLink[URLBuild, paclet:ref/URLBuild])["path",{"(Subscript[param, 1])"->(Subscript[val, 1]),"(Subscript[param, 2])"->(Subscript[val, 2]),…}]
builds a URL with the specified path and query parameters and values (Subscript[param, i]) and (Subscript[val, i]).}, {, (RefLink[URLBuild, paclet:ref/URLBuild])[{"(Subscript[path, 1])","(Subscript[path, 2])",…}]
builds a URL from the path components (Subscript[path, i]).}, {, (RefLink[URLBuild, paclet:ref/URLBuild])[path,params]
builds a URL from a specification of a path and query parameters.}, {, (RefLink[URLBuild, paclet:ref/URLBuild])[assoc]
builds a URL from an association of components.}, {, (RefLink[URLBuild, paclet:ref/URLBuild])[assoc,params]
builds a URL from an association of components, plus query parameters and values.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[URLBuild, paclet:ref/URLBuild])[(RefLink[URL, paclet:ref/URL])["path"],…] and (RefLink[URLBuild, paclet:ref/URLBuild])[(RefLink[CloudObject, paclet:ref/CloudObject])["path"],…] are also supported.

In a list of rules for queries, the (Subscript[val, i]) can be strings or numbers, or the following special forms:

In (RefLink[URLBuild, paclet:ref/URLBuild])[assoc], the (RefLink[Association, paclet:ref/Association]) assoc can contain the following elements:

If queries are specified both in assoc and with a list of rules, the queries are concatenated.

Strings from assoc or from query parameters or values are percent-encoded.

(RefLink[URLBuild, paclet:ref/URLBuild]) has the option (RefLink[CharacterEncoding, paclet:ref/CharacterEncoding]), which specifies what type of character encoding to use for the output. The default is "UTF-8".

OpenersPrimaryExamplesSection(Spacer1)Examples  (16)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Build a URL:

URLBuild[{"www.wolfram.com","solutions"}]

Include a query:

URLBuild[{"http://www.google.com","search"},{"q"->"Mathematica"}]

Create a URL string from an association:

URLBuild[<|"Scheme"->"http","Domain"->"www.wolframalpha.com","Path"->"examples"|> ]

OpenersExampleSection1(Spacer1)Scope  (6)

Create a URL from a path:

URLBuild[{"http://www.wolframalpha.com","examples","Engineering.html"}]

Include a query:

URLBuild[{"http://www.wolframalpha.com","input"},{"i"->"Doppler Shift 300Hz at 75 mph"}]

Nested lists in query parameters are flattened:

URLBuild["http://example.com", <|"n" -> {1, 2, 3}|>]

Existing query parameters are preserved:

URLBuild["http://example.com/?a=2", <|"n" -> {1, 2, 3}|>]

Use a (RefLink[URL, paclet:ref/URL]) object for the base:

URLBuild[URL["http://www.example.com/?i=1"], <|"x" -> 2|>]

Use a (RefLink[CloudObject, paclet:ref/CloudObject]) for the base:

URLBuild[CloudObject[], <|"input" -> 2|>]

OpenersExampleSection2(Spacer1)Generalizations & Extensions  (1)

Create a generic URL:

URLBuild[<|"Scheme"->"http","User"->"user:info","Domain"->"www.domain.com","Port"->"80","Path"->{"path","to","resource"},"Query"->{"param1"->"val2","param2"->"val2"},"Fragment"->"fragment"|>]

Query can either be a string or a list of rules:

URLBuild[<|"Path" -> "path/to/dir", "Query" -> "x=3"|>]

URLBuild[<|"Path" ->  "path/to/dir", "Query" -> {"x" -> 3}|>]

Path can be a list or a list of paths:

URLBuild[<|"Path" ->  "path/to/dir"|>]

URLBuild[<|"Path" ->  {"path","to","dir"}|>]

OpenersExampleSection3(Spacer1)Options  (3)

OpenersExampleSubsection0(Spacer1)CharacterEncoding  (1)

Percent encode with a specified encoding:

URLBuild["http://university.com", {"university"->"Eötvös Loránd University"}, CharacterEncoding->"MacintoshRoman"]

OpenersExampleSubsection1(Spacer1)SortQueries  (1)

Sort query parameters by using "SortQueries":

URLBuild["http://example.com?x=2", {"c"->4,"z"->1,"a"->2}, "SortQueries" -> True]

URLBuild["http://example.com?x=2", {"c"->4,"z"->1,"a"->2}]

OpenersExampleSubsection2(Spacer1)RemoveEmptyQueries  (1)

Remove empty parameters by using "RemoveEmptyQueries":

URLBuild["http://example.com?x=2", {"y"->None, "z" ->3}, "RemoveEmptyQueries" -> True]

URLBuild["http://example.com?x=2", {"y"->None, "z" ->3}]

OpenersExampleSection4(Spacer1)Applications  (1)

Create a table of hyperlinks:

Table[Hyperlink[category,URLBuild[{"http://www.wolfram.com","solutions","industry",category}]],{category,{"control-systems","astronomy","economics","statistics"}}]

OpenersExampleSection5(Spacer1)Properties & Relations  (1)

The parameter values are encoded using (RefLink[URLQueryEncode, paclet:ref/URLQueryEncode]):

URLBuild[{"http://www.wolframalpha.com","input"},{"i"->"Integral of Sin x^2"}]

OpenersExampleSection6(Spacer1)Possible Issues  (1)

Repeated keys are not supported by (RefLink[Association, paclet:ref/Association]):

URLBuild["http://example.com", <|"value"->1,"value"->2|>]

To specify multiple values, collect them in a list:

URLBuild["http://example.com", <|"value"->{1, 2}|>]

Alternatively, use a list of rules:

URLBuild["http://example.com", {"value"->1,"value"->2}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[URLQueryEncode, paclet:ref/URLQueryEncode])  ▪  (RefLink[URLParse, paclet:ref/URLParse])  ▪  (RefLink[URLEncode, paclet:ref/URLEncode])  ▪  (RefLink[URLRead, paclet:ref/URLRead])  ▪  (RefLink[URLExecute, paclet:ref/URLExecute])  ▪  (RefLink[SystemOpen, paclet:ref/SystemOpen])  ▪  (RefLink[FileNameJoin, paclet:ref/FileNameJoin])  ▪  (RefLink[Hyperlink, paclet:ref/Hyperlink])  ▪  (RefLink[HTTPRedirect, paclet:ref/HTTPRedirect])  ▪  (RefLink[$CloudBase, paclet:ref/$CloudBase])  ▪  (RefLink[$UserURLBase, paclet:ref/$UserURLBase])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[URL Manipulation, paclet:guide/URLManipulation])}, {▪(RefLinkPlain[Creating Instant APIs, paclet:guide/CreatingAnInstantAPI])}, {▪(RefLinkPlain[String Manipulation, paclet:guide/StringManipulation])}, {▪(RefLinkPlain[Web Operations, paclet:guide/WebOperations])}, {▪(RefLinkPlain[Operations on File Names, paclet:guide/OperationsOnFileNames])}, {▪(RefLinkPlain[Systems-Related String Operations, paclet:guide/SystemsRelatedStringOperations])}, {▪(RefLinkPlain[Text Generation, paclet:guide/TextConstruction])}, {▪(RefLinkPlain[Network Programming, paclet:guide/NetworkProgramming])}})}})