diff --git a/src/Lidarr.Api.V1/Lidarr.Api.V1.csproj b/src/Lidarr.Api.V1/Lidarr.Api.V1.csproj
index 1fae358bb..c3aeb676b 100644
--- a/src/Lidarr.Api.V1/Lidarr.Api.V1.csproj
+++ b/src/Lidarr.Api.V1/Lidarr.Api.V1.csproj
@@ -107,6 +107,7 @@
+
diff --git a/src/Lidarr.Api.V1/ProviderModuleBase.cs b/src/Lidarr.Api.V1/ProviderModuleBase.cs
index 1b46644d7..42775f031 100644
--- a/src/Lidarr.Api.V1/ProviderModuleBase.cs
+++ b/src/Lidarr.Api.V1/ProviderModuleBase.cs
@@ -28,6 +28,7 @@ namespace Lidarr.Api.V1
Get["schema"] = x => GetTemplates();
Post["test"] = x => Test(ReadResourceFromRequest(true));
+ Post["testall"] = x => TestAll();
Post["action/{action}"] = x => RequestAction(x.action, ReadResourceFromRequest(true));
GetResourceAll = GetAll;
@@ -144,6 +145,27 @@ namespace Lidarr.Api.V1
return "{}";
}
+ private Response TestAll()
+ {
+ var providerDefinitions = _providerFactory.All()
+ .Where(c => c.Settings.Validate().IsValid && c.Enable)
+ .ToList();
+ var result = new List();
+
+ foreach (var definition in providerDefinitions)
+ {
+ var validationResult = _providerFactory.Test(definition);
+
+ result.Add(new ProviderTestAllResult
+ {
+ Id = definition.Id,
+ ValidationFailures = validationResult.Errors.ToList()
+ });
+ }
+
+ return result.AsResponse(result.Any(c => !c.IsValid) ? HttpStatusCode.BadRequest : HttpStatusCode.OK);
+ }
+
private Response RequestAction(string action, TProviderResource providerResource)
{
var providerDefinition = GetDefinition(providerResource, true, false);
diff --git a/src/Lidarr.Api.V1/ProviderTestAllResult.cs b/src/Lidarr.Api.V1/ProviderTestAllResult.cs
new file mode 100644
index 000000000..ad96a3796
--- /dev/null
+++ b/src/Lidarr.Api.V1/ProviderTestAllResult.cs
@@ -0,0 +1,18 @@
+using System.Collections.Generic;
+using FluentValidation.Results;
+using NzbDrone.Common.Extensions;
+
+namespace Lidarr.Api.V1
+{
+ public class ProviderTestAllResult
+ {
+ public int Id { get; set; }
+ public bool IsValid => ValidationFailures.Empty();
+ public List ValidationFailures { get; set; }
+
+ public ProviderTestAllResult()
+ {
+ ValidationFailures = new List();
+ }
+ }
+}