Sending http command to play playlist


I’ve just bought Alexa and I would like trigger my musicbox by saying Alexa, play musicbox playlist ‘name’. How could I send an http command to start musicbox playing my playlist. I found something in runeaudio like ‘runeaudio.local/command/cmd?pause%201’ but musicbox.local/command/cmd?pause%201 doesn’t work. I could make it sending some POST / GET Method etc, but didn’t find how to make it. Any idea ?

I have been looking through the forum and I’ve found your advice. The Problem is that I can not make it work. Could you send me an working example to simply paste into browser ?

what is not working for you? the HTTP api?
can you just give it a try with the first command listed on the page:
curl -d ‘{“jsonrpc”: “2.0”, “id”: 1, “method”: “core.playback.get_state”}’ http://localhost:6680/mopidy/rpc

you should Need:
TracklistController.add API Link API Link

With the first command I did success, the simple REST client shows 200 Status OK (First Foto).
But if I try to make anything else like, tlid=None) which shoul plat currently active track it shows the following error comment: {“jsonrpc”: “2.0”, “id”: 1, “error”: {“message”: “Method not found”, “code”: -32601, “data”: “No object found at “PlaybackController””}} (second Foto)
Perhaps I should first add one of my playlist (third foto) using TracklistController.add(tracks=None, at_position=None, uri=None, uris=None) and then try to play it ? What should be URI or URIS of playlist taken from spotify ?


I’m perhaps one step farther and I see that I need first to add an playlist I want to play and then easily play the songs from playlist. I got stuck - I can’t add the Tracklist :frowning:

please red the documentation:

All methods in the mopidy.core — Core API is made available through JSON-RPC calls over the WebSocket. For example, is available as the JSON-RPC method

so you should try
Preformatted text{“jsonrpc”: “2.0”, “id”: 1, “method”: “”}

to load a Playlist use “tracklist”:

to get the corresponding uri for the Playlist :slight_smile:

not tested, but that should work

Thanks Chises a lot,

I got it!.

The post data must look like this:
{“jsonrpc”: “2.0”, “id”: 1, “method”: “core.tracklist.add” , “params”: {“uri”: “spotify:user:name.surname:playlist:3hFZXMRiV3JMBqAbzzgI5H”}}

, and the right playlist is being loaded, after it I send command
{“jsonrpc”: “2.0”, “id”: 1, “method”: “”} or {“jsonrpc”: “2.0”, “id”: 1, “method”: “core.playback.stop”}
or {“jsonrpc”: “2.0”, “id”: 1, “method”: “”} or {“jsonrpc”: “2.0”, “id”: 1, “method”: “core.playback.previous”}

The only thing I can’t get the playlist as you wrote to get
{“jsonrpc”: “2.0”, “id”: 1, “method”: “core.PlaylistsController.as_list”}
gives an error: {“jsonrpc”: “2.0”, “id”: 1, “error”: {“message”: “Method not found”, “code”: -32601, “data”: “No object found at “PlaylistsController””}}
but I thing it’s older mopidy version (I have musicbox v0.6) and perhaps I have an older version of mopidy ?

1 Like

As per the docs, and like all the other commands you have issued, you don’t use the class name (PlaylistsController), you use the instance name playlists. So it’d be core.playlists.some_method.

Since you are using Musicbox’s old version of Mopidy, your playlist controllers don’t have an as_list method. You need to use the playlists attribute as per the 0.19 API. Just like accessing any other attribute over JSON RPC you need to use the getter function so it’d be core.playlists.get_playlists.

Now it’s all clear. Thanks a lot!

No problem. If you get a chance, It’d be interesting to see what you end up with. I’m sure other Musicbox users would also like to see what sort of integration is possible.


Thank you for actually posting your working example.

All of the other people in this thread post “go look at the docs duuuuuhhh”. News flash: the docs are not always that helpful or up to date. Some people learn by example.

I did read the docs, they weren’t that helpful. I mean seriously, they don’t even document their API, they just say there is a magic mapping between core controller methods and API endpoints. For example, it was not clear that you needed to provide a JSON object called “params” which contained the parameters for the controller method calls.

Again, thank you fondoftri.

We do link to the standard which does have examples of method calls with parameters ( But I appreciate it’s a bit wordy and not a cut-and-paste example.

The full API is documented and once you see the transformation to json rpc it doesn’t seem necessary to include the entire thing in that format. Perhaps just some more examples, specifically some with parameters, would help. We mention the params in passing in the js module documentation but I agree we could reproduce and expand on that for the rpc documentation.

The documentation does recommend the Mopidy-API-Explorer extension to get you familiarized with HTTP based APIs. You can find it at I’ve not played with it in a while but it should still be functional.

If you have any other speicifc ideas please let us know or better yet, create a Pull Request.