The Network Optix Media Server allows you to execute silent, non-interactive scripts directly through the REST API. This feature is ideal for automating server-side tasks using Batch, Bash, or Python.
1. Preparing Your Scripts
Before you can execute a script via the API, it must be placed in a specific directory on the server machine. You may need to create the scripts folder manually if it does not already exist.
File Locations
Depending on your Operating System, navigate to the following path, and ad your scripts there:
Windows:
C:\Windows\System32\config\systemprofile\AppData\Local\Network Optix\Network Optix Media Server\scriptsUbuntu/Linux:
/opt/networkoptix/mediaserver/var/scripts2. Managing Scripts via API
Once your files are in the correct folder, you can interact with them using the REST v4 endpoints.
List Available Scripts
To see a list of all scripts currently recognized by the server, use the following request:
GET /rest/v4/servers/{id}/scriptsExecute a Script
To trigger a script, send a POST request.
Endpoint:
POST /rest/v4/servers/{id}/scripts/{name}/runRequest Body:
{
"args": [
""
],
"waitForFinished": true
}Important Considerations
Non-Interactive Only: Scripts must be able to run without user input (no GUI pop-ups or "Press any key" prompts), as they run in the background service context.
Security: Access to these endpoints should be restricted to authorized administrators, as it allows for code execution on the server host.
Comments
0 comments
Article is closed for comments.