webiny-sdk
यह क्या करती है
दिखाती है कि बाहरी ऐप को Webiny के headless content सिस्टम से कैसे जोड़ें, ताकि कंटेंट लाया, बनाया, अपडेट और प्रकाशित किया जा सके। यह उन डेवलपर्स के लिए है जो Webiny से कंटेंट लेने वाली वेबसाइटें या ऐप बना रहे हैं।
कब इस्तेमाल करें
- ✓जब कोई डेवलपर Next.js, Vue या Node.js ऐप बना रहा हो जिसे Webiny से कंटेंट चाहिए।
- ✓जब कोई डेवलपर कोड से Webiny कंटेंट एंट्री प्रकाशित या अप्रकाशित करना चाहे।
- ✓जब किसी डेवलपर को बाहरी ऐप में Webiny कंटेंट फ़िल्टर, छाँटना या पेज करना हो।
Skill का लिंक
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/webiny-sdk/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरी ब्लॉग पोस्ट Webiny से अपनी Next.js साइट पर कैसे लाऊँ?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
स्किल दिखाती है कि एक टोकन और एंडपॉइंट के साथ SDK कैसे सेट करें, फिर एंट्री सूचीबद्ध करने, लाने, बनाने, अपडेट करने या प्रकाशित करने के methods कॉल करें। हर कॉल एक नतीजा लौटाती है, जिसे कोड जाँचता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Webiny SDK
TL;DR
The @webiny/sdk package provides a TypeScript interface for external apps (Next.js, Vue, Node.js) to interact with Webiny's Headless CMS and File Manager. Every method returns a Result object (checked with isOk()). Supports listing, getting, creating, updating, publishing, and unpublishing entries with filtering, sorting, pagination, and TypeScript generics for type safety.
Installation & Setup
npm install @webiny/sdk
Initialize once and reuse:
// lib/webiny.ts
import { Webiny } from "@webiny/sdk";
export const webiny = new Webiny({
token: process.env.WEBINY_API_TOKEN!,
endpoint: process.env.WEBINY_API_ENDPOINT!,
tenant: process.env.WEBINY_API_TENANT || "root"
});
token-- API key token generated in Webiny Admin (Settings > API Keys)endpoint-- The base API URL, without a trailing slash. Runyarn webiny infoin your Webiny project to find the API URL. For Website Builder projects useNEXT_PUBLIC_WEBSITE_BUILDER_API_HOST.tenant-- Tenant ID, defaults to"root"
IMPORTANT: Never add a trailing slash to
endpoint. The SDK appends/graphqlto the endpoint internally, sohttps://xxx.cloudfront.net/will break all requests.
The fields Parameter (Required)
Every SDK method requires a fields array that specifies which fields to return. Omitting it will cause a runtime error.
- Use
"values.<fieldId>"for content fields:"values.name","values.price" - Use top-level field names for metadata:
"id","entryId","createdOn","status" - Use dot notation for nested fields:
"values.author.name"
// Minimal fields -- just IDs
fields: ["id", "entryId"];
// Content fields
fields: ["id", "entryId", "values.name", "values.price", "values.description"];
// Nested reference fields
fields: ["id", "values.title", "values.author.name", "values.author.email"];
CMS: Read vs Preview Mode
webiny.cms.listEntries and webiny.cms.getEntry accept a preview parameter to control which revisions are returned:
preview |
Returns | Use For |
|---|---|---|
false (default) |
Published entries only | Public-facing apps, SSG |
true |
Latest revision (draft or published) | Content preview, editorial tools |
Write operations (createEntry, updateEntryRevision, etc.) are not affected by preview.
The Result Pattern
Every SDK method returns a Result object -- it never throws:
const result = await webiny.cms.listEntries({
modelId: "product",
fields: ["id", "values.name"]
});
if (result.isOk()) {
console.log(result.value.data); // success -- typed data
} else {
console.error(result.error.message); // failure -- error info
}
TypeScript Generics
Pass a type parameter for full type safety on values:
import type { CmsEntryData } from "@webiny/sdk";
interface Product {
name: string;
price: number;
sku: string;
description: string;
category?: CmsEntryData<ProductCategory>;
}
interface ProductCategory {
name: string;
slug: string;
}
const result = await webiny.cms.listEntries<Product>({
modelId: "product",
fields: ["id", "entryId", "values.name", "values.price", "values.sku"]
});
if (result.isOk()) {
// result.value.data is CmsEntryData<Product>[]
const products = result.value.data;
// products[0].values.name -- fully typed
}
Reference fields like category are typed as CmsEntryData<T>, which wraps referenced entries with id, entryId, and values.
Reading Data
List Entries
const result = await webiny.cms.listEntries<Product>({
modelId: "product",
fields: ["id", "entryId", "values.name", "values.price"],
sort: { "values.name": "asc" },
limit: 10
});
List with Filters
const result = await webiny.cms.listEntries<Product>({
modelId: "product",
fields: ["id", "entryId", "values.name", "values.price"],
where: {
"values.price_gte": 100,
"values.name_contains": "Pro"
},
sort: { "values.price": "desc" }
});
Filter Operators
| Operator | Description | Example |
|---|---|---|
_eq |
Equals (default) | `"values.status |
अक्सर पूछे जाने वाले सवाल
API टोकन और एंडपॉइंट कहाँ मिलेंगे?
टोकन Webiny एडमिन में API keys के तहत बनता है। स्किल कहती है कि एंडपॉइंट अपने प्रोजेक्ट में info कमांड चलाकर पाएँ।
हर कॉल में fields की सूची क्यों चाहिए?
हर SDK method को fields की सूची चाहिए जो बताती है कि क्या लौटाना है। स्किल चेतावनी देती है कि इसे छोड़ने से कोड चलने पर त्रुटि आती है।
क्या एंडपॉइंट के अंत में स्लैश होना चाहिए?
नहीं। स्किल चेतावनी देती है कि अंत का स्लैश हर अनुरोध तोड़ देता है।
जानकारी
लेखक का मूल विवरण
Using @webiny/sdk to read and write CMS data from external applications. Use this skill when the developer is building a Next.js, Vue, Node.js, or any external app that needs to fetch or write content to Webiny, set up the SDK, use the Result pattern, list/get/create/update/publish entries, filter and sort queries, use TypeScript generics for type safety, work with the File Manager, list languages, trigger or monitor background tasks, or create API keys programmatically. Covers read vs preview mode, the `values` wrapper requirement, correct method names, and the `fields` required parameter, an
repo: webiny/webiny-js
लोकप्रियता
- GitHub स्टार
- 8.1k
- रैंकिंग में स्थान
- #12617
- लाइसेंस
- —
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
prd-to-plan
8.1kयह आपके एजेंट को प्रोडक्ट आवश्यकताओं के दस्तावेज़ को छोटे, एंड-टू-एंड स्लाइस की चरणबद्ध योजना में बदलने में मदद करती है, जो Markdown फ़ाइल में सहेजी जाती है।
webiny-admin-architect
8.1kयह आपके एजेंट को Webiny प्लेटफ़ॉर्म के लिए एडमिन स्क्रीन बनाना सिखाती है, उसकी बिज़नेस लॉजिक परतों और presenter पैटर्न का उपयोग करके।
webiny-admin-permissions
8.1kयह आपके एजेंट को Webiny एडमिन स्क्रीन में अनुमति नियंत्रण जोड़ना सिखाती है, जिसमें अपने-आप बनने वाले अनुमति फ़ॉर्म और दिखाने-छिपाने की जाँच शामिल हैं।
webiny-form-model
8.1kयह आपके एजेंट को Webiny में declarative field builder, layouts, validation और शर्त वाले नियमों से फ़ॉर्म बनाना सिखाती है।
मिलती-जुलती skills
api-connector-builder
280kयह आपके एजेंट को मौजूदा pattern के हिसाब से नए API connections बनाने देता है। जब बिना कोई नया तरीका बनाए एक और integration जोड़ना हो, तब इसका इस्तेमाल करें।
api-design
280kयह आपके एजेंट को best practices के हिसाब से REST APIs डिज़ाइन करने में मदद करता है। यह तय करने में काम आता है कि APIs आपस में कैसे बात करें, errors कैसे दिखें, और data को कैसे व्यवस्थित करें।
backend-patterns
280kआपके एजेंट को server-side architecture patterns और database optimization में मदद करता है। server पर चलने वाला code बनाने या review करने के लिए उपयोगी है।