public sealed class RoutingParameter : IMessage<RoutingParameter>, IEquatable<RoutingParameter>, IDeepCloneable<RoutingParameter>, IBufferMessage, IMessage
A projection from an input message to the GRPC or REST header.
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
[[["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."],[[["\u003cp\u003e\u003ccode\u003eRoutingParameter\u003c/code\u003e is a class that projects an input message to a GRPC or REST header, with its latest version being 2.15.0.\u003c/p\u003e\n"],["\u003cp\u003eIt inherits from \u003ccode\u003eobject\u003c/code\u003e and implements multiple interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, and is found in the \u003ccode\u003eGoogle.Api\u003c/code\u003e namespace.\u003c/p\u003e\n"],["\u003cp\u003eThe class has two constructors: one default and another that accepts another \u003ccode\u003eRoutingParameter\u003c/code\u003e instance for initialization.\u003c/p\u003e\n"],["\u003cp\u003eIt includes fields such as \u003ccode\u003eFieldFieldNumber\u003c/code\u003e and \u003ccode\u003ePathTemplateFieldNumber\u003c/code\u003e, and properties like \u003ccode\u003eDescriptor\u003c/code\u003e, \u003ccode\u003eField\u003c/code\u003e, \u003ccode\u003eParser\u003c/code\u003e, and \u003ccode\u003ePathTemplate\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ePathTemplate\u003c/code\u003e allows for the extraction of header key-value pairs from a specified request field using a pattern-matching system, and when not provided, the field name is used as the key, and the entire field content as the value.\u003c/p\u003e\n"]]],[],null,["# Class RoutingParameter (2.17.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.17.0 (latest)](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.RoutingParameter)\n- [2.15.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.15.0/Google.Api.RoutingParameter)\n- [2.10.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.10.0/Google.Api.RoutingParameter)\n- [2.2.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.2.0/Google.Api.RoutingParameter) \n\n public sealed class RoutingParameter : IMessage\u003cRoutingParameter\u003e, IEquatable\u003cRoutingParameter\u003e, IDeepCloneable\u003cRoutingParameter\u003e, IBufferMessage, IMessage\n\nA projection from an input message to the GRPC or REST header. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e RoutingParameter \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[RoutingParameter](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.RoutingParameter), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[RoutingParameter](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.RoutingParameter), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[RoutingParameter](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.RoutingParameter), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)\n\nNamespace\n---------\n\n[Google.Api](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api)\n\nAssembly\n--------\n\nGoogle.Api.CommonProtos.dll\n\nConstructors\n------------\n\n### RoutingParameter()\n\n public RoutingParameter()\n\n### RoutingParameter(RoutingParameter)\n\n public RoutingParameter(RoutingParameter other)\n\nFields\n------\n\n### FieldFieldNumber\n\n public const int FieldFieldNumber = 1\n\nField number for the \"field\" field.\n\n### PathTemplateFieldNumber\n\n public const int PathTemplateFieldNumber = 2\n\nField number for the \"path_template\" field.\n\nProperties\n----------\n\n### Descriptor\n\n public static MessageDescriptor Descriptor { get; }\n\n### Field\n\n public string Field { get; set; }\n\nA request field to extract the header key-value pair from.\n\n### Parser\n\n public static MessageParser\u003cRoutingParameter\u003e Parser { get; }\n\n### PathTemplate\n\n public string PathTemplate { get; set; }\n\nA pattern matching the key-value field. Optional.\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.\n\nExample: \n\n -- This is a field in the request message\n | that the header value will be extracted from.\n |\n | -- This is the key name in the\n | | routing header.\n V |\n field: \"table_name\" v\n path_template: \"projects/*/{table_location=instances/*}/tables/*\"\n ^ ^\n | |\n In the {} brackets is the pattern that -- |\n specifies what to extract from the |\n field as a value to be sent. |\n |\n The string in the field must match the whole pattern --\n before brackets, inside brackets, after brackets.\n\nWhen looking at this specific example, we can see that:\n\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/*`.\n\n**NB:** If the `path_template` field is not provided, the key name is\nequal to the field name, and the whole field should be sent as a value.\nThis makes the pattern for the field and the value functionally equivalent\nto `**`, and the configuration \n\n {\n field: \"table_name\"\n }\n\nis a functionally equivalent shorthand to: \n\n {\n field: \"table_name\"\n path_template: \"{table_name=**}\"\n }\n\nSee Example 1 for more details.\n\nMethods\n-------\n\n### CalculateSize()\n\n public int CalculateSize()\n\n### Clone()\n\n public RoutingParameter Clone()\n\n### Equals(RoutingParameter)\n\n public bool Equals(RoutingParameter other)\n\n### Equals(object)\n\n public override bool Equals(object other)\n\n**Overrides** \n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object))\n\n### GetHashCode()\n\n public override int GetHashCode()\n\n**Overrides** \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)\n\n### MergeFrom(RoutingParameter)\n\n public void MergeFrom(RoutingParameter other)\n\n### MergeFrom(CodedInputStream)\n\n public void MergeFrom(CodedInputStream input)\n\n### ToString()\n\n public override string ToString()\n\n**Overrides** \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\n### WriteTo(CodedOutputStream)\n\n public void WriteTo(CodedOutputStream output)"]]