curl --request POST \ --url http://localhost:3000/api/v1/scripts \ --header 'Authorization: Basic OmJsYWNrU3dhbjEyMw==' \ --header 'Content-Type: application/json' \ --data '{ "script":{ "id": -1, "lang": "lua", "name": "new_script_created", "source": "\n-- This is a sample script\n-- Fill in the onRecord function to transform the incoming record\nlocal json = require \"json\"\n\nfunction onRecord(r)\n return json.encode(r.row)\nend" }}'
If successful, returns the ID of the created or updated script
curl --request POST \ --url http://localhost:3000/api/v1/scripts \ --header 'Authorization: Basic OmJsYWNrU3dhbjEyMw==' \ --header 'Content-Type: application/json' \ --data '{ "script":{ "id": -1, "lang": "lua", "name": "new_script_created", "source": "\n-- This is a sample script\n-- Fill in the onRecord function to transform the incoming record\nlocal json = require \"json\"\n\nfunction onRecord(r)\n return json.encode(r.row)\nend" }}'