parse_urlquery()

Learn how to use the parse_urlquery() function to return a dynamic object that contains the query parameters.

Returns a dynamic object that contains the query parameters.

Syntax

parse_urlquery(query)

Parameters

NameTypeRequiredDescription
querystring✔️The query part of the URL. The format must follow URL query standards (key=value& …).

Returns

An object of type dynamic that includes the query parameters.

Examples

print Result=parse_urlquery("k1=v1&k2=v2&k3=v3")

Output

Result
{ “Query Parameters”:"{“k1”:“v1”, “k2”:“v2”, “k3”:“v3”}" }

The following example uses a function to extract specific query parameters.

let getQueryParamValue = (querystring: string, param: string) {
    let params = parse_urlquery(querystring);
    tostring(params["Query Parameters"].[param])
};
print UrlQuery = 'view=vs-2019&preserve-view=true'
| extend view = getQueryParamValue(UrlQuery, 'view')
| extend preserve = getQueryParamValue(UrlQuery, 'preserve-view')

Output

UrlQueryviewpreserve
view=vs-2019&preserve-view=truevs-2019true