REST API description: Difference between revisions

no edit summary
(mention 4.1 changes)
No edit summary
Line 576: Line 576:
             shutil.copyfileobj(resp.raw, fh)
             shutil.copyfileobj(resp.raw, fh)


</pre>
==== Python Script Example - POST command to pause ring buffer ====
This script sends a HTTP POST command to suspend the ring buffer #0 (first ring buffer).
<pre>
#! /usr/bin/python3
import requests
import json
requests.packages.urllib3.disable_warnings()
host = "https://allegro-mm-xxxx"
session = requests.Session()
session.auth = ("user", "password")
session.verify = False  # disable ssl verification
data = {
    "command": "changeConfig",
    "config": { "isSuspended": True }
}
with session.post(f"{host}/API/data/modules/capture/buffer/0", data=json.dumps(data)) as resp:
    print(resp.text)
</pre>
</pre>
546

edits