About output XML files and templates for APIs
APIs return data using two types of output XML files that define which elements and attributes are required by an API.
- Output XML File - Defines the outer limits of the data an API can return. Do not modify output XML files.
- Template XML File - Defines the data returned by an API for the record specified in the input XML file and restricts the amount of data to a subset of the output XML. You can modify this file to incorporate a subset of the attributes and elements from the output XML.
Output XML templates
Many APIs use a corresponding output template. The output template is in XML format and is read in by an API in order to determine the elements and attributes for which it should return. The standard output template defines the elements and attributes returned for any specific API. (To see the entire range of possible values an API can return, see its output XML in Javadoc.) The standard template can be a subset of the entire range of values returned, as determined by the output XML in the Javadoc.
For example, the standard output template of the getOrderList() API returns the header-level information of an order and the standard output template of the getOrderDetails() API returns in depth information about an order.
Besides the standard output XML template, you can create custom output templates for APIs to use for your own business requirements, such as different output for different document types.
Document types
If you use a variety of business-related document types such as orders, planned orders, purchase orders, and returns, you can use custom templates that enable an API to return the values that pertain to each unique document type.
For example, you can use one template with the
getOrderDetails()
API to return information about Planned Orders and another
template for the getOrderDetails() API to return different information about
Orders.
Standard output template behavior
The set of values that the standard output template returns covers a variety of business scenarios. With such a large range of possibilities, an API using the standard output template may return much more data than you need for your business purposes (and take much more time to process than you prefer).
If you want to customize the information returned by an API, you can do so by creating and using a custom template, using our guidelines and procedures.