Search Results

Working with Arrays

Swagger provides an interface description that could return JSON objects. An operation may return a single object, or if the "type":"array" attribute is added to the configuration then it returns an array of that object type. TIBCO BusinessTIBCO Business Studio Studio™ supports sending and receiving arrays in REST requests and responses.

In TIBCO Business Studio, you can create a REST API by starting with a Swagger-compliant JSON file or you can create the API from scratch using the wizards in TIBCO Business Studio. If you use JSON as your starting point, TIBCO Business Studio generates an XSD file when the API gets created. When generating the XSD for an array, TIBCO Business Studio creates a wrapper element with an "Array" suffix and another single element containing the definition for the element type contained in the array. Refer to the Arrays section in the topic Conversion Between JSON and XML in TIBCO Business Studio™ for a detailed explanation of how the TIBCO Business Studio handles arrays.

Note: Do not edit the .xsd file that is generated by TIBCO Business Studio.
Note: The word "Array" is a key word in TIBCO Business Studio. Do not use the "array" suffix in an XSD element name.

Configuring an array in REST binding in TIBCO Business Studio

For projects that were created with a Swagger file that was imported from an external source into the TIBCO Business Studio, you can only view and use the elements. You cannot modify them.
Note: A JSON file is like a contract that must not be broken. Since it is an imported file, its contents cannot be modified and must be followed exactly.
An array appears as follows:

To configure a REST request to get an array, do the following:
  1. In Project Explorer, under Module Descriptors, double-click Components to open its property page.
  2. Click on the resource to open its properties view.
  3. Click the Bindings tab to open it.

  4. In the Operations Details box, click the Response tab.
  5. Select the JSON checkbox in the Format options.
  6. Select Anonymous Array from the JSON Response Style drop-down menu.
  7. Select the array element type in the Resource Schema dropdown menu.
  8. Save your project.
  9. Verify that the array is available for use in the Input tab for your postOut activity.