Internal API question - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3) +--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7) +--- Thread: Internal API question (/showthread.php?tid=5507) |
Internal API question - eldar - 04-16-2023 Hi! I'm toying with idea of making an alternative client app for Moode player, and been looking into its internal API for displaying music. It's been a while since I touched web development, so my question is likely very silly. I'm trying to figure out an HTTP request to get the all the library contents. I've found the command that should give me what I want, however it returns an empty structure: Code: $ curl http://192.168.0.7/command/music-library.php?cmd=load_library This is strange because the very same API call when debugging in the browser gives me a different output with all the tracks in the database. Am I missing something obvious? RE: Internal API question - Tim Curtis - 04-16-2023 If you are going to use curl commands from the shell then you need to provide some options to create the correct http request to the back end php scripts like below. You could prolly get by with just providing the session cookie (the -b option) but YMMV. Code: curl -X GET -b PHPSESSID=ho7vk67sqrjua8sme0pqhsjgdq -H "Content-type: application/json" -H "Accept: application/json" "IP_ADDRESS_OR_HOST/command/music-library.php?cmd=load_library" RE: Internal API question - eldar - 04-16-2023 Thanks, Tim! This worked, and I'm not sure what is the significance of the specific PHPSESSID value you provided, but it only works with it and not if I try to change it. I'll read up, but this is already very useful for me. RE: Internal API question - Tim Curtis - 04-17-2023 The PHP session id is needed because most of the PHP scripts need r/w access to the session file which contains all the session variables and their values for example $_SESSION['volknob']. You can easily dump the session file using the command below. Note that all the radio station URL's are stored in the session file to make then easy to access from the front-end. Code: sudo moodeutl -d Example using grep to filter the output for a specific set of variables Code: pi@sig:~ $ sudo moodeutl -d | grep library |