Building the URI Template Example

This section provides examples for building the URI Template.

To build a URI template using the Template Builder:

  1. Select the Document Template.

    Note:

    The document template must contain the values for the variables you plan to build out in the URI template.

  2. For OpenAPI REST Service Operation add the root resource.

  3. Select the Root Resource from the drop down list.

  4. Click the Build link for the resource.

  5. The root is displayed in the URI Template field.

  6. In the Separator section click Append to URI or enter a / (slash).

  7. In the Expression Workspace section, select the control to use Primitive or Collection.

  8. Select the Primitive or Collection value from the drop down list.

  9. Click Add.

    The element is added in brackets in the Expression Workspace.

  10. Click Append to URI.

  11. If you are adding another parameter, click the Add Separator then repeat steps 4 to 7.

  12. After adding all the parameters, click OK.

Example Primitives

To add primitives:

  1. In the Expression Workspace, from the Expression Type drop-down list, select Simple String.

  2. Click Primitive. and from the Primitive drop-down list, select state and click the Add button

    The {state} expression appears in the expression field.

  3. Select the primitive from the drop-down list.

  4. Click Add button.

    The primitive is shown in brackets in the Expression Workspace.

    This example illustrates the Expression Workspace for adding a primitive.

    Expression Workspace for adding a primitive
  5. Click Append to URI to add the primitive to the URI Template.

Example Collection

To add a collection:

  1. In the Expression Workspace, select Collection.

  2. Use the Collection drop down list to select the collection from the Document Template.

  3. Click Add.

  4. Select Add Explode Modifier if applicable.

    This example illustrates the Expression Workspace when adding a collection to the URI.

    Collection example
  5. Click Append to URI.

Example Constant

To add a constant to the URI:

  1. In the Constant section, enter the constant value.

    This example illustrates the Constant section.

    Constant section
  2. Click Append to URI button.

    The string is added to the URI Template field and the template is complete.