CallApi

You can review all of the details about teh CallAPI.

Description

The callApi JSP tag calls an API from within the JSP file. In most cases, it is not necessary to make an API call from inside a JSP file. However, occasionally there is no other option. For example, when an API must be called multiple times within a loop, use the callApi JSP tag.

When you use this JSP tag on a view, you may enable the Skip Automatic Execution checkbox on the Resource configuration screen for the API Resource that you intend to call. This prevents the API from being called when the view is initially opened. This option is not available for API resources that are created directly under an entity resource.

Attributes

apiID - Required. Postfix of the resource ID of the API to be called. When an API resource is configured through the Resource Hierarchy tree, a postfix must be supplied for the resource ID. This is the postfix value that must be used.

Body

None.

Example

In this example, the callAPI is used to retrieve additional attributes about an item using the getItemDetails() API defined in the API resource containing the API in the ID. Note that the API input or template is not specified anywhere in the JSP. This is configured in the API resource definition just like every other API.

<yfc:loopXML binding="xml:/OrderLineStatusList/@OrderStatus" id="OrderStatus">
   <tr>
      <yfc:makeXMLInput name="orderLineKey">
       <yfc:makeXMLKey binding="xml:/OrderLineDetail/@OrderLineKey" 
value="xml:/OrderStatus/OrderLine/@OrderLineKey"/>
       <yfc:callAPI apiID='AP1'/>
  <... >
   </tr>

After the callApi JSP tag is used in the JSP, the output is available in the corresponding output namespace.