diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Dictionary/AllDictionaryController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Dictionary/AllDictionaryController.cs index c2a8b63fa1..4415a5ff5f 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Dictionary/AllDictionaryController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Dictionary/AllDictionaryController.cs @@ -29,7 +29,7 @@ public class AllDictionaryController : DictionaryControllerBase [HttpGet] [MapToApiVersion("1.0")] [ProducesResponseType(typeof(PagedViewModel), StatusCodes.Status200OK)] - public async Task> All(int skip, int take) + public async Task>> All(int skip, int take) { IDictionaryItem[] items = _localizationService.GetDictionaryItemDescendants(null).ToArray(); var list = new List(items.Length); diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Dictionary/CreateDictionaryController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Dictionary/CreateDictionaryController.cs index 54fea28116..ab0cc69625 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Dictionary/CreateDictionaryController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Dictionary/CreateDictionaryController.cs @@ -40,7 +40,7 @@ public class CreateDictionaryController : DictionaryControllerBase /// /// The . /// - [HttpPost("create")] + [HttpPost] [MapToApiVersion("1.0")] [ProducesResponseType(typeof(CreatedResult), StatusCodes.Status201Created)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Language/AllLanguageController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Language/AllLanguageController.cs index ec9e8397be..e2d0ec7f6c 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Language/AllLanguageController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Language/AllLanguageController.cs @@ -27,7 +27,7 @@ public class AllLanguageController : LanguageControllerBase [HttpGet] [MapToApiVersion("1.0")] [ProducesResponseType(typeof(PagedViewModel), StatusCodes.Status200OK)] - public async Task?> GetAll(int skip, int take) + public async Task>> GetAll(int skip, int take) { PagedModel allLanguages = _localizationService.GetAllLanguagesPaged(skip, take); diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Language/CreateLanguageController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Language/CreateLanguageController.cs index d5d494d7b3..720182ccce 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Language/CreateLanguageController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Language/CreateLanguageController.cs @@ -25,7 +25,7 @@ public class CreateLanguageController : LanguageControllerBase /// /// Creates or saves a language /// - [HttpPost("create")] + [HttpPost] [MapToApiVersion("1.0")] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status201Created)] diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Language/UpdateLanguageController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Language/UpdateLanguageController.cs index 858f9ea3ff..2452d6468e 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Language/UpdateLanguageController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Language/UpdateLanguageController.cs @@ -24,15 +24,15 @@ public class UpdateLanguageController : LanguageControllerBase /// /// Updates a language /// - [HttpPut("update")] + [HttpPut("{id:int}")] [MapToApiVersion("1.0")] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status200OK)] // TODO: This needs to be an authorized endpoint. - public async Task Update(LanguageViewModel language) + public async Task Update(int id, LanguageViewModel language) { - ILanguage? existingById = language.Id != default ? _localizationService.GetLanguageById(language.Id) : null; + ILanguage? existingById = _localizationService.GetLanguageById(id); if (existingById is null) { return await Task.FromResult(NotFound()); diff --git a/src/Umbraco.Cms.Api.Management/OpenApi.json b/src/Umbraco.Cms.Api.Management/OpenApi.json index b4b01c10e7..e7d0038ea1 100644 --- a/src/Umbraco.Cms.Api.Management/OpenApi.json +++ b/src/Umbraco.Cms.Api.Management/OpenApi.json @@ -220,6 +220,43 @@ } } } + }, + "post": { + "tags": [ + "Dictionary" + ], + "operationId": "PostDictionary", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DictionaryItem" + } + } + } + }, + "responses": { + "201": { + "description": "Created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreatedResult" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + } + } } }, "/umbraco/management/api/v1/dictionary/{id}": { @@ -348,45 +385,6 @@ } } }, - "/umbraco/management/api/v1/dictionary/create": { - "post": { - "tags": [ - "Dictionary" - ], - "operationId": "PostDictionaryCreate", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DictionaryItem" - } - } - } - }, - "responses": { - "201": { - "description": "Created", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreatedResult" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - } - } - } - }, "/umbraco/management/api/v1/dictionary/export/{key}": { "get": { "tags": [ @@ -491,7 +489,7 @@ ], "operationId": "PostDictionaryUpload", "requestBody": { - "content": {} + "content": { } }, "responses": { "200": { @@ -892,16 +890,6 @@ } ], "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PagedRecycleBinItem" - } - } - } - }, "401": { "description": "Unauthorized", "content": { @@ -911,6 +899,16 @@ } } } + }, + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PagedRecycleBinItem" + } + } + } } } } @@ -942,16 +940,6 @@ } ], "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PagedRecycleBinItem" - } - } - } - }, "401": { "description": "Unauthorized", "content": { @@ -961,6 +949,16 @@ } } } + }, + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PagedRecycleBinItem" + } + } + } } } } @@ -1181,16 +1179,6 @@ } ], "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PagedHelpPage" - } - } - } - }, "400": { "description": "Bad Request", "content": { @@ -1200,6 +1188,16 @@ } } } + }, + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PagedHelpPage" + } + } + } } } } @@ -1259,16 +1257,6 @@ } ], "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Index" - } - } - } - }, "400": { "description": "Bad Request", "content": { @@ -1278,6 +1266,16 @@ } } } + }, + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Index" + } + } + } } } } @@ -1299,16 +1297,6 @@ } ], "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OkResult" - } - } - } - }, "400": { "description": "Bad Request", "content": { @@ -1318,6 +1306,16 @@ } } } + }, + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OkResult" + } + } + } } } } @@ -1329,16 +1327,6 @@ ], "operationId": "GetInstallSettings", "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/InstallSettings" - } - } - } - }, "400": { "description": "Bad Request", "content": { @@ -1358,6 +1346,16 @@ } } } + }, + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/InstallSettings" + } + } + } } } } @@ -1378,9 +1376,6 @@ } }, "responses": { - "200": { - "description": "Success" - }, "400": { "description": "Bad Request", "content": { @@ -1400,6 +1395,9 @@ } } } + }, + "200": { + "description": "Success" } } } @@ -1420,9 +1418,6 @@ } }, "responses": { - "200": { - "description": "Success" - }, "400": { "description": "Bad Request", "content": { @@ -1432,11 +1427,44 @@ } } } + }, + "200": { + "description": "Success" } } } }, "/umbraco/management/api/v1/language": { + "post": { + "tags": [ + "Language" + ], + "operationId": "PostLanguage", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Language" + } + } + } + }, + "responses": { + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "201": { + "description": "Created" + } + } + }, "get": { "tags": [ "Language" @@ -1492,16 +1520,6 @@ } ], "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Language" - } - } - } - }, "404": { "description": "Not Found", "content": { @@ -1511,6 +1529,16 @@ } } } + }, + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Language" + } + } + } } } }, @@ -1531,9 +1559,6 @@ } ], "responses": { - "200": { - "description": "Success" - }, "400": { "description": "Bad Request", "content": { @@ -1553,48 +1578,28 @@ } } } - } - } - } - }, - "/umbraco/management/api/v1/language/create": { - "post": { - "tags": [ - "Language" - ], - "operationId": "PostLanguageCreate", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Language" - } - } - } - }, - "responses": { - "201": { - "description": "Created" }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } + "200": { + "description": "Success" } } - } - }, - "/umbraco/management/api/v1/language/update": { + }, "put": { "tags": [ "Language" ], - "operationId": "PutLanguageUpdate", + "operationId": "PutLanguageById", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], "requestBody": { "content": { "application/json": { @@ -1605,19 +1610,6 @@ } }, "responses": { - "200": { - "description": "Success" - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } - } - } - }, "404": { "description": "Not Found", "content": { @@ -1627,6 +1619,19 @@ } } } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "200": { + "description": "Success" } } } @@ -1806,16 +1811,6 @@ } ], "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PagedRecycleBinItem" - } - } - } - }, "401": { "description": "Unauthorized", "content": { @@ -1825,6 +1820,16 @@ } } } + }, + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PagedRecycleBinItem" + } + } + } } } } @@ -1856,16 +1861,6 @@ } ], "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PagedRecycleBinItem" - } - } - } - }, "401": { "description": "Unauthorized", "content": { @@ -1875,6 +1870,16 @@ } } } + }, + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PagedRecycleBinItem" + } + } + } } } } @@ -2876,16 +2881,6 @@ ], "operationId": "GetServerStatus", "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ServerStatus" - } - } - } - }, "400": { "description": "Bad Request", "content": { @@ -2895,6 +2890,16 @@ } } } + }, + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ServerStatus" + } + } + } } } } @@ -2906,16 +2911,6 @@ ], "operationId": "GetServerVersion", "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Version" - } - } - } - }, "400": { "description": "Bad Request", "content": { @@ -2925,6 +2920,16 @@ } } } + }, + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Version" + } + } + } } } } @@ -3245,9 +3250,6 @@ } }, "responses": { - "200": { - "description": "Success" - }, "400": { "description": "Bad Request", "content": { @@ -3257,6 +3259,9 @@ } } } + }, + "200": { + "description": "Success" } } } @@ -4892,7 +4897,7 @@ }, "providerProperties": { "type": "object", - "additionalProperties": {}, + "additionalProperties": { }, "nullable": true } }, @@ -5998,7 +6003,7 @@ "nullable": true } }, - "additionalProperties": {} + "additionalProperties": { } }, "ProfilingStatus": { "type": "object", @@ -7104,7 +7109,7 @@ "authorizationCode": { "authorizationUrl": "/umbraco/management/api/v1.0/security/back-office/authorize", "tokenUrl": "/umbraco/management/api/v1.0/security/back-office/token", - "scopes": {} + "scopes": { } } } } @@ -7112,7 +7117,7 @@ }, "security": [ { - "OAuth": [] + "OAuth": [ ] } ] }