To get started with creating Endpoints and Handlers, take a look at our Quickstart guide.
Pipeline
Each endpoint defines a Handler object to instruct Formata Services on how to handle a call to the endpoint. Instructions for the Service come in the form of a pipeline of Jobs. This is an array of objects that contain instructions for performing actions within the Lattice. An overview of these terms and how to get started can be found in the Quickstart guide.
AseScript Type Definition
/** * Handler object defined in the Endpoint. */typeHandler {/** * Array of Jobs. * Jobs can be an object, a function that returns an object, * or a string that represents a function to call (scope.name). */ pipeline: array;}/** * Job object within the Handler pipeline. * Fields are listed in the order of execution/interpretation. */typeJob {/** * Name of this Job (required). * Data created by this Job will be organized in the Reply according * to it's name. */ name: string;/** * Await this job before executing the next in the pipeline? * Jobs are async by default. * Enables jobs to use the data from prior Jobs. */ await: bool =false;/** * Init function to call (optional). * Can be a string representing the function (scope.name) * or a function pointer (fn). * * (): bool - No parameters, return whether Job should run as a bool. * (): object - No parameters, return Job object to run. * (job: object): bool - Job parameter, return whether Job should run. * (job: object): object - Job parameter, return Job to run. */ init: fn =null;/** * Static data to add to this Job's Reply (optional). * This field can also be a function pointer that returns an object. */ static: object =null;/** * REST request object (optional). * This field can also be a function pointer that returns a Rest object. */ rest: Rest =null;/** * Sub-Job array. * Jobs in this array create Replies under this Job's name. */ jobs: array = [];/** * Function to call for this Job (optional). * Gets called at the end of the Job - must await sub-jobs to use their data. * Can be a string representing a function or a function pointer. */function: fn = null;}/** * REST request object. * Enables Jobs to call out to REST endpoints. */typeRest {/** * URL (required). */ url: string;/** * Method string (get, put, patch, delete, head, post, etc..). * Defaults to 'GET' (not case sensitive). */ method: string ='get';/** * Headers object (optional). * Ex. { Authorization: 'TOKEN' } */ headers: object =null;/** * Format (optional) - default is JSON. * This is the format of the request body to send. * Can be 'json', 'ase', 'yaml', 'xml', 'toml', 'urlencoded', or 'text'. * If you don't see your format listed, contact support@formata.io. */ format: string ='json';/** * Request body object (optional). * Can also be a function pointer that returns an object. * This body gets turned into the format specified above for the request. */ body: object =null;/** * Treat the incoming Message as the request body if true. * Ignored if a 'body' object is specified. */ messageBody: bool =false;}