Skip to main content
The REST Query pipeline stage is available in Fusion versions 3.0 and later.
In Fusion version 3.0 and earlier, this pipeline stage was called the Query RPC Stage. RPC is the acronym for Remote Procedure Calls.
The uri, queryParams, headers, and entity values support template expressions, such as <request.paramName> for a request parameter or <ctx.key> for a pipeline context value. For example, to send the query text as the payload, set Request entity (as string) to <request.q>. A multi-valued parameter returns all of its values, concatenated with no separator. To use only the first value, use <first(request.paramName)>. If a referenced parameter is missing from the request, the expression evaluates to an empty string.
The ${paramName} syntax is deprecated. Do not use it. Stages that use it log a deprecation warning, and support will be removed in a future version.
If your stage configuration uses ${paramName}, migrate it to template expressions:
  1. In the uri, queryParams, headers, and entity values, replace each ${paramName} with <first(request.paramName)>. For example, change ${q} to <first(request.q)>. <first(...)> keeps the legacy behavior of using only the first value of a multi-valued parameter. Query stages use request, not doc. If the deprecation warning suggests <doc.foo>, use <request.foo> instead.
  2. Replace every ${...} reference in a value at the same time. If a value contains a ${...} reference, the stage doesn’t evaluate template expressions in that value.
  3. Check how the stage should handle missing parameters. With ${paramName}, a missing parameter in uri skips the call, a missing parameter in queryParams or headers omits that entry, and a missing parameter in entity becomes an empty string. With template expressions, a missing parameter becomes an empty string and the call still runs. To skip requests that don’t have the parameter, set the stage Condition to an expression such as request.hasParam("q").
  4. Save the stage and confirm that the deprecation warning no longer appears in the logs.

Query pipeline stage condition examples

Stages can be triggered conditionally when a script in the Condition field evaluates to true. Some examples are shown below. Run this stage only for mobile clients:
Run this stage when debugging is enabled:
Run this stage when the query includes a specific term:
Run this stage when multiple conditions are met:
The first condition checks that the request parameter “fusion-user-name” is present and has the value “SuperUser”. The second condition checks that the request parameter “isFusionPluginQuery” is not present.

Configuration

When entering configuration values in the UI, use unescaped characters, such as \t for the tab character. When entering configuration values in the API, use escaped characters, such as \\t for the tab character.