---
title: "Test Script function"
method: POST
path: "/api/ruleChain/testScript"
tags: ["rule-chain-controller"]
---

# Test Script function

`POST /api/ruleChain/testScript`

Execute the Script function and return the result. The format of request: 

```json
{
  "script": "Your Function as String",
  "scriptType": "One of: update, generate, filter, switch, json, string",
  "argNames": ["msg", "metadata", "type"],
  "msg": "{\"temperature\": 42}", 
  "metadata": {
    "deviceName": "Device A",
    "deviceType": "Thermometer"
  },
  "msgType": "POST_TELEMETRY_REQUEST"
}
```

 Expected result JSON contains "output" and "error".

Available for users with 'TENANT_ADMIN' authority.

## Query parameters

- `scriptLang` 'JS' | 'TBEL'

## Request body

- unknown

## Response `200`

OK

- unknown

---

[API](https://skmtc.net/thingsboard/apis/thingsboard-rest-api.md) · [All operations](https://skmtc.net/thingsboard/apis/thingsboard-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/thingsboard/thingsboard-rest-api/revisions/40169ccdec5c/schema)
