Developer Guide
Python Task API
3 min
swimlane has a rich api for interacting with python scripts inside the integration platform on each script's initialization, swimlane automatically passes information about the task to each script through a sw context object context objects contain the following inputs the input parameters defined in the task configuration these parameters can be literal values, record values, or values from assets here's is an example sw context inputs\["ipaddress"] the task api passes data between the swimlane platform and integration tasks as serialized json, which means all the data passed then is converted into character strings config system level attributes and internal ids, including swimlaneurl the base url of the swimlane install (i e http //swimlane mycorp com http //swimlane mycorp com ) recordid the id of the record that executed the script, if applicable applicationid the application id of the record that triggered the script, if applicable for example sw context config\["swimlaneurl"] asset information the parameters used to configure the asset, such as an access token or password, associated to the task when a script is executed as a packaged action when the script has completed, developers can attach to a global array of dictionaries as output variables messages that are printed to the standard output can also be captured considerations there are a few scenarios to be aware of when developing task scripts attachments attachments from emails or record attachment fields that are mapped through the input parameters will be a byte array dates dates that are passed will automatically be converted to utc python date objects rather than a string representation when entering dates for api get calls, format the date as follows 2017 01 01t05 00 00z do not use sys exit() in your python script tasks it will terminate the integration process and will not return any results to swimlane more on setting up inputs and outputs, and setting up the asset sw context information debugger and the output mapping section