How to use the addToQueue-Api?

I’m Marco from North-Germany. So I say: Sorry for my broken English. :wink:

My Project:
Raspberry Pi 4b 1GB RAM with Volumio Ver 2.657 Oct 18th 2019
There is a FAT32-HDD at USB mounted as /var/lib/mpd/music/INTERNAL
On the HDD is my CD-Collection in FLAC-Format.
Volumio works fine.

Before I used Volumio, i have used an Ubuntu-Server-System with Apache as WebUI and MPD. Than with Multiroom with Snapcast. It was complicated. Then I have found Volumio.

All my CDs have RFID-Cards inside. The RFID-Sensor is an USB-Keyboard simulator, that sends ten digits and the ENTER-Key.
Every Album have the RFID-Code in the Album-Title-Tag, like This:

“Oxygene [0001754447]”
“Six Feet Under [0003481036]”
“Road To Revolution - Live At Milton Keynes [0003467970]”

The eaysiest way: Volumio starts at the shell - not with the GUI and make a login, followed from the shell script, that’s waiting for the keyboard input, like this:

#!/bin/bash
while true
do
read -p "Scan the Disk: " rfid
volumio clear; mpc clear; mpc search album ${rfid} | mpc add; mpc play
done

But I’ve tried all things, to boot in text-mode … no success.

Via SSH it works but it talks with MPD … not with volumio.

other Way:

I could install an second Raspberry Pi (Zero?) with the RFID-Sensor and the script. This one could send commands to the Volumio-Pi.

I think, the right way is the REST-API. If I say:

volumio.local/api/v1/search?query=0001754447

it gives me the search result:

    isSearchResult	true
    lists	
        0	
        title	"gefunden 1 Album '0001754447'"
        availableListViews	
            0	"list"
            1	"grid"
        items	
            0	
                service	"mpd"
                type	"folder"
                title	"Oxygene [0001754447]"
                artist	"Jean-Michel Jarre"
                album	""
                uri	"albums://Jean-Michel%20Jarre/Oxygene%20%5B0001754447%5D"

Then there is API /api/v1/addToQueue

At the documentation I read, that it want to have data via POST. But there are no examples, what addToQueue wants to “hear”. So I have tried:

curl -X POST -d http://192.168.178.67:3000/api/v1/search?query=0004130528 http://192.168.178.67:3000/api/v1/addToQueue

the Result at the shell:

{"response":"success"}

But no effect to the queue.

So I ask you: How I can speak to Volumio to

  1. search the album for the ID and
  2. add it to the queue

Nice Greetings from North-Germany!

Hello,

I have the same problem. I use successfully the REST api for sending simple commands that fit on one line.
I can browse the library, etc

However I do not understand how to use the following command :

How should I add the ‘payload’ argument ?

Many thanks for your support.