{"id":4481,"date":"2023-07-25T18:33:21","date_gmt":"2023-07-25T18:33:21","guid":{"rendered":"https:\/\/blog.osmosys.co\/?p=4481"},"modified":"2024-02-02T04:57:15","modified_gmt":"2024-02-02T04:57:15","slug":"background-service-management-using-hosted-service","status":"publish","type":"post","link":"https:\/\/staging.osmosys.co\/uk\/background-service-management-using-hosted-service\/","title":{"rendered":"Background service management using Hosted Service"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div>[et_pb_section fb_built=&#8221;1&#8243; admin_label=&#8221;section&#8221; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221;][et_pb_row admin_label=&#8221;row&#8221; _builder_version=&#8221;4.16&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; global_colors_info=&#8221;{}&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text admin_label=&#8221;Text&#8221; _builder_version=&#8221;4.16&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; hover_enabled=&#8221;0&#8243; global_colors_info=&#8221;{}&#8221; sticky_enabled=&#8221;0&#8243;]\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_1 counter-hierarchy ez-toc-counter ez-toc-white ez-toc-container-direction\">\r\n<div class=\"ez-toc-title-container\">\r\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\r\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\r\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/staging.osmosys.co\/uk\/background-service-management-using-hosted-service\/#Introduction\" >Introduction<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/staging.osmosys.co\/uk\/background-service-management-using-hosted-service\/#What_is_a_Hosted_Service\" >What is a Hosted Service?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/staging.osmosys.co\/uk\/background-service-management-using-hosted-service\/#IHostedService_implementation\" >IHostedService implementation\u00a0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/staging.osmosys.co\/uk\/background-service-management-using-hosted-service\/#IHostedService_usage\" >IHostedService usage<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/staging.osmosys.co\/uk\/background-service-management-using-hosted-service\/#Register_the_Hosted_Service_while_bootstrapping\" >Register the Hosted Service while bootstrapping<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/staging.osmosys.co\/uk\/background-service-management-using-hosted-service\/#Advantages_of_using_background_services_with_Hosted_Service\" >Advantages of using background services with Hosted Service<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/staging.osmosys.co\/uk\/background-service-management-using-hosted-service\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\r\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Introduction\"><\/span>Introduction<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Long running tasks are very common in an API application. Tasks like data synchronization, periodic updates and background processing can be done asynchronously.<\/p>\n\n\n\n<p>ASP.NET Core Hosted Service can be used to implement background tasks. Hosted Service was introduced in ASP.NET Core 3.1 and are an excellent way to run background tasks.\u00a0<\/p>\n\n\n\n<p>They can be run on an ASP.NET Core web application. This is ideal if we need to update something that runs in the background that could affect all users.\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Hosted_Service\"><\/span>What is a Hosted Service?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Hosted Service is an interface provided by the Microsoft.Extensions.Hosting namespace in .NET Core. It allows developers to define background tasks or services that run as part of the application&#8217;s lifetime. It provides a structured and managed way to execute long-running processes, ensuring they start and stop gracefully during application startup and shutdown.\u00a0\u00a0<\/p>\n\n\n\n<p>We can implement Background Services using three Hosted Services in .NET:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Using IHostedService that activates a scoped service.<\/li>\n\n\n\n<li>inheriting BackgroundService class that runs on a timer.<\/li>\n\n\n\n<li>Using QueuedBackground tasks that run sequentially.\u00a0\u00a0<\/li>\n<\/ul>\n\n\n\n<p>Lets dive deep into the approach that uses IHostedService interface and implements background service for the long running tasks.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"IHostedService_implementation\"><\/span>IHostedService implementation<strong>\u00a0<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>We first create a class that inherits the IHostedService Interface. The Interface contains two methods:\u00a0\u00a0<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>StartAsync(CancellationToken):<\/strong> The StartAsync function defines the logic of the long running process that we must execute. It can be a loop or an asynchronous method that waits for an event to occur.\u00a0\u00a0<\/li>\n\n\n\n<li><strong>StopAsync(CancellationToken): <\/strong>This method is used to gracefully stop the process when the application is shutting down.\u00a0\u00a0<\/li>\n<\/ul>\n\n\n\n<p>We need to register the HostedService in the dependency injection container.\u00a0\u00a0<\/p>\n\n\n\n<p>This can be done in the ConfigureServices method in the Startup Class by using the method services.AddHostedService where T is the type of the HostedService class.\u00a0\u00a0<\/p>\n\n\n\n<p><strong>Starting the Hosted Service<\/strong>: When the application starts, the HostedService will be automatically commenced by the framework. The StartAsync method is called, and the process starts running.\u00a0\u00a0<\/p>\n\n\n\n<p><strong>Shutting down the Hosted Service: <\/strong>When the application is shutting down the Hosted Service will be gracefully stopped. The StopAsync method is called that will stop the long running process, here we can also do the final cleanup. This method makes sure that the long running process stops correctly without terminating any process abruptly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"IHostedService_usage\"><\/span>IHostedService usage<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>using Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\nusing System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\npublic class LongRunningProcess : IHostedService, IDisposable\n{\n    private Timer _timer;\n    public Task StartAsync(CancellationToken cancellationToken)\n    {\n        \/\/ Create a timer that \texecutes the DoWork method every 5 seconds  \n        Console.WriteLine(\"Long-running process started.\"); \n        _timer = new Timer(DoWork, null, TimeSpan.Zero, TimeSpan.FromSeconds(5)); return Task.CompletedTask;\n    }\n\n    private void DoWork(object state)\n    {\n        \/\/ Perform the long-running task here  \n        Console.WriteLine(\"Performing a task...\");\n    }\n\n    public Task StopAsync(CancellationToken cancellationToken)\n    {\n        \/\/ Stop the timer\n        Console.WriteLine(\"Long-running process stopping.\");\n        _timer?.Change(Timeout.Infinite, 0);  \n        return Task.CompletedTask;\n    }\n\n    public void Dispose()\n    {\n        throw new NotImplementedException();\n    }\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Register_the_Hosted_Service_while_bootstrapping\"><\/span>Register the Hosted Service while bootstrapping<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>public class Program\n{\n    public static async Task Main(string[] args)\n    {\n        var hostBuilder = new HostBuilder()\n            .ConfigureServices((hostContext, services) =&gt;\n            {\n                \/\/ Register the LongRunningProcess as a hosted service\n                services.AddHostedService&lt;LongRunningProcess&gt;();\n            });\n        await hostBuilder.RunConsoleAsync();\n     }\n}\n<\/code><\/pre>\n\n\n\n<p>When we run this code, we will see the message &#8220;Long-running process started&#8221; followed by the &#8220;Performing a task&#8230;&#8221; message every 5 seconds.\u00a0\u00a0<\/p>\n\n\n\n<p>When we stop the application, it will print &#8220;Long running process stopping&#8221; indicating a graceful shutdown of the long-running process.\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Advantages_of_using_background_services_with_Hosted_Service\"><\/span>Advantages of using background services with Hosted Service<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Improved Scalability and Performance: Implementation of long running processes in the background will not hamper the flow of the running application threads. This will increase the performance of the application\u00a0\u00a0<\/li>\n\n\n\n<li>Easy Debugging: Implementing long running processes using Hosted Services provides a better way to handle and debug the code as it can be managed independently.<\/li>\n\n\n\n<li>Using Dependency Injection: Integrating more services with HostedServices using Dependency Injection would mean running many background processes simultaneously without tightly coupling any of them.\u00a0<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Long-running processes are a common requirement in many applications and managing them effectively is crucial for the stability and performance of the software. The Hosted Service feature in .NET Core provides a robust and structured approach to tackle this challenge. By implementing the IHostedService interface, we can ensure the long-running processes to start and stop gracefully, improving the overall performance of the application.\u00a0<\/p>\n[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]","protected":false},"excerpt":{"rendered":"<p>Introduction Long running tasks are very common in an API application. Tasks like data synchronization, periodic updates and background processing can be done asynchronously. ASP.NET Core Hosted Service can be used to implement background tasks. Hosted Service was introduced in ASP.NET Core 3.1 and are an excellent way to run background tasks.\u00a0 They can be [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":232543,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>Long running tasks are very common in an API application. Tasks like data synchronization, periodic updates and background processing can be done asynchronously.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>ASP.NET Core Hosted Service can be used to implement background tasks. Hosted Service was introduced in ASP.NET Core 3.1 and are an excellent way to run background tasks.\u00a0<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>They can be run on an ASP.NET Core web application. This is ideal if we need to update something that runs in the background that could affect all users.\u00a0<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">What is a Hosted Service?<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>Hosted Service is an interface provided by the Microsoft.Extensions.Hosting namespace in .NET Core. It allows developers to define background tasks or services that run as part of the application's lifetime. It provides a structured and managed way to execute long-running processes, ensuring they start and stop gracefully during application startup and shutdown.\u00a0\u00a0<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>We can implement Background Services using three Hosted Services in .NET:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:list -->\n<ul><!-- wp:list-item -->\n<li>Using IHostedService that activates a scoped service.<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>inheriting BackgroundService class that runs on a timer.<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>Using QueuedBackground tasks that run sequentially.\u00a0\u00a0<\/li>\n<!-- \/wp:list-item --><\/ul>\n<!-- \/wp:list -->\n\n<!-- wp:paragraph -->\n<p>Lets dive deep into the approach that uses IHostedService interface and implements background service for the long running tasks.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">IHostedService implementation<strong>\u00a0<\/strong><\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>We first create a class that inherits the IHostedService Interface. The Interface contains two methods:\u00a0\u00a0<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:list -->\n<ul><!-- wp:list-item -->\n<li><strong>StartAsync(CancellationToken):<\/strong> The StartAsync function defines the logic of the long running process that we must execute. It can be a loop or an asynchronous method that waits for an event to occur.\u00a0\u00a0<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li><strong>StopAsync(CancellationToken): <\/strong>This method is used to gracefully stop the process when the application is shutting down.\u00a0\u00a0<\/li>\n<!-- \/wp:list-item --><\/ul>\n<!-- \/wp:list -->\n\n<!-- wp:paragraph -->\n<p>We need to register the HostedService in the dependency injection container.\u00a0\u00a0<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>This can be done in the ConfigureServices method in the Startup Class by using the method services.AddHostedService where T is the type of the HostedService class.\u00a0\u00a0<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>Starting the Hosted Service<\/strong>: When the application starts, the HostedService will be automatically commenced by the framework. The StartAsync method is called, and the process starts running.\u00a0\u00a0<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p><strong>Shutting down the Hosted Service: <\/strong>When the application is shutting down the Hosted Service will be gracefully stopped. The StopAsync method is called that will stop the long running process, here we can also do the final cleanup. This method makes sure that the long running process stops correctly without terminating any process abruptly.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">IHostedService usage<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>using Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\nusing System;\nusing System.Threading;\nusing System.Threading.Tasks;\n\npublic class LongRunningProcess : IHostedService, IDisposable\n{\n    private Timer _timer;\n    public Task StartAsync(CancellationToken cancellationToken)\n    {\n        \/\/ Create a timer that \texecutes the DoWork method every 5 seconds  \n        Console.WriteLine(\"Long-running process started.\"); \n        _timer = new Timer(DoWork, null, TimeSpan.Zero, TimeSpan.FromSeconds(5)); return Task.CompletedTask;\n    }\n\n    private void DoWork(object state)\n    {\n        \/\/ Perform the long-running task here  \n        Console.WriteLine(\"Performing a task...\");\n    }\n\n    public Task StopAsync(CancellationToken cancellationToken)\n    {\n        \/\/ Stop the timer\n        Console.WriteLine(\"Long-running process stopping.\");\n        _timer?.Change(Timeout.Infinite, 0);  \n        return Task.CompletedTask;\n    }\n\n    public void Dispose()\n    {\n        throw new NotImplementedException();\n    }\n}<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">Register the Hosted Service while bootstrapping<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>public class Program\n{\n    public static async Task Main(string[] args)\n    {\n        var hostBuilder = new HostBuilder()\n            .ConfigureServices((hostContext, services) =>\n            {\n                \/\/ Register the LongRunningProcess as a hosted service\n                services.AddHostedService<LongRunningProcess>();\n            });\n        await hostBuilder.RunConsoleAsync();\n     }\n}\n<\/code><\/pre>\n<!-- \/wp:code -->\n\n<!-- wp:paragraph -->\n<p>When we run this code, we will see the message \"Long-running process started\" followed by the \"Performing a task...\" message every 5 seconds.\u00a0\u00a0<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>When we stop the application, it will print \"Long running process stopping\" indicating a graceful shutdown of the long-running process.\u00a0<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">Advantages of using background services with Hosted Service<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:list -->\n<ul><!-- wp:list-item -->\n<li>Improved Scalability and Performance: Implementation of long running processes in the background will not hamper the flow of the running application threads. This will increase the performance of the application\u00a0\u00a0<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>Easy Debugging: Implementing long running processes using Hosted Services provides a better way to handle and debug the code as it can be managed independently.<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>Using Dependency Injection: Integrating more services with HostedServices using Dependency Injection would mean running many background processes simultaneously without tightly coupling any of them.\u00a0<\/li>\n<!-- \/wp:list-item --><\/ul>\n<!-- \/wp:list -->\n\n<!-- wp:heading -->\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>Long-running processes are a common requirement in many applications and managing them effectively is crucial for the stability and performance of the software. The Hosted Service feature in .NET Core provides a robust and structured approach to tackle this challenge. By implementing the IHostedService interface, we can ensure the long-running processes to start and stop gracefully, improving the overall performance of the application.\u00a0<\/p>\n<!-- \/wp:paragraph -->","_et_gb_content_width":"","_lmt_disableupdate":"","_lmt_disable":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[32,33,39],"tags":[48,57,72],"class_list":["post-4481","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-net-core","category-app-development","category-general","tag-net","tag-background-services","tag-hosted-service"],"modified_by":"bhavana","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/staging.osmosys.co\/uk\/wp-json\/wp\/v2\/posts\/4481","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/staging.osmosys.co\/uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/staging.osmosys.co\/uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/staging.osmosys.co\/uk\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/staging.osmosys.co\/uk\/wp-json\/wp\/v2\/comments?post=4481"}],"version-history":[{"count":0,"href":"https:\/\/staging.osmosys.co\/uk\/wp-json\/wp\/v2\/posts\/4481\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/staging.osmosys.co\/uk\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/staging.osmosys.co\/uk\/wp-json\/wp\/v2\/media?parent=4481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/staging.osmosys.co\/uk\/wp-json\/wp\/v2\/categories?post=4481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/staging.osmosys.co\/uk\/wp-json\/wp\/v2\/tags?post=4481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}