{"id":3593,"date":"2022-02-23T11:24:10","date_gmt":"2022-02-23T11:24:10","guid":{"rendered":"http:\/\/the-codest.localhost\/blog\/simple-filters-in-rails-api\/"},"modified":"2026-04-28T14:05:32","modified_gmt":"2026-04-28T14:05:32","slug":"vienkarsi-filtri-rails-api","status":"publish","type":"post","link":"https:\/\/thecodest.co\/lv\/blog\/simple-filters-in-rails-api\/","title":{"rendered":"Vienk\u0101r\u0161i filtri Rails API"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Filters<\/h2>\n\n\n\n<p>You have probably seen this before:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"># app\/controllers\/api\/v1\/things_controller.rb\n\nmodule <a href=\"https:\/\/thecodest.co\/lv\/blog\/compare-staff-augmentation-firms-that-excel-in-api-team-staffing-for-financial-technology-projects\/\">API<\/a>\n  module V1\n    class ThingsController &lt; BaseController\n      def index\n        @things = Thing.all\n        @things = @things.where(size: params[:size]) if params[:size]\n        @things = @things.where('name ILIKE ?', \"%#{params[:name_contains]}%\") if params[:name_contains]\n\n        render json: @things\n      end\n    end\n  end\nend<\/code><\/pre>\n\n\n\n<p>Why do I consider it to be a bad <a href=\"https:\/\/thecodest.co\/lv\/dictionary\/what-is-code-refactoring\/\">code<\/a>? Because it simply makes our controller fat.<br>IMHO we should extract as many logic as we can from controllers and use a purpose-related<br>utils or services. In this case we will implement a generic filter that we will be able<br>to use across many controllers.<\/p>\n\n\n\n<p>But wait, first let&#8217;s analyse the current code. It can be bad but works, though.<br>We have some initial scope (<code>Thing.all<\/code>) and then are limiting it if user has passed<br>related parameter. For each filter we actually check if the param was passed and if so,<br>we apply a filter. The second thing is that we don&#8217;t need to use the ivar, we can use<br>plain old local variables.<\/p>\n\n\n\n<p>Ok, then. Couldn&#8217;t we use some service object to mutate the initial scope?<br>The execution can look like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"># app\/controllers\/api\/v1\/things_controller.rb\n\nmodule API\n  module V1\n    class ThingsController &lt; BaseController\n      def index\n        scope = Thing.all\n        things = Things::IndexFilter.new.call(scope, params)\n\n        render json: things\n      end\n    end\n  end\nend<\/code><\/pre>\n\n\n\n<p>It looks much better now, but of course we have to implement the filter yet.<br>Note that call&#8217;s signature will be the same for all resources, so we can have<br>some generic class for this task.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"># app\/services\/generic\/index_filter.rb\n\nmodule Generic\n  class IndexFilter\n    EMPTY_HASH = {}.freeze\n\n    def self.filters\n      EMPTY_HASH\n    end\n\n    def call(scope, params)\n      apply_filters!(self.class.filters.keys, scope, params)\n    end\n\n    private\n\n    def apply_filters!(filter_keys, scope, params)\n      filter_keys.inject(scope.dup) do |current_scope, filter_key|\n        apply_filter!(filter_key, current_scope, params)\n      end\n    end\n\n    def apply_filter!(filter_key, scope, params)\n      filter = fetch_filter(filter_key)\n      return scope unless apply_filter?(filter, params)\n\n      filter[:apply].call(scope, params)\n    end\n\n    def apply_filter?(filter, params)\n      filter[:apply?].call(params)\n    end\n\n    def fetch_filter(filter_key)\n      self.class.filters.fetch(filter_key) { raise ArgumentError, 'unknown filter' }\n    end\n  end\nend<\/code><\/pre>\n\n\n\n<p>Seems complicated? Not really &#8211; all the magic happens in <code>#apply_filters!<\/code>.<br>We take the duplicate of the initial scope and apply each filter to it.<\/p>\n\n\n\n<p>When we apply the scope it means we mutate the duplicate of our initial scope.<br>And we expect filters to be implemented as a <a href=\"https:\/\/thecodest.co\/lv\/blog\/hash-to-use-or-not-to-use\/\">hash<\/a> in the <code>self.filters<\/code> method<br>of a child class. Let&#8217;s do it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"># app\/services\/things\/index_filter.rb\n\nmodule Things\n  class IndexFilter &lt; Generic::IndexFilter\n    FILTERS = {\n      size_filter: {\n        apply?: -&gt;(params) {\n          params[:size].is_a?(String)\n        },\n        apply: -&gt;(scope, params) {\n          scope.where(size: params[:size])\n        }\n      }.freeze,\n      name_contains_filter: {\n        apply?: -&gt;(params) {\n          params[:name_contains].is_a?(String)\n        },\n        apply: -&gt;(scope, params) {\n          scope.where('name ILIKE ?', \"%#{params[:name_contains]}%\")\n        }\n      }.freeze\n    }.freeze\n\n    def self.filters\n      FILTERS\n    end\n  end\nend<\/code><\/pre>\n\n\n\n<p>That&#8217;s it! We have written more code, but the simple filters will look the same<br>way for all the resources. We have cleaned controller from the code responsible<br>of filtering and provided &#8216;specialised&#8217; class for this purpose that follows very<br>clear convention.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/thecodest.co\/careers#offers]\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/ruby-1-.png\" alt=\"Ruby Developer Offer\"\/><\/a><\/figure>\n\n\n\n<p><strong>Read more:<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/pros-and-cons-of-ruby-software-development\/\">Pros and cons of Ruby software development<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/rails-and-other-means-of-transport\">Rails and Other Means of Transport<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/rails-development-with-tmux-vim-fzf-ripgrep\">Rails Development with TMUX, Vim, Fzf + Ripgrep<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Vai j\u016bs dusmojaties ikreiz, kad redzat, k\u0101 rails kontrolier\u012b tiek main\u012bti instance main\u012bgie, lai filtr\u0113tu datus? \u0160is raksts ir dom\u0101ts tie\u0161i jums. \ud83d\ude42<\/p>","protected":false},"author":2,"featured_media":3594,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-3593","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-development"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Simple Filters in Rails API - The Codest<\/title>\n<meta name=\"description\" content=\"Are you angry every time you see mutating instance variables in rails controller to filter data? This article is for you. :)\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thecodest.co\/lv\/emuars\/vienkarsi-filtri-rails-api\/\" \/>\n<meta property=\"og:locale\" content=\"lv_LV\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Simple Filters in Rails API\" \/>\n<meta property=\"og:description\" content=\"Are you angry every time you see mutating instance variables in rails controller to filter data? This article is for you. :)\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thecodest.co\/lv\/emuars\/vienkarsi-filtri-rails-api\/\" \/>\n<meta property=\"og:site_name\" content=\"The Codest\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-23T11:24:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-28T14:05:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/simple_filters_in_rails_api.png\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"thecodest\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"thecodest\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 min\u016btes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/simple-filters-in-rails-api\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/simple-filters-in-rails-api\\\/\"},\"author\":{\"name\":\"thecodest\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\"},\"headline\":\"Simple Filters in Rails API\",\"datePublished\":\"2022-02-23T11:24:10+00:00\",\"dateModified\":\"2026-04-28T14:05:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/simple-filters-in-rails-api\\\/\"},\"wordCount\":310,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/simple-filters-in-rails-api\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/simple_filters_in_rails_api.png\",\"articleSection\":[\"Software Development\"],\"inLanguage\":\"lv-LV\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/simple-filters-in-rails-api\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/simple-filters-in-rails-api\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/simple-filters-in-rails-api\\\/\",\"name\":\"Simple Filters in Rails API - The Codest\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/simple-filters-in-rails-api\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/simple-filters-in-rails-api\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/simple_filters_in_rails_api.png\",\"datePublished\":\"2022-02-23T11:24:10+00:00\",\"dateModified\":\"2026-04-28T14:05:32+00:00\",\"description\":\"Are you angry every time you see mutating instance variables in rails controller to filter data? This article is for you. :)\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/simple-filters-in-rails-api\\\/#breadcrumb\"},\"inLanguage\":\"lv-LV\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/simple-filters-in-rails-api\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"lv-LV\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/simple-filters-in-rails-api\\\/#primaryimage\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/simple_filters_in_rails_api.png\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/simple_filters_in_rails_api.png\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/simple-filters-in-rails-api\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thecodest.co\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Simple Filters in Rails API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"name\":\"The Codest\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thecodest.co\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"lv-LV\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\",\"name\":\"The Codest\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"lv-LV\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"width\":144,\"height\":36,\"caption\":\"The Codest\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/pl.linkedin.com\\\/company\\\/codest\",\"https:\\\/\\\/clutch.co\\\/profile\\\/codest\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\",\"name\":\"thecodest\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"lv-LV\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"caption\":\"thecodest\"},\"url\":\"https:\\\/\\\/thecodest.co\\\/lv\\\/author\\\/thecodest\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Vienk\u0101r\u0161i filtri Rails API - The Codest","description":"Vai j\u016bs dusmojaties ikreiz, kad redzat, k\u0101 rails kontrolier\u012b tiek main\u012bti instance main\u012bgie, lai filtr\u0113tu datus? \u0160is raksts ir dom\u0101ts tie\u0161i jums :)","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/thecodest.co\/lv\/emuars\/vienkarsi-filtri-rails-api\/","og_locale":"lv_LV","og_type":"article","og_title":"Simple Filters in Rails API","og_description":"Are you angry every time you see mutating instance variables in rails controller to filter data? This article is for you. :)","og_url":"https:\/\/thecodest.co\/lv\/emuars\/vienkarsi-filtri-rails-api\/","og_site_name":"The Codest","article_published_time":"2022-02-23T11:24:10+00:00","article_modified_time":"2026-04-28T14:05:32+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/simple_filters_in_rails_api.png","type":"image\/png"}],"author":"thecodest","twitter_card":"summary_large_image","twitter_misc":{"Written by":"thecodest","Est. reading time":"2 min\u016btes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thecodest.co\/blog\/simple-filters-in-rails-api\/#article","isPartOf":{"@id":"https:\/\/thecodest.co\/blog\/simple-filters-in-rails-api\/"},"author":{"name":"thecodest","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76"},"headline":"Simple Filters in Rails API","datePublished":"2022-02-23T11:24:10+00:00","dateModified":"2026-04-28T14:05:32+00:00","mainEntityOfPage":{"@id":"https:\/\/thecodest.co\/blog\/simple-filters-in-rails-api\/"},"wordCount":310,"commentCount":0,"publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"image":{"@id":"https:\/\/thecodest.co\/blog\/simple-filters-in-rails-api\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/simple_filters_in_rails_api.png","articleSection":["Software Development"],"inLanguage":"lv-LV","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thecodest.co\/blog\/simple-filters-in-rails-api\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thecodest.co\/blog\/simple-filters-in-rails-api\/","url":"https:\/\/thecodest.co\/blog\/simple-filters-in-rails-api\/","name":"Vienk\u0101r\u0161i filtri Rails API - The Codest","isPartOf":{"@id":"https:\/\/thecodest.co\/#website"},"primaryImageOfPage":{"@id":"https:\/\/thecodest.co\/blog\/simple-filters-in-rails-api\/#primaryimage"},"image":{"@id":"https:\/\/thecodest.co\/blog\/simple-filters-in-rails-api\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/simple_filters_in_rails_api.png","datePublished":"2022-02-23T11:24:10+00:00","dateModified":"2026-04-28T14:05:32+00:00","description":"Vai j\u016bs dusmojaties ikreiz, kad redzat, k\u0101 rails kontrolier\u012b tiek main\u012bti instance main\u012bgie, lai filtr\u0113tu datus? \u0160is raksts ir dom\u0101ts tie\u0161i jums :)","breadcrumb":{"@id":"https:\/\/thecodest.co\/blog\/simple-filters-in-rails-api\/#breadcrumb"},"inLanguage":"lv-LV","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thecodest.co\/blog\/simple-filters-in-rails-api\/"]}]},{"@type":"ImageObject","inLanguage":"lv-LV","@id":"https:\/\/thecodest.co\/blog\/simple-filters-in-rails-api\/#primaryimage","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/simple_filters_in_rails_api.png","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/simple_filters_in_rails_api.png","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/thecodest.co\/blog\/simple-filters-in-rails-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thecodest.co\/"},{"@type":"ListItem","position":2,"name":"Simple Filters in Rails API"}]},{"@type":"WebSite","@id":"https:\/\/thecodest.co\/#website","url":"https:\/\/thecodest.co\/","name":"The Codest","description":"","publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thecodest.co\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"lv-LV"},{"@type":"Organization","@id":"https:\/\/thecodest.co\/#organization","name":"The Codest","url":"https:\/\/thecodest.co\/","logo":{"@type":"ImageObject","inLanguage":"lv-LV","@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","width":144,"height":36,"caption":"The Codest"},"image":{"@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/pl.linkedin.com\/company\/codest","https:\/\/clutch.co\/profile\/codest"]},{"@type":"Person","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76","name":"thecodest","image":{"@type":"ImageObject","inLanguage":"lv-LV","@id":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","caption":"thecodest"},"url":"https:\/\/thecodest.co\/lv\/author\/thecodest\/"}]}},"_links":{"self":[{"href":"https:\/\/thecodest.co\/lv\/wp-json\/wp\/v2\/posts\/3593","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecodest.co\/lv\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecodest.co\/lv\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecodest.co\/lv\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thecodest.co\/lv\/wp-json\/wp\/v2\/comments?post=3593"}],"version-history":[{"count":6,"href":"https:\/\/thecodest.co\/lv\/wp-json\/wp\/v2\/posts\/3593\/revisions"}],"predecessor-version":[{"id":7997,"href":"https:\/\/thecodest.co\/lv\/wp-json\/wp\/v2\/posts\/3593\/revisions\/7997"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecodest.co\/lv\/wp-json\/wp\/v2\/media\/3594"}],"wp:attachment":[{"href":"https:\/\/thecodest.co\/lv\/wp-json\/wp\/v2\/media?parent=3593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecodest.co\/lv\/wp-json\/wp\/v2\/categories?post=3593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecodest.co\/lv\/wp-json\/wp\/v2\/tags?post=3593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}