04-05-2020, 08:38 PM
Included in moOde is a command API accessible via HTTP and ssh.
Using ssh is pretty self-explanatory but accessing the API via HTTP may not be.
Yes, you can manually type commands like
Linux, macOS, and Windows 10 [1] now all include a command-line tool named curl (sometimes written in text as cURL). This is a classic "Swiss Army knife" tool with lots of options. With it, we can easily script HTTP-based commands to the moOde API.
You can read the curl man page, but here's some examples of its use with moOde to get you started.
The -G option tells curl to send an HTTP GET request rather than a POST request. Essentially this causes the same HTTP transaction as the "?" in the http://moode/command/?cmd=... strings does in browsers.
The -d (or --data) option indicates the item following it is the request payload.
Be sure to use the correct hostname or IP for your moOde player.
Use and enjoy.
Regards,
Kent
[1] I don't own any Macs so I have to rely on what I read on the InterWeb. I've used curl in both Linux and Windows 10 systems (in cmd.exe, Powershell, and, of course, any Linux installed in Windows Subsystem for Linux).
Using ssh is pretty self-explanatory but accessing the API via HTTP may not be.
Yes, you can manually type commands like
- http://moode/command/?cmd=play
or
- http://moode/command/?cmd=vol.sh up 2
Linux, macOS, and Windows 10 [1] now all include a command-line tool named curl (sometimes written in text as cURL). This is a classic "Swiss Army knife" tool with lots of options. With it, we can easily script HTTP-based commands to the moOde API.
You can read the curl man page, but here's some examples of its use with moOde to get you started.
Code:
curl -G http://moode/command/ -d "cmd=play"
curl -G http://moode/command/ -d "cmd=vol.sh up 2"
The -G option tells curl to send an HTTP GET request rather than a POST request. Essentially this causes the same HTTP transaction as the "?" in the http://moode/command/?cmd=... strings does in browsers.
The -d (or --data) option indicates the item following it is the request payload.
Be sure to use the correct hostname or IP for your moOde player.
Use and enjoy.
Regards,
Kent
[1] I don't own any Macs so I have to rely on what I read on the InterWeb. I've used curl in both Linux and Windows 10 systems (in cmd.exe, Powershell, and, of course, any Linux installed in Windows Subsystem for Linux).