Modifying a REST Resource Configuration File

Procedure

  1. Select a REST Binding on a reference.
  2. In the Properties View, click on the hyperlink of the REST resource configuration file.
    This displays the REST Resource Configuration File Editor.
  3. Specify the Context Root.
  4. Select the Media Type - Standard JSON or XML. The default is Standard JSON.
    Note: This Media Type applies to all operations. You cannot set the Media Type at an operation level. This Media Type applies to both the request and response of each operation, that is, the default value of "Content-Type" and "Accept" header is derived from Media Type.
  5. Click to add a resource. In the Details Section, specify the following resource details.
    • Resource Name: resource name must be unique.
    • Resource Path: Resource Path is the path used to access a resource. It is appended to the value of Context Root.
      Note:

      The URL is a combination of the following: <machine_name>:<port>/<ContextRoot>/<Resource>.

      In TIBCO ActiveMatrix, a WSDL is usually created with operations in it. If a REST service hosts this WSDL, each operation name has a 'Path' (or Resource Path) associated with the operation. The 'Path' may be different from the Operation Name. This 'Path' must be mapped to the corresponding 'Resource' in the REST Resource Configuration file on a reference.

    • Path Parameters: To create a path parameter, create a Path variable represented as {path parameter}. For example, Resource path to access a book with Id is "/book/{id}" where {id} is Path Parameter. Path Parameters are added automatically to the table based on the Resource Path value. In the table, you can edit the data type but you cannot add or remove parameters. Path Parameters cannot be null or empty.
  6. Click to add an operation to a resource. In the Details Section, specify operation details such as Operation Name and HTTP Method. Operation Name must be unique across all resources. You can select GET, PUT, POST, or DELETE as the HTTP Method. The default is GET. For each operation, specify the following request and response details, as appropriate.
    Request or Response Type of Request or Response Procedure
    Request

    A request configuration includes query parameters, header, and body. Query parameter and header name cannot be null or empty. Header name cannot be "Accept" or "Content-Type".

    NOTE: The Body (JSON) or Body (XML) sections are not displayed if HTTP Method is set to GET or DELETE.

    Standard JSON Request In the Rest Resources section, select Request under Operation.

    In the Details Section, click to add the query parameters or header. In the Body (JSON) section, provide the JSON payload details.

    XML Request In the Rest Resources section, select Request under Operation.

    In the Details Section, click to add the query parameters or header. In the Body (XML) section, select the XSD element by clicking -not set- hyperlink or by clicking .

    NOTE: All the XSD files needed for the configuration of the RRC must be placed in the Service Descriptors folder. This includes all imported XSDs from within an XSD.

    XSD Element picker only shows XSD Element and not XSD Types.

    Response

    A response configuration includes a body.

    Standard JSON Response In the Rest Resources section, select Response under Operation.

    In the Details Section, specify the details in the Body (JSON) section or select the JSON file using the file picker.

    XML Response In the Rest Resources section, select Response under Operation.

    In the Details Section, select the XSD in the Body (XML) section.

  7. Click to add an error type to an operation.
    One operation can have multiple error types. Every error type must be associated with either a single or a list of HTTP Status Codes. If a list of status codes needs to be specified, separate them with a comma.
  8. To generate a WSDL file from the .rrc file, select the .rrc file in the Project Explorer window, and then select Generate WSDL from the shortcut menu.
    A WSDL along with XSD (in case of Standard JSON) is generated.
  9. Configure the reference using the WSDL generated in step 8.
    Note: On the REST reference side, you must use only the WSDL generated from the REST Resource Configuration File Editor to configure the reference. Do not manually edit a WSDL generated from the REST Resource Configuration File Editor. Make sure that the WSDL and the .rrc file are always in sync with each other. That is, if you make changes in the REST Resource Configuration File Editor, always regenerate the WSDL file.