Creating REST Provider

This section explains the process of creating web service provider service for RESTful Web Service. 

Follow the steps below to create a REST Provider:

  1. Click Configure > WEB SERVICES > REST Provider.

  2. Click Create REST Provider
  3. In Create REST Provider window, type the name and description of the new Web Service Provider service in the Name and Description fields respectively.



  4. In the Character Set Encoding field, enter the character set encoding for the REST Provider that you are creating.

    By default, this field displays the character set encoding that you have defined at the application level. In case the character set encoding for the REST Provider that you are creating is other than the default one (UTF-8), you can change this in the Character Set Encoding field.
  5. Select either Process Flow or Template based on how you want to publish this REST Provider.  

    The REST providers that are published as Process Flows and set to be executed in Sync mode bypass the queue and get executed immediately.
  6. Select the Asynchronous check box if you want the Transaction based on this Template (with REST Webhook as a source) to be asynchronous.

    This field is available only when you publish the REST Provider as a Template.  
  7. Select Enable SSL check box if you want the REST Provider service to offer a SSL security.

    If you select Enable SSL, this REST provider will be published over SSL and use SSL configuration (KeyStore, TrustStore etc.) defined for the port that you select in the next step.
  8. In the Select Port field, select the port on which you want to publish the REST provider.

    All the ports that are available on API Gateway will be visible in this field. You can also define/edit/delete a custom port through an environment variable in values.yaml file. Click here to know how to configure the ports. 
  9. In the API Version field, enter the API Version. For example, your API version can be 1.1.
  10. In the Resource End Path field, enter the resource end path URL. The URL can be static or dynamic.
    Static URL example: /rest/WeatherForecast
    Dynamic URL example: /rest/{ServiceName} where service name is a variable, for example, WeatherForecast.  

    The variable name in the Dynamic URL must be in the curly braces {}.  
  11. In the Process Flow Name field, select a Process Flow to trigger with the REST provider.

    This field is available only when you publish the REST Provider as a Process Flow.  
    1. The selected Process Flow must have Context Source and Context Target activity – GET and DELETE can only have Context Target, whereas PUT and POST can have both Context Source and Context Target activity.
    2. The parameterName attribute of the Context Source should be restRequest.
    3. The parameterName attribute of the Context Target should be restResponse.
  12. In the Resource Parameter section, enter the name, default value, and style in the respective fields to define the parameters that you want to pass.

    To pass a parameter as a part of HTTP header, select Header in the Style field corresponding to that parameter.
  13. Click Add Method.

  14. In the window that opens on your browser, do the followings to add a method to your activity. 

    1. In the Method Type field, select the type of method. 

      • When the REST Providers is published as a Process Flow, all the method types PUT, GET, POST, and DELETE are available.

      • When the REST Provider is published as a Template, only PUT and POST method types are available. 

    2. In the Method Parameter section, define the method parameters. Enter the name, default value, and style in the respective fields.

      To pass a method parameter as a part of HTTP header, select Header in the Style field corresponding to that parameter.
    3. In the Presentation section, set the Media Type as application/text, application/xml, or application/json based on your requirement. If you set the Media Type as xml or json, select a Layout (Schema) for the respective media type. 
    4. Set the Status Code for Request, Response, and Fault.
    5. In the Response Header section, define the headers. Type the response header names and values in the respective fields.
    6. Click Save.
      This will add the method in Method Parameter section in the Create REST Provider page.
  15. In the Security Policy field, select a security policy .

    For information on how to create a Security Policy, refer to Creating Security Policy for Web Service

    The RESTful Web Service Provider supports both basic and API authentication.

  16. Expand the Advanced Properties section

  17. Select a project from the Project field.

  18. Click Save.

The REST provider once published as a template can be used as a Source in a Template . For more details, refer to the page Using REST Webhook in a Template.

After you have finished creating the REST Provider:

  • You can see its type (Template or Process Flow) under the TYPE column on the REST Provider manage page.
  • You can also publish or unpublish the REST Provider from the same page, click here for more details.
  • You can add the API Documentation.

When a RESTFul web service is invoked by a Consumer, following information is saved in the Process Flow context:

Variable Name

Description

InvokedURLURL which has been hit by the consumer
InvokedMethodMethod through which the Web Service has been invoked – GET, POST, PUT, DELETE
InvokedResourceEndPathContains the actual ResourceEndPath from the invoked URL

You can view the value of these variables in Process Flow context, within Process Flow Logs.

You can also view these variables within your Process Flow using put-context-var action.