**版本：202201**

# 查询主题文件

**GET** `/openapi/2022-01/themes/:theme_id/doc`

获取指定主题中特定文件的详情。

## 请求

**Path参数**

- `theme_id` string (required)

  主题 ID。

**Query参数**

- `type` string

  文件类型（layout, sections, snippets, assets, locales）。默认layout。

  **默认值：** `layout`
- `location` string

  文件的位置。默认为 theme.liquid。

  **默认值：** `theme.liquid`

## 响应

**200**

200

**application/json**

**数据结构 | 示例 | Result**

**数据结构**

- `doc` object

  - `id` string

    **示例：** `af02b274-2ac3-4f2f-af8f-d4430abfff9f`
  - `theme_id` string

    **示例：** `0af0d906-ab15-460e-99a5-a23e5c78b6e8`
  - `type` string

    **示例：** `layout`
  - `location` string

    **示例：** `theme.liquid`
  - `remote_url` string

    **示例：**
  - `content` string

    **示例：** `<!doctype html> <html class="no-js" lang="{{ shop.locale }}" {% if shop.locale == "ar-SA" %}dir="rtl"{% endif %}> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover"> <title>{{ page_title | default: shop.name }}</title> <meta name="keywords" content="{{ page_keyword | default: shop.name | escape }}"> <meta name="description" content="{{ page_description | default: shop.name | escape | truncatebytes: 320, '' }}"> <meta http-equiv="x-dns-prefetch-control" content="on"> <link rel="dns-prefetch" href="{{shop.cdn_domain}}"> <link rel="preconnect" href="{{shop.cdn_domain}}"> <link rel="dns-prefetch" href="{{shop.image_domain}}"> <link rel="preconnect" href="{{shop.image_domain}}"> <link rel="canonical" href="{{ canonical_url }}"> <link rel="shortcut icon" href="{{shop.favicon}}"> <meta name="theme-color" content="{{ settings.color_primary }}"> <meta name="format-detection" content="telephone=no, email=no"> {{ settings.type_heading_font_family | font_url | preload_tag: as: 'font', type: 'font/woff2', crossorigin: 'anonymous' }} {{ settings.type_text_font_family | font_url | preload_tag: as: 'font', type: 'font/woff2', crossorigin: 'anonymous' }} {% include 'social_meta_tags' %} {% include 'runtime' %} {% include 'settings' %} {% include 'theme_css' %} <script> window.SHOP_PARAMS = { product_lang:{ added_to_cart_successfully:{{ 'i18n.product.product_detail.added_to_bag_successfully' | t | json }}, view_cart:{{ 'i18n.product.product_detail.view_cart' | t | json }}, select_variant:{{ 'i18n.product.product_detail.select_variant' | t | json}}, line_items_variant_withdraw: {{ 'i18n.bag.errors.not_in_stock' | t | json }}, line_items_variant_sold_out: {{ 'i18n.bag.errors.sold_out' | t | json }}, product_reorder: {{ 'i18n.bag.errors.reorder' | t | json }} }, product_settings: { add_to_cart_process:{{ settings.cart_style | default: "page" | json }}, } } window.breakpoint = {{settings.breakpoint}}; window.disabled_exts = ["bootstrap", "image_video", "social_login", "global_version", "share_product", "boowc", "paypal_express"]; </script> {{ content_for_header }} {% if settings.custom_css %} <style>{{settings.custom_css}}</style> {% endif %} <script async crossorigin="anonymous" src="{{shop.cdn_domain}}cuttlefish/v1/spz.min.js"></script> </head> <body class="nova template-{{template.name}} m-0 type-text-font-family leading-1.3" id="nova-theme"> {% if template.name == 'product' %} <script id="product-json" data-id="{{ product.id }}" type="application/json"> { "product": {{ product | json: "description,meta_description,meta_keyword,meta_title,brief" }}, "selected": {% if product.selected_or_first_available_variant == nil %}{} {% else %} {{ product.selected_or_first_available_variant | json }} {% endif %} } </script> {% endif %} {% include 'top_button' %} {% include 'product_snippet_template' %} <div class="page_container"> {% section 'announcement' %} {% section 'header' %} {%- comment -%} 弹窗公告插件 {%- endcomment -%} <div class="plugin__static-div"></div> <div class="main-content" id="main-content"> {% include 'breadcrumbs' %} {{ content_for_layout }} </div> {% section 'footer' %} </div> {{ content_for_js }} {% include 'structured_data' %} {% include 'cart_drawer' %} {% include 'add_cart_toast' %} {% include 'quick_shop' %} {% include 'toast' %} {% include 'add_cart_toast' %} {% include 'quick_shop' %} </body> </html>`

