Quick Start
Get started with the Mybe CMS SDK in 5 minutes
1. Initialize the SDK
import { MybeSDK } from '@mybe/sdk';
// Initialize the SDK
const sdk = new MybeSDK({
apiKey: 'your-api-key'
});2. Fetch a Single Content Entry
// Fetch a single content entry
const content = await sdk.getContent('content-id');
console.log(content.data);
console.log(content.status); // 'draft' | 'published' 3. Fetch Content by Type
// Fetch content by type with filters
const result = await sdk.getContentByType('blog-post-type-id', {
status: 'published',
limit: 10
});
console.log(result.data); // Array of content entries
console.log(result.pagination); // Pagination info4. Handle Errors
import { NotFoundError, UnauthorizedError } from '@mybe/sdk';
try {
const content = await sdk.getContent('content-id');
} catch (error) {
if (error instanceof NotFoundError) {
console.error('Content not found');
} else if (error instanceof UnauthorizedError) {
console.error('Invalid API key');
}
}Next Steps
- • Read the Configuration guide
- • Explore the API Reference
- • Check out Examples