Anthony Musgrove 220 Posted March 30, 2025 Posted March 30, 2025 Hey guys, I just thought I'd give you an update on Scripter-X v6.0.0.5 on the catalog, with regard to JSON payload posting. I've added an internal processor WEB:POSTJSON You can send json payload based on any logic criteria, using any of the supported Scripter-X events using simple actions, and both the URL and the payload file is token supported. If you'd like more information, please check out the wiki page: https://wiki.emby-scripterx.au/en/processors/web test_payload_webpost.json: { "user": { "id": "%user.id%", "username": "%username%", "password": "%password%" }, "device": { "id": "%device.id%", "name": "%device.name%", "ip_addr": "%device.remote.ipaddress%" }, "server": { "name": "%server.name%", "version": "%server.version%" }, "scripterx": { "version": "%scripterx.version%" } } example testendpoint.php: <?php //test web:post endpoint $data = file_get_contents('php://input'); $new_log_entry = "\r\n ============================ \r\n"; $new_log_entry .= "Date/Time: ".date("Y-m-d h:i:sa")."\r\n"; $data_processed = json_decode($data, true); $new_log_entry .= "Processed Json: ".print_r($data_processed,true)."\r\n"; file_put_contents('/path/to/writeable/endpoint.log', $new_log_entry, FILE_APPEND | LOCK_EX); example yielded log (endpoint.log): ============================ Date/Time: 2025-03-30 09:36:45pm Processed Json: Array ( [user] => Array ( [id] => 0 [username] => asdfasdf [password] => sadfasdf ) [device] => Array ( [id] => e396607d-b63c-4326-a899-32088a3ef612 [name] => Microsoft Edge Windows [ip_addr] => ::1 ) [server] => Array ( [name] => DESKTOP-5GKNOAV [version] => 4.8.11.0 ) [scripterx] => Array ( [version] => 6.0.0.4 ) ) as always, the sky is the limit - your creativity is the canvas with ScripterX. If you have any questions or queries, please let me know. ScripterX also supports email and secure email, however I haven't revised and documented these functions for the wiki yet, that will come shortly. Kind regards, Anthony 1
Anthony Musgrove 220 Posted March 30, 2025 Author Posted March 30, 2025 You're welcome @Luke I've also updated WEB:POST to do exactly that, send a POST formatted query string to an endpoint. I've also updated the wiki to reflect this: https://wiki.emby-scripterx.au/en/processors/web web:post When you need your action to send a standard POST data packet (like submitting a HTML form for example), use web:post. Run: URL to your endpoint, for example https://myserver.com/myendpoint.php or https://myserver.com/myendpoint.php?username=%username% This field supports tokens using: web:post Parameters: Formatted POST data string, tokenizable, please see example below. This field supports tokens where: (optional) configure logic for matching this rule to required event conditions & filters Formatted POST data string example: username=%username%&device_name=%device.name%&password=%password%&ipaddr=%device.remote.ipaddress% Copy Example myendpoint.php: <?php //test web:post endpoint $new_log_entry = "\r\n ============================ \r\n"; $new_log_entry .= "Date/Time: ".date("Y-m-d h:i:sa")."\r\n"; $new_log_entry .= "Posted Data: ".print_r($_POST,true)."\r\n"; file_put_contents('/path/to/endpoint.log', $new_log_entry, FILE_APPEND | LOCK_EX); Copy Example endpoint.log result: ============================ Date/Time: 2025-03-31 10:14:55am Posted Data: Array ( [username] => asdfasdf [device_name] => Microsoft Edge Windows [password] => sadfasdf [ipaddr] => ::1 ) Copy
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now