Using Variables in REST Client Method URLs

When you specify the method URL for a REST client, you can include one or more variables that are resolved at runtime.

Variables give you some flexibility in specifying the method URL. Using a variable involves two steps

  1. Insert one or more variables, delimited with braces, in the method URL.
    Variable expressions in the URL must be strings or string variables.

    For example, this URL specification includes two variables:

    http://myorg.com:7000/webHttpNone/Service.svc/xb/{format}/{type}
  2. Provide the replacement values as parameters to the method that you use to call the service.

    This sample code defines parameters for the two variables shown in the preceding URL:

    TestService svc
    svc = create TestService
    string  ret
    ret = svc.GetMessage("XML","string")
The RestService engine resolves the variables at runtime. In the preceding example, the URL is resolved as:http://myorg.com:7000/webHttpNone/Service.svc/xb/XML/string.