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 Business Studio™ for BusinessWorks™ supports sending and receiving arrays in REST requests and responses.

In TIBCO Business Studio for BusinessWorks, 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 for BusinessWorks. If you use JSON as your starting point, TIBCO Business Studio for BusinessWorks generates an XSD file when the API gets created. When generating the XSD for an array, TIBCO Business Studio for BusinessWorks creates a wrapper element with an "Array" suffix and another single element containing the definition for the element type contained in the array.

For more information about how the TIBCO Business Studio for BusinessWorks handles arrays, see the Arrays section in the topic Conversion Between JSON and XML in TIBCO Business Studio™ .

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

Configuring an array in REST binding in TIBCO Business Studio for BusinessWorks

For projects that were created with a Swagger file that was imported from an external source into the TIBCO Business Studio for BusinessWorks, 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 check box 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 drop-down menu.
  8. Save your project.
  9. Verify that the array is available for use in the Input tab for your postOut activity.