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" }}'
{ "id": 1}
Scripts
Create script
POST /api/v1/scripts
This endpoint is used to create a new script or update an existing one.
If the script ID in the request is -1, a new script is created.
Otherwise, the existing script with the given ID, if existing, is updated.
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" }}'