The Free Software Media System - Server Backend & API
Use Http status code 204 instead of 200
David043d76bd6e9e
diff --git a/Jellyfin.Api/Controllers/ConfigurationController.cs b/Jellyfin.Api/Controllers/ConfigurationController.csindex 2a1dce74d4..780a38aa81 100644--- a/Jellyfin.Api/Controllers/ConfigurationController.cs+++ b/Jellyfin.Api/Controllers/ConfigurationController.cs@@ -53,15 +53,15 @@ namespace Jellyfin.Api.Controllers/// Updates application configuration./// </summary>/// <param name="configuration">Configuration.</param>- /// <response code="200">Configuration updated.</response>+ /// <response code="204">Configuration updated.</response>/// <returns>Update status.</returns>[HttpPost("Configuration")][Authorize(Policy = Policies.RequiresElevation)]- [ProducesResponseType(StatusCodes.Status200OK)]+ [ProducesResponseType(StatusCodes.Status204NoContent)]public ActionResult UpdateConfiguration([FromBody, BindRequired] ServerConfiguration configuration){_configurationManager.ReplaceConfiguration(configuration);- return Ok();+ return NoContent();}/// <summary>@@ -81,17 +81,17 @@ namespace Jellyfin.Api.Controllers/// Updates named configuration./// </summary>/// <param name="key">Configuration key.</param>- /// <response code="200">Named configuration updated.</response>+ /// <response code="204">Named configuration updated.</response>/// <returns>Update status.</returns>[HttpPost("Configuration/{Key}")][Authorize(Policy = Policies.RequiresElevation)]- [ProducesResponseType(StatusCodes.Status200OK)]+ [ProducesResponseType(StatusCodes.Status204NoContent)]public async Task<ActionResult> UpdateNamedConfiguration([FromRoute] string key){var configurationType = _configurationManager.GetConfigurationType(key);var configuration = await JsonSerializer.DeserializeAsync(Request.Body, configurationType).ConfigureAwait(false);_configurationManager.SaveConfiguration(key, configuration);- return Ok();+ return NoContent();}/// <summary>@@ -111,15 +111,15 @@ namespace Jellyfin.Api.Controllers/// Updates the path to the media encoder./// </summary>/// <param name="mediaEncoderPath">Media encoder path form body.</param>- /// <response code="200">Media encoder path updated.</response>+ /// <response code="204">Media encoder path updated.</response>/// <returns>Status.</returns>[HttpPost("MediaEncoder/Path")][Authorize(Policy = Policies.FirstTimeSetupOrElevated)]- [ProducesResponseType(StatusCodes.Status200OK)]+ [ProducesResponseType(StatusCodes.Status204NoContent)]public ActionResult UpdateMediaEncoderPath([FromForm, BindRequired] MediaEncoderPathDto mediaEncoderPath){_mediaEncoder.UpdateEncoderPath(mediaEncoderPath.Path, mediaEncoderPath.PathType);- return Ok();+ return NoContent();}}}diff --git a/Jellyfin.Api/Controllers/DevicesController.cs b/Jellyfin.Api/Controllers/DevicesController.csindex 1e75579033..1754b0cbda 100644--- a/Jellyfin.Api/Controllers/DevicesController.cs+++ b/Jellyfin.Api/Controllers/DevicesController.cs@@ -105,12 +105,12 @@ namespace Jellyfin.Api.Controllers/// </summary>/// <param name="id">Device Id.</param>/// <param name="deviceOptions">Device Options.</param>- /// <response code="200">Device options updated.</response>+ /// <response code="204">Device options updated.</response>/// <response code="404">Device not found.</response>- /// <returns>An <see cref="OkResult"/> on success, or a <see cref="NotFoundResult"/> if the device could not be found.</returns>+ /// <returns>A <see cref="NoContentResult"/> on success, or a <see cref="NotFoundResult"/> if the device could not be found.</returns>[HttpPost("Options")][Authorize(Policy = Policies.RequiresElevation)]- [ProducesResponseType(StatusCodes.Status200OK)]+ [ProducesResponseType(StatusCodes.Status204NoContent)][ProducesResponseType(StatusCodes.Status404NotFound)]public ActionResult UpdateDeviceOptions([FromQuery, BindRequired] string id,@@ -123,18 +123,18 @@ namespace Jellyfin.Api.Controllers}_deviceManager.UpdateDeviceOptions(id, deviceOptions);- return Ok();+ return NoContent();}/// <summary>/// Deletes a device./// </summary>/// <param name="id">Device Id.</param>- /// <response code="200">Device deleted.</response>+ /// <response code="204">Device deleted.</response>/// <response code="404">Device not found.</response>- /// <returns>An <see cref="OkResult"/> on success, or a <see cref="NotFoundResult"/> if the device could not be found.</returns>+ /// <returns>A <see cref="NoContentResult"/> on success, or a <see cref="NotFoundResult"/> if the device could not be found.</returns>[HttpDelete]- [ProducesResponseType(StatusCodes.Status200OK)]+ [ProducesResponseType(StatusCodes.Status204NoContent)]public ActionResult DeleteDevice([FromQuery, BindRequired] string id){var existingDevice = _deviceManager.GetDevice(id);@@ -150,7 +150,7 @@ namespace Jellyfin.Api.Controllers_sessionManager.Logout(session);}- return Ok();+ return NoContent();}}}diff --git a/Jellyfin.Api/Controllers/NotificationsController.cs b/Jellyfin.Api/Controllers/NotificationsController.csindex 8d82ca10f1..5af1947562 100644--- a/Jellyfin.Api/Controllers/NotificationsController.cs+++ b/Jellyfin.Api/Controllers/NotificationsController.cs@@ -99,10 +99,10 @@ namespace Jellyfin.Api.Controllers/// <param name="description">The description of the notification.</param>/// <param name="url">The URL of the notification.</param>/// <param name="level">The level of the notification.</param>- /// <response code="200">Notification sent.</response>- /// <returns>An <cref see="OkResult"/>.</returns>+ /// <response code="204">Notification sent.</response>+ /// <returns>A <cref see="NoContentResult"/>.</returns>[HttpPost("Admin")]- [ProducesResponseType(StatusCodes.Status200OK)]+ [ProducesResponseType(StatusCodes.Status204NoContent)]public ActionResult CreateAdminNotification([FromQuery] string name,[FromQuery] string description,@@ -121,7 +121,7 @@ namespace Jellyfin.Api.Controllers_notificationManager.SendNotification(notification, CancellationToken.None);- return Ok();+ return NoContent();}/// <summary>@@ -129,15 +129,15 @@ namespace Jellyfin.Api.Controllers/// </summary>/// <param name="userId">The userID.</param>/// <param name="ids">A comma-separated list of the IDs of notifications which should be set as read.</param>- /// <response code="200">Notifications set as read.</response>- /// <returns>An <cref see="OkResult"/>.</returns>+ /// <response code="204">Notifications set as read.</response>+ /// <returns>A <cref see="NoContentResult"/>.</returns>[HttpPost("{UserID}/Read")]- [ProducesResponseType(StatusCodes.Status200OK)]+ [ProducesResponseType(StatusCodes.Status204NoContent)]public ActionResult SetRead([FromRoute] string userId,[FromQuery] string ids){- return Ok();+ return NoContent();}/// <summary>@@ -145,15 +145,15 @@ namespace Jellyfin.Api.Controllers/// </summary>/// <param name="userId">The userID.</param>/// <param name="ids">A comma-separated list of the IDs of notifications which should be set as unread.</param>- /// <response code="200">Notifications set as unread.</response>- /// <returns>An <cref see="OkResult"/>.</returns>+ /// <response code="204">Notifications set as unread.</response>+ /// <returns>A <cref see="NoContentResult"/>.</returns>[HttpPost("{UserID}/Unread")]- [ProducesResponseType(StatusCodes.Status200OK)]+ [ProducesResponseType(StatusCodes.Status204NoContent)]public ActionResult SetUnread([FromRoute] string userId,[FromQuery] string ids){- return Ok();+ return NoContent();}}}diff --git a/Jellyfin.Api/Controllers/PackageController.cs b/Jellyfin.Api/Controllers/PackageController.csindex f37319c19e..8200f891c8 100644--- a/Jellyfin.Api/Controllers/PackageController.cs+++ b/Jellyfin.Api/Controllers/PackageController.cs@@ -72,11 +72,11 @@ namespace Jellyfin.Api.Controllers/// <param name="name">Package name.</param>/// <param name="assemblyGuid">GUID of the associated assembly.</param>/// <param name="version">Optional version. Defaults to latest version.</param>- /// <response code="200">Package found.</response>+ /// <response code="204">Package found.</response>/// <response code="404">Package not found.</response>- /// <returns>An <see cref="OkResult"/> on success, or a <see cref="NotFoundResult"/> if the package could not be found.</returns>+ /// <returns>A <see cref="NoContentResult"/> on success, or a <see cref="NotFoundResult"/> if the package could not be found.</returns>[HttpPost("/Installed/{Name}")]- [ProducesResponseType(StatusCodes.Status200OK)]+ [ProducesResponseType(StatusCodes.Status204NoContent)][ProducesResponseType(StatusCodes.Status404NotFound)][Authorize(Policy = Policies.RequiresElevation)]public async Task<ActionResult> InstallPackage(@@ -98,23 +98,24 @@ namespace Jellyfin.Api.Controllersawait _installationManager.InstallPackage(package).ConfigureAwait(false);- return Ok();+ return NoContent();}/// <summary>/// Cancels a package installation./// </summary>/// <param name="id">Installation Id.</param>- /// <response code="200">Installation cancelled.</response>- /// <returns>An <see cref="OkResult"/> on successfully cancelling a package installation.</returns>+ /// <response code="204">Installation cancelled.</response>+ /// <returns>A <see cref="NoContentResult"/> on successfully cancelling a package installation.</returns>[HttpDelete("/Installing/{id}")][Authorize(Policy = Policies.RequiresElevation)]+ [ProducesResponseType(StatusCodes.Status204NoContent)]public IActionResult CancelPackageInstallation([FromRoute] [Required] string id){_installationManager.CancelInstallation(new Guid(id));- return Ok();+ return NoContent();}}}diff --git a/Jellyfin.Api/Controllers/StartupController.cs b/Jellyfin.Api/Controllers/StartupController.csindex 57a02e62a9..aae066e0e1 100644--- a/Jellyfin.Api/Controllers/StartupController.cs+++ b/Jellyfin.Api/Controllers/StartupController.cs@@ -33,16 +33,16 @@ namespace Jellyfin.Api.Controllers/// <summary>/// Completes the startup wizard./// </summary>- /// <response code="200">Startup wizard completed.</response>- /// <returns>An <see cref="OkResult"/> indicating success.</returns>+ /// <response code="204">Startup wizard completed.</response>+ /// <returns>A <see cref="NoContentResult"/> indicating success.</returns>[HttpPost("Complete")]- [ProducesResponseType(StatusCodes.Status200OK)]+ [ProducesResponseType(StatusCodes.Status204NoContent)]public ActionResult CompleteWizard(){_config.Configuration.IsStartupWizardCompleted = true;_config.SetOptimalValues();_config.SaveConfiguration();- return Ok();+ return NoContent();}/// <summary>@@ -70,10 +70,10 @@ namespace Jellyfin.Api.Controllers/// <param name="uiCulture">The UI language culture.</param>/// <param name="metadataCountryCode">The metadata country code.</param>/// <param name="preferredMetadataLanguage">The preferred language for metadata.</param>- /// <response code="200">Configuration saved.</response>- /// <returns>An <see cref="OkResult"/> indicating success.</returns>+ /// <response code="204">Configuration saved.</response>+ /// <returns>A <see cref="NoContentResult"/> indicating success.</returns>[HttpPost("Configuration")]- [ProducesResponseType(StatusCodes.Status200OK)]+ [ProducesResponseType(StatusCodes.Status204NoContent)]public ActionResult UpdateInitialConfiguration([FromForm] string uiCulture,[FromForm] string metadataCountryCode,@@ -83,7 +83,7 @@ namespace Jellyfin.Api.Controllers_config.Configuration.MetadataCountryCode = metadataCountryCode;_config.Configuration.PreferredMetadataLanguage = preferredMetadataLanguage;_config.SaveConfiguration();- return Ok();+ return NoContent();}/// <summary>@@ -91,16 +91,16 @@ namespace Jellyfin.Api.Controllers/// </summary>/// <param name="enableRemoteAccess">Enable remote access.</param>/// <param name="enableAutomaticPortMapping">Enable UPnP.</param>- /// <response code="200">Configuration saved.</response>- /// <returns>An <see cref="OkResult"/> indicating success.</returns>+ /// <response code="204">Configuration saved.</response>+ /// <returns>A <see cref="NoContentResult"/> indicating success.</returns>[HttpPost("RemoteAccess")]- [ProducesResponseType(StatusCodes.Status200OK)]+ [ProducesResponseType(StatusCodes.Status204NoContent)]public ActionResult SetRemoteAccess([FromForm] bool enableRemoteAccess, [FromForm] bool enableAutomaticPortMapping){_config.Configuration.EnableRemoteAccess = enableRemoteAccess;_config.Configuration.EnableUPnP = enableAutomaticPortMapping;_config.SaveConfiguration();- return Ok();+ return NoContent();}/// <summary>@@ -121,13 +121,13 @@ namespace Jellyfin.Api.Controllers/// Sets the user name and password./// </summary>/// <param name="startupUserDto">The DTO containing username and password.</param>- /// <response code="200">Updated user name and password.</response>+ /// <response code="204">Updated user name and password.</response>/// <returns>/// A <see cref="Task" /> that represents the asynchronous update operation.- /// The task result contains an <see cref="OkResult"/> indicating success.+ /// The task result contains a <see cref="NoContentResult"/> indicating success./// </returns>[HttpPost("User")]- [ProducesResponseType(StatusCodes.Status200OK)]+ [ProducesResponseType(StatusCodes.Status204NoContent)]public async Task<ActionResult> UpdateUser([FromForm] StartupUserDto startupUserDto){var user = _userManager.Users.First();@@ -141,7 +141,7 @@ namespace Jellyfin.Api.Controllersawait _userManager.ChangePassword(user, startupUserDto.Password).ConfigureAwait(false);}- return Ok();+ return NoContent();}}}