Implementation:Langgenius Dify FetchMarketplaceCollections
| Knowledge Sources | |
|---|---|
| Domains | Plugin Management Marketplace Extension Discovery |
| Last Updated | 2026-02-08 00:00 GMT |
Overview
Concrete tool for browsing and inspecting plugins in the Dify marketplace provided by the Dify plugin service layer.
Description
This module exposes four API functions that power the plugin discovery workflow. fetchMarketplaceCollections retrieves the top-level groupings of plugins (e.g., "Featured", "Productivity"). fetchMarketplaceCollectionPlugins fetches the individual plugin entries within a given collection. fetchManifest retrieves a full plugin declaration from the workspace backend using a unique identifier, while fetchManifestFromMarketPlace retrieves the same data from the marketplace origin. Together, these functions enable collection browsing, plugin listing, and manifest inspection across both distribution channels.
Usage
Use these functions when:
- Rendering the marketplace browsing page to display available collections and their plugins.
- Building a plugin detail panel that shows the full manifest (name, version, description, category, icon).
- Implementing search results that link to manifest inspection.
- Pre-fetching plugin metadata before presenting an install confirmation dialog.
Code Reference
Source Location
- Repository: Dify
- File:
web/service/plugins.ts(lines 61-90)
Signature
// Retrieve all marketplace collections
export const fetchMarketplaceCollections = (
{ url }: { url: string }
): Promise<MarketplaceCollectionsResponse>
// Retrieve plugins within a specific collection
export const fetchMarketplaceCollectionPlugins = (
{ url }: { url: string }
): Promise<MarketplaceCollectionPluginsResponse>
// Fetch manifest from the workspace backend
export const fetchManifest = async (
uniqueIdentifier: string
): Promise<PluginDeclaration>
// Fetch manifest from the marketplace origin
export const fetchManifestFromMarketPlace = async (
uniqueIdentifier: string
): Promise<{ data: { plugin: PluginManifestInMarket, version: { version: string } } }>
Import
import {
fetchMarketplaceCollections,
fetchMarketplaceCollectionPlugins,
fetchManifest,
fetchManifestFromMarketPlace,
} from '@/service/plugins'
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| url | string | Yes | API endpoint path for the collection or collection-plugins request |
| uniqueIdentifier | string | Yes (for manifest) | Canonical plugin identifier encoding author, name, and version |
Outputs
| Name | Type | Description |
|---|---|---|
| MarketplaceCollectionsResponse.collections | MarketplaceCollection[] | Array of collection objects with name, label, description, rule, created_at, updated_at, and optional search_params |
| MarketplaceCollectionsResponse.total | number | Total number of collections |
| MarketplaceCollectionPluginsResponse.plugins | Plugin[] | Array of plugin objects with name, version, icon, label, description, category, and author |
| MarketplaceCollectionPluginsResponse.total | number | Total number of plugins in the collection |
| PluginDeclaration | object | Full manifest including plugin_unique_identifier, version, author, icon, name, category, label, description, created_at |
| PluginManifestInMarket | object | Marketplace-specific manifest with additional marketplace metadata and version info |
Dependencies
| Dependency | Purpose |
|---|---|
@/service/base (get) |
HTTP GET requests to the workspace backend |
@/service/base (getMarketplace) |
HTTP GET requests to the marketplace origin |
@tanstack/react-query |
Used by consuming components for caching and query management |
Usage Examples
import {
fetchMarketplaceCollections,
fetchMarketplaceCollectionPlugins,
fetchManifest,
} from '@/service/plugins'
// 1. Load all collections from the marketplace
const collectionsResponse = await fetchMarketplaceCollections({
url: '/workspaces/current/marketplace/collections',
})
console.log(collectionsResponse.collections) // [{ name, label, description, ... }]
// 2. Load plugins within the first collection
const firstCollection = collectionsResponse.collections[0]
const pluginsResponse = await fetchMarketplaceCollectionPlugins({
url: `/workspaces/current/marketplace/collections/${firstCollection.name}/plugins`,
})
console.log(pluginsResponse.plugins) // [{ name, version, icon, label, description, category }]
// 3. Inspect the manifest for a specific plugin
const plugin = pluginsResponse.plugins[0]
const manifest = await fetchManifest(plugin.plugin_unique_identifier)
console.log(manifest.name, manifest.version, manifest.category)