$API_TOKEN=<YOUR_API_TOKEN>
$cat > input.json << 'EOF'
<{
< "language": "javascript",
< "code": "const chunks = [];\nfor await (const chunk of process.stdin) chunks.push(chunk);\nconst input = JSON.parse(Buffer.concat(chunks).toString() || '{}');\nconsole.log(JSON.stringify({ sum: input.values.reduce((a, b) => a + b, 0), count: input.values.length }));",
< "stdin": "{\n \"values\": [3, 5, 8]\n}",
< "timeoutSeconds": 5,
< "maxOutputBytes": 256000,
< "saveFiles": [],
< "maxSavedFileBytes": 5000000
<}
<EOF
$curl "https://api.apify.com/v2/actors/parsebird~code-runner-sandbox/runs?token=$API_TOKEN" \
< -X POST \
< -d @input.json \
< -H 'Content-Type: application/json'