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.
Configuring an array in REST binding in TIBCO Business Studio
- In Project Explorer, under Module Descriptors, double-click Components to open its property page.
- Click on the resource to open its properties view.
- Click the
Bindings tab to open it.
- In the Operations Details box, click the Response tab.
- Select the JSON checkbox in the Format options.
- Select Anonymous Array from the JSON Response Style drop-down menu.
- Select the array element type in the Resource Schema dropdown menu.
- Save your project.
- Verify that the array is available for use in the
Input tab for your postOut activity.