> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # UpdateCategory # Package: blog # Namespace: CategoryService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/blog/category/update-category.md ## Permission Scopes: Manage Blog: SCOPE.DC-BLOG.MANAGE-BLOG ## Introduction Updates a category. --- ## REST API ### Schema ``` Method: updateCategory Description: Updates a category. URL: https://www.wixapis.com/blog/v3/categories/{category.id} Method: PATCH # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: category, category.id Method parameters: param name: category | type: Category | required: true - name: id | type: string | description: Category GUID. | required: true - name: label | type: string | description: Category label. Displayed in the Category Menu. - name: description | type: string | description: Category description. - name: displayPosition | type: integer | description: Position of the category in the [Category Menu](https://support.wix.com/en/article/wix-blog-adding-and-customizing-a-category-menu). Categories are displayed in ascending order. Categories with a position of `-1` appear at the end of the sequence. Default: `-1` - name: translationId | type: string | description: GUID of the category's translations. All translations of a single category share the same `translationId`. - name: language | type: string | description: Category language. 2-or-4-letter language code in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. - name: slug | type: string | description: Part of a category's URL that refers to a specific category. For example, the slug of `https:/example.com/blog/category/famous-cats` is `famous-cats`. - name: seoData | type: SeoSchema | description: SEO data. - name: tags | type: array | description: SEO tag information. - name: type | type: string | description: SEO tag type. Supported values: `title`, `meta`, `script`, `link`. - name: props | type: object | description: A `{"key": "value"}` pair object where each SEO tag property (`"name"`, `"content"`, `"rel"`, `"href"`) contains a value. For example: `{"name": "description", "content": "the description itself"}`. - name: meta | type: object | description: SEO tag metadata. For example, `{"height": 300, "width": 240}`. - name: children | type: string | description: SEO tag inner content. For example, ` inner content `. - name: custom | type: boolean | description: Whether the tag is a [custom tag](https://support.wix.com/en/article/adding-additional-meta-tags-to-your-sites-pages). - name: disabled | type: boolean | description: Whether the tag is disabled. If the tag is disabled, people can't find your page when searching for this phrase in search engines. - name: settings | type: Settings | description: SEO general settings. - name: preventAutoRedirect | type: boolean | description: Whether the [automatical redirect visits](https://support.wix.com/en/article/customizing-your-pages-seo-settings-in-the-seo-panel) from the old URL to the new one is enabled. Default: `false` (automatical redirect is enabled). - name: keywords | type: array | description: User-selected keyword terms for a specific page. - name: term | type: string | description: Keyword value. - name: isMain | type: boolean | description: Whether the keyword is the main focus keyword. - name: origin | type: string | description: The source that added the keyword terms to the SEO settings. - name: coverImage | type: Image | description: Category cover image. - name: id | type: string | description: WixMedia image GUID. - name: url | type: string | description: Image URL. - name: altText | type: string | description: Image alt text. param name: fieldsets | type: array | description: List of additional category fields to include in the response. By default only the category’s base fields are returned. Base fields are all category fields that don't appear in the fieldset enum. To retrieve a field, pass the relevant fieldset in the enum in the `fieldsets` array. For example, add the `URL` fieldset to `fieldsets` to retrieve the url field in the response in addition to the category’s base fields. - enum: - UNKNOWN: - URL: Includes category URL. - SEO: Includes SEO data. Return type: UpdateCategoryResponse - name: category | type: Category | description: Category info. - name: id | type: string | description: Category GUID. - name: label | type: string | description: Category label. Displayed in the Category Menu. - name: postCount | type: integer | description: Number of posts in the category. - name: url | type: PageUrl | description: The `url` of the page that lists every post with the specified category. - name: base | type: string | description: The base URL. For premium sites, this is the domain. For free sites, this is the site URL. For example, `mysite.wixsite.com/mysite`. - name: path | type: string | description: The relative path for the page within the site. For example, `/product-page/a-product`. - name: description | type: string | description: Category description. - name: displayPosition | type: integer | description: Position of the category in the [Category Menu](https://support.wix.com/en/article/wix-blog-adding-and-customizing-a-category-menu). Categories are displayed in ascending order. Categories with a position of `-1` appear at the end of the sequence. Default: `-1` - name: translationId | type: string | description: GUID of the category's translations. All translations of a single category share the same `translationId`. - name: language | type: string | description: Category language. 2-or-4-letter language code in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. - name: slug | type: string | description: Part of a category's URL that refers to a specific category. For example, the slug of `https:/example.com/blog/category/famous-cats` is `famous-cats`. - name: seoData | type: SeoSchema | description: SEO data. - name: tags | type: array | description: SEO tag information. - name: type | type: string | description: SEO tag type. Supported values: `title`, `meta`, `script`, `link`. - name: props | type: object | description: A `{"key": "value"}` pair object where each SEO tag property (`"name"`, `"content"`, `"rel"`, `"href"`) contains a value. For example: `{"name": "description", "content": "the description itself"}`. - name: meta | type: object | description: SEO tag metadata. For example, `{"height": 300, "width": 240}`. - name: children | type: string | description: SEO tag inner content. For example, ` inner content `. - name: custom | type: boolean | description: Whether the tag is a [custom tag](https://support.wix.com/en/article/adding-additional-meta-tags-to-your-sites-pages). - name: disabled | type: boolean | description: Whether the tag is disabled. If the tag is disabled, people can't find your page when searching for this phrase in search engines. - name: settings | type: Settings | description: SEO general settings. - name: preventAutoRedirect | type: boolean | description: Whether the [automatical redirect visits](https://support.wix.com/en/article/customizing-your-pages-seo-settings-in-the-seo-panel) from the old URL to the new one is enabled. Default: `false` (automatical redirect is enabled). - name: keywords | type: array | description: User-selected keyword terms for a specific page. - name: term | type: string | description: Keyword value. - name: isMain | type: boolean | description: Whether the keyword is the main focus keyword. - name: origin | type: string | description: The source that added the keyword terms to the SEO settings. - name: coverImage | type: Image | description: Category cover image. - name: id | type: string | description: WixMedia image GUID. - name: url | type: string | description: Image URL. - name: height | type: integer | description: Original image height. - name: width | type: integer | description: Original image width. - name: altText | type: string | description: Image alt text. - name: filename | type: string | description: Image filename. - name: updatedDate | type: string | description: Date and time the Category was last updated. ``` ### Examples ### UpdateCategory ```curl ~~~cURL curl --location --request PATCH 'https://www.wixapis.com/blog/v3/categories/5f2bcaa0879ad500173577f3' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ --data-raw '{ "category": { "description": "Posts about my summer and adventures", }, "fieldMask": "category.description" }' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.blog.CategoryService.updateCategory(_id, category, options) Description: Updates a category. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: category, _id Method parameters: param name: _id | type: string | description: Category GUID. | required: true param name: category | type: UpdateCategory | required: true - name: _id | type: string | description: Category GUID. - name: label | type: string | description: Category label. Displayed in the Category Menu. - name: description | type: string | description: Category description. - name: displayPosition | type: integer | description: Position of the category in the [Category Menu](https://support.wix.com/en/article/wix-blog-adding-and-customizing-a-category-menu). Categories are displayed in ascending order. Categories with a position of `-1` appear at the end of the sequence. Default: `-1` - name: translationId | type: string | description: GUID of the category's translations. All translations of a single category share the same `translationId`. - name: language | type: string | description: Category language. 2-or-4-letter language code in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. - name: slug | type: string | description: Part of a category's URL that refers to a specific category. For example, the slug of `https:/example.com/blog/category/famous-cats` is `famous-cats`. - name: seoData | type: SeoSchema | description: SEO data. - name: tags | type: array | description: SEO tag information. - name: type | type: string | description: SEO tag type. Supported values: `title`, `meta`, `script`, `link`. - name: props | type: object | description: A `{"key": "value"}` pair object where each SEO tag property (`"name"`, `"content"`, `"rel"`, `"href"`) contains a value. For example: `{"name": "description", "content": "the description itself"}`. - name: meta | type: object | description: SEO tag metadata. For example, `{"height": 300, "width": 240}`. - name: children | type: string | description: SEO tag inner content. For example, ` inner content `. - name: custom | type: boolean | description: Whether the tag is a [custom tag](https://support.wix.com/en/article/adding-additional-meta-tags-to-your-sites-pages). - name: disabled | type: boolean | description: Whether the tag is disabled. If the tag is disabled, people can't find your page when searching for this phrase in search engines. - name: settings | type: Settings | description: SEO general settings. - name: preventAutoRedirect | type: boolean | description: Whether the [automatical redirect visits](https://support.wix.com/en/article/customizing-your-pages-seo-settings-in-the-seo-panel) from the old URL to the new one is enabled. Default: `false` (automatical redirect is enabled). - name: keywords | type: array | description: User-selected keyword terms for a specific page. - name: term | type: string | description: Keyword value. - name: isMain | type: boolean | description: Whether the keyword is the main focus keyword. - name: origin | type: string | description: The source that added the keyword terms to the SEO settings. - name: coverImage | type: string | description: Category cover image. param name: options | type: UpdateCategoryOptions none - name: fieldsets | type: array | description: List of additional category fields to include in the response. By default only the category’s base fields are returned. Base fields are all category fields that don't appear in the fieldset enum. To retrieve a field, pass the relevant fieldset in the enum in the `fieldsets` array. For example, add the `URL` fieldset to `fieldsets` to retrieve the url field in the response in addition to the category’s base fields. - enum: - UNKNOWN: - URL: Includes category URL. - SEO: Includes SEO data. Return type: PROMISE - name: _id | type: string | description: Category GUID. - name: label | type: string | description: Category label. Displayed in the Category Menu. - name: postCount | type: integer | description: Number of posts in the category. - name: url | type: string | description: The `url` of the page that lists every post with the specified category. - name: description | type: string | description: Category description. - name: displayPosition | type: integer | description: Position of the category in the [Category Menu](https://support.wix.com/en/article/wix-blog-adding-and-customizing-a-category-menu). Categories are displayed in ascending order. Categories with a position of `-1` appear at the end of the sequence. Default: `-1` - name: translationId | type: string | description: GUID of the category's translations. All translations of a single category share the same `translationId`. - name: language | type: string | description: Category language. 2-or-4-letter language code in [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. - name: slug | type: string | description: Part of a category's URL that refers to a specific category. For example, the slug of `https:/example.com/blog/category/famous-cats` is `famous-cats`. - name: seoData | type: SeoSchema | description: SEO data. - name: tags | type: array | description: SEO tag information. - name: type | type: string | description: SEO tag type. Supported values: `title`, `meta`, `script`, `link`. - name: props | type: object | description: A `{"key": "value"}` pair object where each SEO tag property (`"name"`, `"content"`, `"rel"`, `"href"`) contains a value. For example: `{"name": "description", "content": "the description itself"}`. - name: meta | type: object | description: SEO tag metadata. For example, `{"height": 300, "width": 240}`. - name: children | type: string | description: SEO tag inner content. For example, ` inner content `. - name: custom | type: boolean | description: Whether the tag is a [custom tag](https://support.wix.com/en/article/adding-additional-meta-tags-to-your-sites-pages). - name: disabled | type: boolean | description: Whether the tag is disabled. If the tag is disabled, people can't find your page when searching for this phrase in search engines. - name: settings | type: Settings | description: SEO general settings. - name: preventAutoRedirect | type: boolean | description: Whether the [automatical redirect visits](https://support.wix.com/en/article/customizing-your-pages-seo-settings-in-the-seo-panel) from the old URL to the new one is enabled. Default: `false` (automatical redirect is enabled). - name: keywords | type: array | description: User-selected keyword terms for a specific page. - name: term | type: string | description: Keyword value. - name: isMain | type: boolean | description: Whether the keyword is the main focus keyword. - name: origin | type: string | description: The source that added the keyword terms to the SEO settings. - name: coverImage | type: string | description: Category cover image. - name: _updatedDate | type: Date | description: Date and time the Category was last updated. ``` ### Examples ### updateCategory ```javascript import { categories } from '@wix/blog'; async function updateCategory(_id,category,options) { const response = await categories.updateCategory(_id,category,options); }; ``` ### updateCategory (with elevated permissions) ```javascript import { categories } from '@wix/blog'; import { auth } from '@wix/essentials'; async function myUpdateCategoryMethod(_id,category,options) { const elevatedUpdateCategory = auth.elevate(categories.updateCategory); const response = await elevatedUpdateCategory(_id,category,options); } ``` ### updateCategory (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { categories } from '@wix/blog'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { categories }, // Include the auth strategy and host as relevant }); async function updateCategory(_id,category,options) { const response = await myWixClient.categories.updateCategory(_id,category,options); }; ``` ---