api:info
Version 22.0.8500
api:info
Version 22.0.8500
The api:info keyword is used to describe the metadata for scripts. This information is used by the application to implement basic error checking on user input and to set default values. The api:info keyword can contain the following:
- Column definitions
- Input parameters the script expects
- Output the script produces
Script Parameters
The following parameters can be defined for the script itself:
- desc[ription]: The description for the script. If a description is not provided, the name of the script is used.
- title: The title of the script. If a title is not provided, the name of the script is used.
- methods: The HTTP methods that can be executed against this script. SELECT, INSERT, UPDATE, and DELETE correspond to HTTP GET, POST, PUT/PATCH/MERGE, and DELETE, respectively.
- url: The URL of the script author.
- keywords: The keywords that describe the script.
Input, Output, and Column Parameters
The api:info keyword has additional parameters contained within its scope that define columns as well as script inputs and outputs. Note these parameters are not APIScript keywords, but additional information for api:info.
input
Input parameters are used to describe inputs to the script.
<input
name="name"
desc="Example of an input parameter"
default="defValue"
req="true"
values="value1, value2, value3"
xs:type="string"
/>
- name: The name of the input. An alphanumeric string that may additionally contain the following: “#” denotes that the input can have multiple values, “myprefix:*” denotes a set of inputs with the same prefix, and a value of “*” denotes arbitrary input parameters.
- desc[ription]: A short description of the input.
- xs:type: The data type of the input. The string, int, double, datetime, and boolean types are supported.
- def[ault]: The default value to be used when no input value is supplied in the script call.
- key: Whether the input is a primary key.
- req[uired]: Whether the input is required. The engine will throw an error if the required input is not supplied and there is no default value defined. Allowed values are true and false.
- values: A comma-separated list of the allowed values for the input. If specified, the engine will throw an error if the specified input does not match one of the allowed values.
- alias: The alias of the input.
- other: Attributes prefixed with “other:” that provide extra information. These other properties can be operation specific.
output
Output parameters describe the output of the operation. However, they are ignored by the application. Thus, the output of the operation can be entirely independent of what is defined in the info block.
<output name="Id"
desc="The unique identifier of the record."
xs:type="string"
other:xPath="content/properties/Id"
/>
- name: The name of the output. “myprefix:*” denotes a set of outputs with the same prefix, and a value of “*” denotes arbitrary output parameters.
- xs:type: The data type of the output. The string, int, double, datetime, and boolean types are supported.
- desc[ription]: A short description of the output.
- columnsize: The maximum character length of a string or the precision of a numeric output. The precision is the number of digits.
- other: Attributes prefixed with ‘other:’ that provide extra information about the output. For example, other:xPath specifies the XPath to a node in a local or remote resource. The XPath can be relative to a RepeatElement.
Examples
Describes the inputs to the After Receive event:
<api:info title="After Receive" desc="This event is fired after receiving a file.">
<input name="Filename" desc="The name of the file that was sent." />
<input name="FilePath" desc="The path of the file that was received." />
<input name="MessageId" desc="The Id of the transmission." />
<input name="ErrorMessage" desc="If an error occurred, this will contain the error message." />
</api:info>
See Also
- api:script: Create a script block.
- api:call: Call scripts or operations.
- api:set: Set attributes in an item.