From 612e00f22660d8e4a4a65b9966e1799f4c7c1680 Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Wed, 9 Oct 2024 10:35:38 +0200 Subject: [PATCH 1/4] UmbracoApiController to Controller --- 14/umbraco-cms/reference/cache/examples/tags.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/14/umbraco-cms/reference/cache/examples/tags.md b/14/umbraco-cms/reference/cache/examples/tags.md index 5369fac4fed..74155b2f0ee 100644 --- a/14/umbraco-cms/reference/cache/examples/tags.md +++ b/14/umbraco-cms/reference/cache/examples/tags.md @@ -118,12 +118,13 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using Doccers.Core.Services; using Umbraco.Cms.Core.Models; -using Umbraco.Cms.Web.Common.Controllers; namespace Doccers.Core.Controllers.Api; -public class TagsController : UmbracoApiController +[ApiController] +[Route("/umbraco/api/tags")] +public class TagsController : Controller { private readonly ICacheTagService _tagService; @@ -133,7 +134,7 @@ public class TagsController : UmbracoApiController _tagService = tagService; } - [HttpGet] + [HttpGet("getdefaulttags")] public IEnumerable GetDefaultTags() { // As mentioned earlier we want tags from "default" @@ -142,7 +143,7 @@ public class TagsController : UmbracoApiController TimeSpan.FromMinutes(1)); } - [HttpGet] + [HttpGet("getblogtags")] public IEnumerable GetBlogTags() { // If you don't specify a TimeSpan the object(s) From 4f06b8c7df4fcac73f0720458cc7f6a021a5e27b Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Wed, 9 Oct 2024 10:39:21 +0200 Subject: [PATCH 2/4] Delete obsolete message --- 14/umbraco-cms/reference/cache/examples/tags.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/14/umbraco-cms/reference/cache/examples/tags.md b/14/umbraco-cms/reference/cache/examples/tags.md index 74155b2f0ee..4c5ff1a1f46 100644 --- a/14/umbraco-cms/reference/cache/examples/tags.md +++ b/14/umbraco-cms/reference/cache/examples/tags.md @@ -108,10 +108,6 @@ Now you can inject `ICacheTagService` in any constructor in your project - wohoo Now that we have our service it's time to create an endpoint where we can fetch the (cached) tags. -{% hint style="warning" %} -The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15. -{% endhint %} - ```csharp using System; using System.Collections.Generic; @@ -119,7 +115,6 @@ using Microsoft.AspNetCore.Mvc; using Doccers.Core.Services; using Umbraco.Cms.Core.Models; - namespace Doccers.Core.Controllers.Api; [ApiController] From c1de33cdf138066c5d2383a2dc6918c32c243c51 Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Wed, 9 Oct 2024 10:40:56 +0200 Subject: [PATCH 3/4] Update v15 --- 15/umbraco-cms/reference/cache/examples/tags.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/15/umbraco-cms/reference/cache/examples/tags.md b/15/umbraco-cms/reference/cache/examples/tags.md index 5369fac4fed..4c5ff1a1f46 100644 --- a/15/umbraco-cms/reference/cache/examples/tags.md +++ b/15/umbraco-cms/reference/cache/examples/tags.md @@ -108,22 +108,18 @@ Now you can inject `ICacheTagService` in any constructor in your project - wohoo Now that we have our service it's time to create an endpoint where we can fetch the (cached) tags. -{% hint style="warning" %} -The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15. -{% endhint %} - ```csharp using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using Doccers.Core.Services; using Umbraco.Cms.Core.Models; -using Umbraco.Cms.Web.Common.Controllers; - namespace Doccers.Core.Controllers.Api; -public class TagsController : UmbracoApiController +[ApiController] +[Route("/umbraco/api/tags")] +public class TagsController : Controller { private readonly ICacheTagService _tagService; @@ -133,7 +129,7 @@ public class TagsController : UmbracoApiController _tagService = tagService; } - [HttpGet] + [HttpGet("getdefaulttags")] public IEnumerable GetDefaultTags() { // As mentioned earlier we want tags from "default" @@ -142,7 +138,7 @@ public class TagsController : UmbracoApiController TimeSpan.FromMinutes(1)); } - [HttpGet] + [HttpGet("getblogtags")] public IEnumerable GetBlogTags() { // If you don't specify a TimeSpan the object(s) From 5632b4a6acf16b669f72f1fc42eb24782dc2ba50 Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Wed, 9 Oct 2024 10:42:50 +0200 Subject: [PATCH 4/4] Write shorter sentences --- 10/umbraco-cms/reference/cache/examples/tags.md | 2 +- 13/umbraco-cms/reference/cache/examples/tags.md | 2 +- 14/umbraco-cms/reference/cache/examples/tags.md | 2 +- 15/umbraco-cms/reference/cache/examples/tags.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/10/umbraco-cms/reference/cache/examples/tags.md b/10/umbraco-cms/reference/cache/examples/tags.md index 4c5b7750fbf..39cd973340b 100644 --- a/10/umbraco-cms/reference/cache/examples/tags.md +++ b/10/umbraco-cms/reference/cache/examples/tags.md @@ -18,7 +18,7 @@ For this example we're working with tags. On my site I have two tag properties: We're going to expose an endpoint that allows us to get the tags from each group. -The tags from the `default` should be cached for a minute and the `blog` tags will be cached until site restart or if you publish a blog post node in the Backoffice. +The tags from the `default` should be cached for a minute. The `blog` tags will be cached until site restart or if you publish a blog post node in the Backoffice. ## Example diff --git a/13/umbraco-cms/reference/cache/examples/tags.md b/13/umbraco-cms/reference/cache/examples/tags.md index e91884ee88b..05585a8c864 100644 --- a/13/umbraco-cms/reference/cache/examples/tags.md +++ b/13/umbraco-cms/reference/cache/examples/tags.md @@ -16,7 +16,7 @@ For this example we're working with tags. On my site I have two tag properties: We're going to expose an endpoint that allows us to get the tags from each group. -The tags from the `default` should be cached for a minute and the `blog` tags will be cached until site restart or if you publish a blog post node in the Backoffice. +The tags from the `default` should be cached for a minute. The `blog` tags will be cached until site restart or if you publish a blog post node in the Backoffice. ## Example diff --git a/14/umbraco-cms/reference/cache/examples/tags.md b/14/umbraco-cms/reference/cache/examples/tags.md index 4c5ff1a1f46..5b374b4486b 100644 --- a/14/umbraco-cms/reference/cache/examples/tags.md +++ b/14/umbraco-cms/reference/cache/examples/tags.md @@ -16,7 +16,7 @@ For this example we're working with tags. On my site I have two tag properties: We're going to expose an endpoint that allows us to get the tags from each group. -The tags from the `default` should be cached for a minute and the `blog` tags will be cached until site restart or if you publish a blog post node in the Backoffice. +The tags from the `default` should be cached for a minute. The `blog` tags will be cached until site restart or if you publish a blog post node in the Backoffice. ## Example diff --git a/15/umbraco-cms/reference/cache/examples/tags.md b/15/umbraco-cms/reference/cache/examples/tags.md index 4c5ff1a1f46..5b374b4486b 100644 --- a/15/umbraco-cms/reference/cache/examples/tags.md +++ b/15/umbraco-cms/reference/cache/examples/tags.md @@ -16,7 +16,7 @@ For this example we're working with tags. On my site I have two tag properties: We're going to expose an endpoint that allows us to get the tags from each group. -The tags from the `default` should be cached for a minute and the `blog` tags will be cached until site restart or if you publish a blog post node in the Backoffice. +The tags from the `default` should be cached for a minute. The `blog` tags will be cached until site restart or if you publish a blog post node in the Backoffice. ## Example