Troubleshooting Guide
Upload a Python Script with the POST Script Endpoint
2 min
many of the swimlane restful api endpoints require json payloads however, the post /task/upload script endpoint requires multipart/form data you upload json files from accessing upload a task on the integrations/tasks tab here is an example of a successful post here is the post body payload that needs to be replicated in client python code this python 2 7 code sample, which relies on the swimlane driver for authentication and for ease of retrieving the pertinent application’s id value, illustrates how to make this post from swimlane import swimlane host = 'https //swimlane host' swimlane = swimlane(host, 'user', 'password', verify ssl=false) app = swimlane apps get(name='application name') resp = swimlane request( 'post', '/task/upload script', data=\[ ("taskname", "do some cool secops py"), ("scripttype", "python"), ("appid", app id) ], files={ "file" open(r'c \swimlane\shared\do some cool secops', 'rb'), "contenttype" "text/plain" } ) print str(resp status code) print resp text swimlane supports python scripts and powershell scripts