How can I restore web radio list?

Hi,

after a fresh install of volumio, I’m trying to restore my web radio list.

In the API documentation (https://volumio.github.io/docs/API/REST_API.html) I found the endpoint to restore backups, but it does not work.

My backup looks like this:

However, when I manually create another backup with the latest version (2.099), the format looks like this:

Independent from the format, the API description is not clear on what it expects as parameters in this situation. I would expect to POST to an endpoint like volumio.local/api/v1/restore/my-web-radio with the backup file as request body.

So how does it work?

Thanks
Jochen

I started working on a backup/restore capability using Drupal a while ago. Got the basics limping without a UI, and hope to get more it working soon.

You can browse the Github repo here:

github.com/skikirkwood/MyVolumio

In this file: MyVolumio/docroot/modules/myvolumio/src/Api/myvolumioApi.php you can see where I’m saving a list of radio stations by accessing the “backup” component of the Json object I got back from Volumio’s API call:

    public function saveRadios($type, $path, $radios)
    {
        // try to create a node
        $node = Node::create([
                'type' => 'volumio_setting',
                'title' => $path,
                'uid' => \Drupal::currentUser()->id(),
                'status' => 1,
            ]
        );
        $json_object = json_decode($radios);
        $json_backup = $json_object->backup;
        $backup = json_encode($json_backup, JSON_UNESCAPED_SLASHES);
        $node->field_volumio_setting_value->value = $backup;
        $node->field_volumio_setting->value = $type;
        $node->save();
        return $node->id();
    }

Here is the code that restores a list of web radios:

    public function restoreRadios($path, $type, $radios)
    {
        $url = self::PLAYLIST_RESTORE;
        $volumio_response = $this->makePostRequest($url, [
            'form_params' => [
                'path' => $path,
                'type' => $type,
                'data' => $radios  //$web_radios
            ]
        ]);
        return $volumio_response;
    }
1 Like