Invoking REST Services without their Swagger File
Not all REST services have accompanying Swagger files. TIBCO Business Studio™ allows you to invoke a REST service without having access to its Swagger file as long as you have the endpoint URL for the service. You use the REST Reference Wizard in TIBCO Business Studio™ to do so.
Obtain the URL for the service endpoint
Typically, the endpoint URL can be obtained from the web page where the service is described. This web page typically lists the details of the service such as the operations the service supports and the parameters used.
Verify the service is running
You can verify that the service is running by pasting its endpoint URL into any REST client to GET an object. If the service is running, the REST GET operation will return the JSON payload for the object.
Copy the JSON payload to your clip board or a file. You will need this to generate an XML schema for it.
Generate an XML schema from the JSON payload
- Right-click the Schemas folder in Project Explorer and select
Enter a file name for the schema and paste the JSON payload you obtained from the service into the JSON Sample text box and click Next and then Finish.
- Expand the Schemas folder. You should see the generated schema file with the name that you specified. Optionally, view the contents of the file by opening it in the XML Schema Editor (right-click schema file and select ).
Create a new application and open the REST Reference Wizard
- Create a new application to contain your REST reference. Refer to the section, Creating an Application in the Application Development Guide.
- Click the Create REST Reference icon to open the REST Reference wizard.
- Enter the URL for the service in the Service URL text box.
- Select the operations that you want the reference to have by clicking their checkbox(s) and click Next.
- Configure the request and response type for your operations in the Configuring the Operation screen by selecting the request and response type from their respective drop-down menus. Click Finish. The wizard creates a REST reference binding on the left hand side of your Process Editor.
- Open the Reference properties view by clicking on the reference.
- Click the
HTTP Client link to open the HTTP Client Shared Resource configuration page and verify that the
Default Host has been set to the host where the service resides. You can optionally do the following in the Reference properties view:
- Add path parameters for your operation(s) by appending the parameter to the Resource Service Path.
- Configure operation details, such as Request and Response for an operation by clicking on the operation in the Operations table, then configure the Response and/or Request details in their respective tabs in the Operation Details section
- Optionally, you can add an operation using the Create REST Operation wizard. To open this wizard, hover over the REST reference until you see the icon for the wizard, then click the icon:
On the Create new REST Operations page, select the operation you want to create and click Next. Configure the Request and Response for the operation if need be and click Finish. You have the option to configure your request and response for the operation at a later time too from the Reference properties view.
You can now invoke any operation by dragging and dropping it in the process editor.