APIScript

Version 23.0.9145


APIScript

Version 23.0.9145


CData has its own configuration language called APIScript that you can use to mark up schemas for your API resources. APIScript hides the complexity of interacting with the underlying data source through REST APIs. You can use the wizard in the administration console to generate schemas for connecting to databases through REST APIs.

However, APIScript is also a high-level programming language that enables you to control almost every aspect of data access and processing. Your schema is a script interpreted by the APIScript engine.

You use keywords, attributes, items, operations, and feeds to write scripts:

  • Attribute: The name part of a name-value pair, as in attribute="address", value="123 Pleasant Lane".
  • Item: A related group of attribute-value pairs that describe an input or output. For example:

    Attribute="name" value="Bob"
    Attribute="address" value="123 Pleasant Lane"
    Attribute="phone" value="123-4567"
    
  • Feed: A list of items. For example, a list of customers with their addresses and phone numbers.
  • Operation: A generic name for methods that accept items as input and produce feeds as output.
  • Keyword: An APIScript statement, like api:set.

APIScript includes many keywords that allow you to do the following:

  • Describe and validate the behavior of your API resources.
  • Use high-level programming constructs such as if/else statements and case statements to control execution flow.
  • Call operations and define your own.
  • Create and modify items, the inputs to an operation, and feeds (the operation’s result).
  • Process the feed resulting from an operation call by iterating through its items.