Skip to content

AddUrlParameter

Sets the value of a {name} placeholder in the resource path.

1
myRestRequest.AddUrlParameter(name: string, value: string):RestRequest

Parameters

string name
    The name of the URL parameter.

string value
    The value of the URL parameter.

Returns

The current RestRequest instance.

Remarks

The name and value arguments are required. The value is URL-encoded.

Examples

Build a URL from placeholders

1
2
3
4
5
6
// GET https://api.example.com/customers/42/orders/1001
var order = $Rest.Create('https://api.example.com/')
    .Request('customers/{customerId}/orders/{orderId}')
    .AddUrlParameter('customerId', '42')
    .AddUrlParameter('orderId', '1001')
    .ExecuteJson();

See Also