Reference documentation and code samples for the Google API Common Protos Client class RoutingParameter.
A projection from an input message to the GRPC or REST header.
Generated from protobuf message google.api.RoutingParameter
Namespace
Google \ Api
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ field
string
A request field to extract the header key-value pair from.
↳ path_template
string
A pattern matching the key-value field. Optional. If not specified, the whole field specified in the field field will be taken as value, and its name used as key. If specified, it MUST contain exactly one named segment (along with any number of unnamed segments) The pattern will be matched over the field specified in the field field, then if the match is successful: - the name of the single named segment will be used as a header name, - the match value of the segment will be used as a header value; if the match is NOT successful, nothing will be sent. Example: -- This is a field in the request message | that the header value will be extracted from. | | -- This is the key name in the | | routing header. V | field: "table_name" v path_template: "projects//{table_location=instances/}/tables/" ^ ^ | | In the } brackets is the pattern that -- | specifies what to extract from the | field as a value to be sent. | | The string in the field must match the whole pattern -- before brackets, inside brackets, after brackets. When looking at this specific example, we can see that: - A key-value pair with the key table_location and the value matching `instances/should be added to the x-goog-request-params routing header. - The value is extracted from the request message'stable_namefield if it matches the full pattern specified:projects//instances//tables/`. **NB:* If the path_template field is not provided, the key name is equal to the field name, and the whole field should be sent as a value. This makes the pattern for the field and the value functionally equivalent to **, and the configuration { field: "table_name" } is a functionally equivalent shorthand to: { field: "table_name" path_template: "{table_name=**}" } See Example 1 for more details.
getField
A request field to extract the header key-value pair from.
Returns
Type
Description
string
setField
A request field to extract the header key-value pair from.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getPathTemplate
A pattern matching the key-value field. Optional.
If not specified, the whole field specified in the field field will be
taken as value, and its name used as key. If specified, it MUST contain
exactly one named segment (along with any number of unnamed segments) The
pattern will be matched over the field specified in the field field, then
if the match is successful:
the name of the single named segment will be used as a header name,
the match value of the segment will be used as a header value;
if the match is NOT successful, nothing will be sent.
Example:
-- This is a field in the request message
| that the header value will be extracted from.
|
| -- This is the key name in the
| | routing header.
V |
field: "table_name" v
path_template: "projects//{table_location=instances/}/tables/*"
^ ^
| |
In the } brackets is the pattern that -- |
specifies what to extract from the |
field as a value to be sent. |
|
The string in the field must match the whole pattern --
before brackets, inside brackets, after brackets.
When looking at this specific example, we can see that:
A key-value pair with the key table_location
and the value matching instances/* should be added
to the x-goog-request-params routing header.
The value is extracted from the request message's table_name field
if it matches the full pattern specified:
projects/*/instances/*/tables/*.
NB: If the path_template field is not provided, the key name is
equal to the field name, and the whole field should be sent as a value.
This makes the pattern for the field and the value functionally equivalent
to **, and the configuration
{
field: "table_name"
}
is a functionally equivalent shorthand to:
{
field: "table_name"
path_template: "{table_name=**}"
}
See Example 1 for more details.
Returns
Type
Description
string
setPathTemplate
A pattern matching the key-value field. Optional.
If not specified, the whole field specified in the field field will be
taken as value, and its name used as key. If specified, it MUST contain
exactly one named segment (along with any number of unnamed segments) The
pattern will be matched over the field specified in the field field, then
if the match is successful:
the name of the single named segment will be used as a header name,
the match value of the segment will be used as a header value;
if the match is NOT successful, nothing will be sent.
Example:
-- This is a field in the request message
| that the header value will be extracted from.
|
| -- This is the key name in the
| | routing header.
V |
field: "table_name" v
path_template: "projects//{table_location=instances/}/tables/*"
^ ^
| |
In the } brackets is the pattern that -- |
specifies what to extract from the |
field as a value to be sent. |
|
The string in the field must match the whole pattern --
before brackets, inside brackets, after brackets.
When looking at this specific example, we can see that:
A key-value pair with the key table_location
and the value matching instances/* should be added
to the x-goog-request-params routing header.
The value is extracted from the request message's table_name field
if it matches the full pattern specified:
projects/*/instances/*/tables/*.
NB: If the path_template field is not provided, the key name is
equal to the field name, and the whole field should be sent as a value.
This makes the pattern for the field and the value functionally equivalent
to **, and the configuration
{
field: "table_name"
}
is a functionally equivalent shorthand to:
{
field: "table_name"
path_template: "{table_name=**}"
}
See Example 1 for more details.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Google API Common Protos Client - Class RoutingParameter (4.12.3)\n\nVersion latestkeyboard_arrow_down\n\n- [4.12.3 (latest)](/php/docs/reference/common-protos/latest/Api.RoutingParameter)\n- [4.12.2](/php/docs/reference/common-protos/4.12.2/Api.RoutingParameter)\n- [4.11.0](/php/docs/reference/common-protos/4.11.0/Api.RoutingParameter)\n- [4.10.0](/php/docs/reference/common-protos/4.10.0/Api.RoutingParameter)\n- [4.9.0](/php/docs/reference/common-protos/4.9.0/Api.RoutingParameter)\n- [4.8.3](/php/docs/reference/common-protos/4.8.3/Api.RoutingParameter) \nReference documentation and code samples for the Google API Common Protos Client class RoutingParameter.\n\nA projection from an input message to the GRPC or REST header.\n\nGenerated from protobuf message `google.api.RoutingParameter`\n\nNamespace\n---------\n\nGoogle \\\\ Api\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getField\n\nA request field to extract the header key-value pair from.\n\n### setField\n\nA request field to extract the header key-value pair from.\n\n### getPathTemplate\n\nA pattern matching the key-value field. Optional.\n\nIf not specified, the whole field specified in the `field` field will be\ntaken as value, and its name used as key. If specified, it MUST contain\nexactly one named segment (along with any number of unnamed segments) The\npattern will be matched over the field specified in the `field` field, then\nif the match is successful:\n\n- the name of the single named segment will be used as a header name,\n- the match value of the segment will be used as a header value; if the match is NOT successful, nothing will be sent. Example: -- This is a field in the request message \\| that the header value will be extracted from. \\| \\| -- This is the key name in the \\| \\| routing header. V \\| field: \"table_name\" v path_template: \"projects/*/{table_location=instances/*}/tables/\\*\" \\^ \\^ \\| \\| In the } brackets is the pattern that -- \\| specifies what to extract from the \\| field as a value to be sent. \\| \\| The string in the field must match the whole pattern -- before brackets, inside brackets, after brackets. When looking at this specific example, we can see that:\n- A key-value pair with the key `table_location` and the value matching `instances/*` should be added to the x-goog-request-params routing header.\n- The value is extracted from the request message's `table_name` field if it matches the full pattern specified: `projects/*/instances/*/tables/*`. **NB:** If the `path_template` field is not provided, the key name is equal to the field name, and the whole field should be sent as a value. This makes the pattern for the field and the value functionally equivalent to `**`, and the configuration { field: \"table_name\" } is a functionally equivalent shorthand to: { field: \"table_name\" path_template: \"{table_name=\\*\\*}\" } See Example 1 for more details.\n\n### setPathTemplate\n\nA pattern matching the key-value field. Optional.\n\nIf not specified, the whole field specified in the `field` field will be\ntaken as value, and its name used as key. If specified, it MUST contain\nexactly one named segment (along with any number of unnamed segments) The\npattern will be matched over the field specified in the `field` field, then\nif the match is successful:\n\n- the name of the single named segment will be used as a header name,\n- the match value of the segment will be used as a header value; if the match is NOT successful, nothing will be sent. Example: -- This is a field in the request message \\| that the header value will be extracted from. \\| \\| -- This is the key name in the \\| \\| routing header. V \\| field: \"table_name\" v path_template: \"projects/*/{table_location=instances/*}/tables/\\*\" \\^ \\^ \\| \\| In the } brackets is the pattern that -- \\| specifies what to extract from the \\| field as a value to be sent. \\| \\| The string in the field must match the whole pattern -- before brackets, inside brackets, after brackets. When looking at this specific example, we can see that:\n- A key-value pair with the key `table_location` and the value matching `instances/*` should be added to the x-goog-request-params routing header.\n- The value is extracted from the request message's `table_name` field if it matches the full pattern specified: `projects/*/instances/*/tables/*`. **NB:** If the `path_template` field is not provided, the key name is equal to the field name, and the whole field should be sent as a value. This makes the pattern for the field and the value functionally equivalent to `**`, and the configuration { field: \"table_name\" } is a functionally equivalent shorthand to: { field: \"table_name\" path_template: \"{table_name=\\*\\*}\" } See Example 1 for more details."]]