diff --git a/Jellyfin.Api/Controllers/DevicesController.cs b/Jellyfin.Api/Controllers/DevicesController.cs
index 50050262f0..bdeac0ac03 100644
--- a/Jellyfin.Api/Controllers/DevicesController.cs
+++ b/Jellyfin.Api/Controllers/DevicesController.cs
@@ -1,7 +1,11 @@
using System;
+using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
+using System.Linq;
using System.Threading.Tasks;
+using Jellyfin.Api.Attributes;
using Jellyfin.Api.Helpers;
+using Jellyfin.Api.ModelBinders;
using Jellyfin.Data.Dtos;
using Jellyfin.Data.Queries;
using MediaBrowser.Common.Api;
@@ -111,28 +115,31 @@ public class DevicesController : BaseJellyfinApiController
}
///
- /// Deletes a device.
+ /// Deletes devices.
///
- /// Device Id.
+ /// Device Ids.
/// Device deleted.
/// Device not found.
- /// A on success, or a if the device could not be found.
+ /// A on success, or a if a device could not be found.
[HttpDelete]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
- public async Task DeleteDevice([FromQuery, Required] string id)
+ public async Task DeleteDevice([FromQuery] string[] id)
{
- var existingDevice = _deviceManager.GetDevice(id);
- if (existingDevice is null)
+ var devices = id.Select(_deviceManager.GetDevice).ToArray();
+ if (devices.Any(f => f is null))
{
return NotFound();
}
- var sessions = _deviceManager.GetDevices(new DeviceQuery { DeviceId = id });
-
- foreach (var session in sessions.Items)
+ foreach (var device in devices)
{
- await _sessionManager.Logout(session).ConfigureAwait(false);
+ var sessions = _deviceManager.GetDevices(new DeviceQuery { DeviceId = device!.Id });
+
+ foreach (var session in sessions.Items)
+ {
+ await _sessionManager.Logout(session).ConfigureAwait(false);
+ }
}
return NoContent();