Examples

Some REST-API use cases

Multizone Volume Control

Controlling the volume of several zones, consists of n-channels per device.

Let’s say a Zone consists of channel 1, 2, 3, 11, 12, 13. All volumes can be updated simultaneously by performing: HTTP PUT http://${ip}rest-api/settings/channel with the following payload, value: -10.2 representing the volume of -10.2 dB :

[
  {
    "channel_id": 1,
    "dsp": {
      "volume": {
        "value": -10.2
      }
    }
  },
  {
    "channel_id": 2,
    "dsp": {
      "volume": {
        "value": -10.2
      }
    }
  },
  {
    "channel_id": 3,
    "dsp": {
      "volume": {
        "value": -10.2
      }
    }
  },
  {
    "channel_id": 11,
    "dsp": {
      "volume": {
        "value": -10.2
      }
    }
  },
  {
    "channel_id": 12,
    "dsp": {
      "volume": {
        "value": -10.2
      }
    }
  },
  {
    "channel_id": 13,
    "dsp": {
      "volume": {
        "value": -10.2
      }
    }
  }
]
curl -X 'PUT' http://${IP}/rest-api/settings/channel/ \
-H 'token: f4005bf8507999192162d989d5a60823' \
-d '[{"channel_id":1,"dsp":{"volume":{"value":-10.2}}},{"channel_id":2,"dsp":{"volume":{"value":-10.2}}},{"channel_id":3,"dsp":{"volume":{"value":-10.2}}},{"channel_id":11,"dsp":{"volume":{"value":-10.2}}},{"channel_id":12,"dsp":{"volume":{"value":-10.2}}},{"channel_id":13,"dsp":{"volume":{"value":-10.2}}}]' 

DSP On / Off

Sometimes it can be handy to turn off / on the whole channel equalizer. For this example, use channel 1, 2, 3, 11, 12, 13. This can be done by:

HTTP PUT http://${ip}rest-api/settings/channel

[
  {
    "channel_id": 1,
    "dsp": {
      "eqenable": {
        "value": false
      }
    }
  },
  {
    "channel_id": 2,
    "dsp": {
      "eqenable": {
        "value": false
      }
    }
  },
  {
    "channel_id": 3,
    "dsp": {
      "eqenable": {
        "value": false
      }
    }
  },
  {
    "channel_id": 11,
    "dsp": {
      "eqenable": {
        "value": false
      }
    }
  },
  {
    "channel_id": 12,
    "dsp": {
      "eqenable": {
        "value": false
      }
    }
  },
  {
    "channel_id": 13,
    "dsp": {
      "eqenable": {
        "value": false
      }
    }
  }
]
curl -X 'PUT' http://${IP}/rest-api/settings/channel/ \
-H 'token: f4005bf8507999192162d989d5a60823' \
-d '[
  {
    "channel_id": 1,
    "dsp": {
      "eqenable": {
        "value": false
      }
    }
  },
  {
    "channel_id": 2,
    "dsp": {
      "eqenable": {
        "value": false
      }
    }
  },
  {
    "channel_id": 3,
    "dsp": {
      "eqenable": {
        "value": false
      }
    }
  },
  {
    "channel_id": 11,
    "dsp": {
      "eqenable": {
        "value": false
      }
    }
  },
  {
    "channel_id": 12,
    "dsp": {
      "eqenable": {
        "value": false
      }
    }
  },
  {
    "channel_id": 13,
    "dsp": {
      "eqenable": {
        "value": false
      }
    }
  }
]'

[
  {
    "channel_id": 1,
    "dsp": {
      "eqenable": {
        "value": true
      }
    }
  },
  {
    "channel_id": 2,
    "dsp": {
      "eqenable": {
        "value": true
      }
    }
  },
  {
    "channel_id": 3,
    "dsp": {
      "eqenable": {
        "value": true
      }
    }
  },
  {
    "channel_id": 11,
    "dsp": {
      "eqenable": {
        "value": true
      }
    }
  },
  {
    "channel_id": 12,
    "dsp": {
      "eqenable": {
        "value": true
      }
    }
  },
  {
    "channel_id": 13,
    "dsp": {
      "eqenable": {
        "value": true
      }
    }
  }
]
curl -X 'PUT' http://${IP}/rest-api/settings/channel/ \
-H 'token: f4005bf8507999192162d989d5a60823' \
-d '[
  {
    "channel_id": 1,
    "dsp": {
      "eqenable": {
        "value": true
      }
    }
  },
  {
    "channel_id": 2,
    "dsp": {
      "eqenable": {
        "value": true
      }
    }
  },
  {
    "channel_id": 3,
    "dsp": {
      "eqenable": {
        "value": true
      }
    }
  },
  {
    "channel_id": 11,
    "dsp": {
      "eqenable": {
        "value": true
      }
    }
  },
  {
    "channel_id": 12,
    "dsp": {
      "eqenable": {
        "value": true
      }
    }
  },
  {
    "channel_id": 13,
    "dsp": {
      "eqenable": {
        "value": true
      }
    }
  }
]'
Last modified October 7, 2024: add some rest-api examples (af49b3e)