> 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 # GetCollectionBySlug # Package: catalogV1 # Namespace: CatalogReadApi # Method link: https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/get-collection-by-slug.md ## Permission Scopes: Read Products: SCOPE.DC-STORES.READ-PRODUCTS ## Introduction Retrieves a collection with the provided slug. --- ## REST API ### Schema ``` Method: getCollectionBySlug Description: Retrieves a collection with the provided slug. URL: https://www.wixapis.com/stores-reader/v1/collections/slug/{slug} Method: GET # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: slug Method parameters: param name: slug | type: none | required: true Return type: GetCollectionBySlugResponse - name: collection | type: Collection | description: The requested collection. - name: id | type: string | description: Collection GUID (generated automatically by the catalog). - name: name | type: string | description: Collection name. - name: media | type: Media | description: Media items (images, videos etc) associated with this collection. Read only. - name: mainMedia | type: MediaItem | description: Primary media (image, video etc) associated with this product. - ONE-OF: - name: image | type: MediaItemUrlAndSize | description: Image data (URL, size). - name: url | type: string | description: Media item URL. - name: width | type: integer | description: Media item width. - name: height | type: integer | description: Media item height. - name: format | type: string | description: Media format (mp4, png, etc.). - name: altText | type: string | description: Alt text. This text will be shown in case the image is not available. - name: video | type: MediaItemVideo | description: Video data (URL, size). - name: files | type: array | description: Data (URL, size) about each resolution for which this video is available. - name: stillFrameMediaId | type: string | description: GUID of an image taken from the video. Used primarily for Wix Search indexing. For example, `"nsplsh_306d666a123a4a74306459~mv2_d_4517_2992_s_4_2.jpg"`. - name: thumbnail | type: MediaItemUrlAndSize | description: Media item thumbnail details. - name: mediaType | type: MediaItemType | description: Media item type (image, video, etc.). - enum: - unspecified_media_item_type: - image: Image media type. - video: Video media type. - audio: Audio media type. - document: Document media type. - zip: Zip media type. - name: title | type: string | description: Media item title. - name: id | type: string | description: Media GUID (for example, `"nsplsh_306d666a123a4a74306459~mv2_d_4517_2992_s_4_2.jpg"`). - name: items | type: array | description: Media (images, videos etc) associated with this product. - name: numberOfProducts | type: integer | description: Number of products in the collection. Read only. - name: description | type: string | description: Collection description. - name: slug | type: string | description: Collection slug. - name: visible | type: boolean | description: Collection visibility. Only impacts dynamic pages, no impact on static pages. Default: `true`. ``` ### Examples ### GetCollectionBySlug ```curl ~~~cURL curl -X GET \ 'https://www.wixapis.com/stores/v1/collections/slug/coffee-products' \ -H 'Authorization: ' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.catalogV1.CatalogReadApi.getCollectionBySlug(slug) Description: Retrieves a collection with the provided slug. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: slug Method parameters: param name: slug | type: string | description: Slug of the collection to retrieve. | required: true Return type: PROMISE - name: collection | type: Collection | description: The requested collection. - name: _id | type: string | description: Collection GUID (generated automatically by the catalog). - name: name | type: string | description: Collection name. - name: media | type: Media | description: Media items (images, videos etc) associated with this collection. Read only. - name: mainMedia | type: MediaItem | description: Primary media (image, video etc) associated with this product. - ONE-OF: - name: image | type: MediaItemUrlAndSize | description: Image data (URL, size). - name: url | type: string | description: Media item URL. - name: width | type: integer | description: Media item width. - name: height | type: integer | description: Media item height. - name: format | type: string | description: Media format (mp4, png, etc.). - name: altText | type: string | description: Alt text. This text will be shown in case the image is not available. - name: video | type: MediaItemVideo | description: Video data (URL, size). - name: files | type: array | description: Data (URL, size) about each resolution for which this video is available. - name: stillFrameMediaId | type: string | description: GUID of an image taken from the video. Used primarily for Wix Search indexing. For example, `"nsplsh_306d666a123a4a74306459~mv2_d_4517_2992_s_4_2.jpg"`. - name: thumbnail | type: MediaItemUrlAndSize | description: Media item thumbnail details. - name: mediaType | type: MediaItemType | description: Media item type (image, video, etc.). - enum: - unspecified_media_item_type: - image: Image media type. - video: Video media type. - audio: Audio media type. - document: Document media type. - zip: Zip media type. - name: title | type: string | description: Media item title. - name: _id | type: string | description: Media GUID (for example, `"nsplsh_306d666a123a4a74306459~mv2_d_4517_2992_s_4_2.jpg"`). - name: items | type: array | description: Media (images, videos etc) associated with this product. - name: numberOfProducts | type: integer | description: Number of products in the collection. Read only. - name: description | type: string | description: Collection description. - name: slug | type: string | description: Collection slug. - name: visible | type: boolean | description: Collection visibility. Only impacts dynamic pages, no impact on static pages. Default: `true`. ``` ### Examples ### Get collection by slug ```javascript import { collections } from "@wix/stores"; const slug = "coffee-products"; async function getCollectionBySlug() { const response = await collections.getCollectionBySlug(slug); } /* Promise resolves to: * { * "_id": "32fd0b3a-2d38-2235-7754-78a3f819274a", * "name": "Coffee Products", * "slug": "coffee-products", * "visible": true, * "description": "Some Coffee Products", * "media": { * "mainMedia": { * "thumbnail": { * "url": "https://static.wixstatic.com/media/...", * "width": 50, * "height": 50 * }, * "mediaType": "image", * "image": { * "url": "https://static.wixstatic.com/media/...", * "width": 6630, * "height": 5304 * } * }, * "items": [...] * }, * "numberOfProducts": 5 * } */ ``` ### getCollectionBySlug (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 { products } from '@wix/stores'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { products }, // Include the auth strategy and host as relevant }); async function getCollectionBySlug(slug) { const response = await myWixClient.products.getCollectionBySlug(slug); }; ``` ---