```json
{
  "doc": {
    "id": "af02b274-2ac3-4f2f-af8f-d4430abfff9f",
    "theme_id": "0af0d906-ab15-460e-99a5-a23e5c78b6e8",
    "type": "layout",
    "location": "theme.liquid",
    "remote_url": "",
    "content": "<!doctype html>\n<html class=\"no-js\" lang=\"{{ shop.locale }}\" {% if shop.locale == \"ar-SA\" %}dir=\"rtl\"{% endif %}>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n    <meta name=\"viewport\" content=\"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover\">\n    <title>{{ page_title | default: shop.name }}</title>\n    <meta name=\"keywords\" content=\"{{ page_keyword | default: shop.name | escape }}\">\n    <meta name=\"description\" content=\"{{ page_description | default: shop.name | escape | truncatebytes: 320, '' }}\">\n    <meta http-equiv=\"x-dns-prefetch-control\" content=\"on\">\n    <link rel=\"dns-prefetch\" href=\"{{shop.cdn_domain}}\">\n    <link rel=\"preconnect\" href=\"{{shop.cdn_domain}}\">\n    <link rel=\"dns-prefetch\" href=\"{{shop.image_domain}}\">\n    <link rel=\"preconnect\" href=\"{{shop.image_domain}}\">\n    <link rel=\"canonical\" href=\"{{ canonical_url }}\">\n    <link rel=\"shortcut icon\" href=\"{{shop.favicon}}\">\n    <meta name=\"theme-color\" content=\"{{ settings.color_primary }}\">\n    <meta name=\"format-detection\" content=\"telephone=no, email=no\">\n    {{ settings.type_heading_font_family | font_url | preload_tag: as: 'font', type: 'font/woff2', crossorigin: 'anonymous' }}\n    {{ settings.type_text_font_family | font_url | preload_tag: as: 'font', type: 'font/woff2', crossorigin: 'anonymous' }}\n    {% include 'social_meta_tags' %}\n    {% include 'runtime' %}\n    {% include 'settings' %}\n    {% include 'theme_css' %}\n    <script>\n      window.SHOP_PARAMS = {\n        product_lang:{\n          added_to_cart_successfully:{{ 'i18n.product.product_detail.added_to_bag_successfully' | t  | json }},\n          view_cart:{{ 'i18n.product.product_detail.view_cart' | t  | json }},\n          select_variant:{{ 'i18n.product.product_detail.select_variant' | t | json}},\n          line_items_variant_withdraw: {{ 'i18n.bag.errors.not_in_stock' | t | json }},\n          line_items_variant_sold_out: {{ 'i18n.bag.errors.sold_out' | t | json }},\n          product_reorder: {{ 'i18n.bag.errors.reorder' | t | json }}\n        },\n        product_settings: {\n          add_to_cart_process:{{ settings.cart_style | default: \"page\" | json }},\n        }\n      }\n      window.breakpoint = {{settings.breakpoint}};\n      window.disabled_exts = [\"bootstrap\", \"image_video\", \"social_login\", \"global_version\", \"share_product\", \"boowc\", \"paypal_express\"];\n    </script>\n    {{ content_for_header }}\n    {% if settings.custom_css %}\n      <style>{{settings.custom_css}}</style>\n    {% endif %}\n    <script async crossorigin=\"anonymous\" src=\"{{shop.cdn_domain}}cuttlefish/v1/spz.min.js\"></script>\n  </head>\n  <body class=\"nova template-{{template.name}} m-0 type-text-font-family leading-1.3\" id=\"nova-theme\">\n    {% if template.name == 'product' %}\n      <script\n        id=\"product-json\"\n        data-id=\"{{ product.id }}\"\n        type=\"application/json\">\n        {\n          \"product\": {{ product | json: \"description,meta_description,meta_keyword,meta_title,brief\" }},\n          \"selected\":\n          {% if product.selected_or_first_available_variant == nil %}{}\n          {% else %}\n            {{ product.selected_or_first_available_variant | json }}\n          {% endif %}\n        }\n      </script>\n    {% endif %}\n    {% include 'top_button' %}\n    {% include 'product_snippet_template' %}\n    <div class=\"page_container\">\n      {% section 'announcement' %}\n      {% section 'header' %}\n      {%- comment -%} 弹窗公告插件 {%- endcomment -%}\n      <div class=\"plugin__static-div\"></div>\n      <div class=\"main-content\" id=\"main-content\">\n        {% include 'breadcrumbs' %}\n        {{ content_for_layout }}\n      </div>\n      {% section 'footer' %}\n    </div>\n    {{ content_for_js }}\n    {% include 'structured_data' %}\n    {% include 'cart_drawer' %}\n    {% include 'add_cart_toast' %}\n    {% include 'quick_shop' %}\n    {% include 'toast' %}\n    {% include 'add_cart_toast' %}\n    {% include 'quick_shop' %}\n  </body>\n</html>"
  }
}
```

