HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

Create Category

Function

To create a new category with open API
透過open API創造一個新的分類

URL

POST <<api_domain>>/v1/categories

Request Parameters

ParameterTypeDescriptionExample
name_translations
*Required
HashCategory Name
分類名稱
-
*Can fill language en, zh-hant, max length is 40 characters.
可填寫不同語言 en, zh-hant, 最長40字
ruby "name_translations": { "en": "Category Name", "zh-hant": "分類名稱"}
seo_title_translationsHashTitle of SEO
SEO優化標題
-
*Max length is 55 characters.
最長55字
ruby "seo_title_translations": { "en": "Category SEO title", "zh-hant": " 分類 SEO 名稱"}
seo_description_translationsHashDescription of SEO
SEO優化描述
-
*Max length is 230 characters.
最長230字
ruby "seo_description_translations": { "en": "Category SEO description", "zh-hant": "分類 SEO 簡介" }
seo_keywordsStringKeywords of SEO,
SEO關鍵字
-
*Keywords should be separated by commas (,) max length is 160 characters.
關鍵字應以逗號(,)分隔, 最長160字
ruby "seo_keywords": "online shop, shopline, 電商, 網路開店"
seo_linkStringSEO url
自訂SEO url
ruby "seo_link": "shopline"
parent_idStringDecide which category is its parent category.
該分類的母分類
-
* Can not be the third layer
不可以是第三層分類
ruby "seo_keywords": "5bd16a4f16d18c000fc7f91f"
priorityIntegerCategory Sorting Priority
分類權重排序
-
Sort category from small to large. Having higher priority with smaller number.
由小至大排序,數字越小的會排在越前面。
ruby "priority": 5
banner_urlStringCategory Banner Picture
分類横幅圖片
ruby "banner_url": "https://shopline.tw/blog/wp- content/uploads/2015/11/logo-shopline-white.png"

JSON params example

{
    "category": {
      "name_translations": { "en": "換季特賣" },
      "seo_title_translations": { "en": "Seasonal sale", "zh-hant": "換季特賣" },
      "seo_description_translations": { "en": "Winter clothes- inventory clearance of clothes, shoes, boots, purses and other seasonal items.", "zh-hant": "冬季清倉特賣" },
      "seo_keywords": "特賣, 冬季",
      "seo_link": "seasonal_sale",
      "banner_url": "https://shopline.tw/blog/wp-content/uploads/2015/11/logo-shopline-white.png",
      "parent_id": "5c497098e3880960534a2733"
    }
}

Response Example

{
    "id": "5c74f405e388095f35c25f59",
    "name_translations": {
        "en": "換季特賣"
    },
    "seo_title_translations": {
        "en": "Seasonal sale",
        "zh-hant": "換季特賣"
    },
    "seo_description_translations": {
        "en": "Winter clothes- inventory clearance of clothes, shoes, boots, purses and other seasonal items.",
        "zh-hant": "冬季清倉特賣"
    },
    "seo_keywords": "特賣, 冬季",
    "key": null,
    "status": "active",
    "banner_medias": [
        {
            "images": {
                "original": {
                    "width": 1600,
                    "height": 500,
                    "url": "https://img.shoplineapp.com/media/image_clips/5c74f404e388095f35c25f58/original.png?1551168515"
                },
                "thumb": {
                    "width": 1600,
                    "height": 500,
                    "url": "https://img.shoplineapp.com/media/image_clips/5c74f404e388095f35c25f58/original.png?1551168515"
                },
                "source": {
                    "width": 1600,
                    "height": 500,
                    "url": "https://img.shoplineapp.com/media/image_clips/5c74f404e388095f35c25f58/original.png?1551168515"
                },
                "favicon_small": {
                    "width": 16,
                    "height": 16,
                    "url": "https://img.shoplineapp.com/media/second_clips/5c74f404e388095f35c25f58/favicon_small.png?1551168516"
                },
                "favicon": {
                    "width": 32,
                    "height": 32,
                    "url": "https://img.shoplineapp.com/media/second_clips/5c74f404e388095f35c25f58/favicon.png?1551168516"
                },
                "favicon_large": {
                    "width": 64,
                    "height": 64,
                    "url": "https://img.shoplineapp.com/media/second_clips/5c74f404e388095f35c25f58/favicon_large.png?1551168516"
                },
                "transparent_thumb": {
                    "width": 200,
                    "height": 200,
                    "url": "https://img.shoplineapp.com/media/second_clips/5c74f404e388095f35c25f58/transparent_thumb.png?1551168516"
                },
                "transparent_large": {
                    "width": 500,
                    "height": 156,
                    "url": "https://img.shoplineapp.com/media/second_clips/5c74f404e388095f35c25f58/transparent_large.png?1551168516"
                },
                "transparent_xlarge": {
                    "width": 1000,
                    "height": 313,
                    "url": "https://img.shoplineapp.com/media/second_clips/5c74f404e388095f35c25f58/transparent_xlarge.png?1551168516"
                },
                "transparent_medium": {
                    "width": 250,
                    "height": 78,
                    "url": "https://img.shoplineapp.com/media/second_clips/5c74f404e388095f35c25f58/transparent_medium.png?1551168516"
                }
            },
            "_id": "5c74f404e388095f35c25f58",
            "alt_translations": {}
        }
    ],
    "parent_id": "5c497098e3880960534a2733",
    "priority": 16
}