```json
{
  "doc": {
    "id": "af02b274-2ac3-4f2f-af8f-d4430abfff9f",
    "theme_id": "0af0d906-ab15-460e-99a5-a23e5c78b6e8",
    "type": "layout",
    "location": "theme.liquid",
    "remote_url": "",
    "content": "<!doctype html>\n<html class=\"no-js\" lang=\"{{ shop.locale }}\" {% if shop.locale == \"ar-SA\" %}dir=\"rtl\"{% endif %}>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n    <meta name=\"viewport\" content=\"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover\">\n    <title>{{ page_title | default: shop.name }}</title>\n    <meta name=\"keywords\" content=\"{{ page_keyword | default: shop.name | escape }}\">\n    <meta name=\"description\" content=\"{{ page_description | default: shop.name | escape | truncatebytes: 320, '' }}\">\n    <meta http-equiv=\"x-dns-prefetch-control\" content=\"on\">\n    <link rel=\"dns-prefetch\" href=\"{{shop.cdn_domain}}\">\n    <link rel=\"preconnect\" href=\"{{shop.cdn_domain}}\">\n    <link rel=\"dns-prefetch\" href=\"{{shop.image_domain}}\">\n    <link rel=\"preconnect\" href=\"{{shop.image_domain}}\">\n    <link rel=\"canonical\" href=\"{{ canonical_url }}\">\n    <link rel=\"shortcut icon\" href=\"{{shop.favicon}}\">\n    <meta name=\"theme-color\" content=\"{{ settings.color_primary }}\">\n    <meta name=\"format-detection\" content=\"telephone=no, email=no\">\n    {{ settings.type_heading_font_family | font_url | preload_tag: as: 'font', type: 'font/woff2', crossorigin: 'anonymous' }}\n    {{ settings.type_text_font_family | font_url | preload_tag: as: 'font', type: 'font/woff2', crossorigin: 'anonymous' }}\n    {% include 'social_meta_tags' %}\n    {% include 'runtime' %}\n    {% include 'settings' %}\n    {% include 'theme_css' %}\n    <script>\n      window.SHOP_PARAMS = {\n        product_lang:{\n          added_to_cart_successfully:{{ 'i18n.product.product_detail.added_to_bag_successfully' | t  | json }},\n          view_cart:{{ 'i18n.product.product_detail.view_cart' | t  | json }},\n          select_variant:{{ 'i18n.product.product_detail.select_variant' | t | json}},\n          line_items_variant_withdraw: {{ 'i18n.bag.errors.not_in_stock' | t | json }},\n          line_items_variant_sold_out: {{ 'i18n.bag.errors.sold_out' | t | json }},\n          product_reorder: {{ 'i18n.bag.errors.reorder' | t | json }}\n        },\n        product_settings: {\n          add_to_cart_process:{{ settings.cart_style | default: \"page\" | json }},\n        }\n      }\n      window.breakpoint = {{settings.breakpoint}};\n      window.disabled_exts = [\"bootstrap\", \"image_video\", \"social_login\", \"global_version\", \"share_product\", \"boowc\", \"paypal_express\"];\n    </script>\n    {{ content_for_header }}\n    {% if settings.custom_css %}\n      <style>{{settings.custom_css}}</style>\n    {% endif %}\n    <script async crossorigin=\"anonymous\" src=\"{{shop.cdn_domain}}cuttlefish/v1/spz.min.js\"></script>\n  </head>\n  <body class=\"nova template-{{template.name}} m-0 type-text-font-family leading-1.3\" id=\"nova-theme\">\n    {% if template.name == 'product' %}\n      <script\n        id=\"product-json\"\n        data-id=\"{{ product.id }}\"\n        type=\"application/json\">\n        {\n          \"product\": {{ product | json: \"description,meta_description,meta_keyword,meta_title,brief\" }},\n          \"selected\":\n          {% if product.selected_or_first_available_variant == nil %}{}\n          {% else %}\n            {{ product.selected_or_first_available_variant | json }}\n          {% endif %}\n        }\n      </script>\n    {% endif %}\n    {% include 'top_button' %}\n    {% include 'product_snippet_template' %}\n    <div class=\"page_container\">\n      {% section 'announcement' %}\n      {% section 'header' %}\n      {%- comment -%} 弹窗公告插件 {%- endcomment -%}\n      <div class=\"plugin__static-div\"></div>\n      <div class=\"main-content\" id=\"main-content\">\n        {% include 'breadcrumbs' %}\n        {{ content_for_layout }}\n      </div>\n      {% section 'footer' %}\n    </div>\n    {{ content_for_js }}\n    {% include 'structured_data' %}\n    {% include 'cart_drawer' %}\n    {% include 'add_cart_toast' %}\n    {% include 'quick_shop' %}\n    {% include 'toast' %}\n    {% include 'add_cart_toast' %}\n    {% include 'quick_shop' %}\n  </body>\n</html>"
  }
}
```
