Pages

Create and manage pages programmatically

Pages

Pages are the fundamental content type in WebinOne. Create, update, and manage pages programmatically through the API.

Pages Module

Pages are module items with ModuleId: 1522. They support hierarchical structures through parent-child relationships.

Create a Page

POST /api/v2/admin/module-items
Content-Type: application/x-www-form-urlencoded

ModuleId=1522&Name=About%20Us&UrlSlug=about-us&Description=%3Cp%3EContent%3C%2Fp%3E&Enabled=true&ReleaseDate=2026-07-07T00:00:00&ExpiryDate=2099-12-31T00:00:00&TemplateId=0&LayoutId=3156

List Pages

GET /api/v2/admin/module-items/1522/list?Where=%7B%22%24and%22%3A%5B%7B%22%24eq%22%3A%7B%22Enabled%22%3Atrue%7D%7D%5D%7D&OrderBy=Name%20ASC&Limit=50

Update a Page

Critical: PUT overwrites all fields. Always GET first, merge changes, then PUT:

// 1. Get current page
GET /api/v2/admin/module-items/{id}

// 2. Merge changes
const updated = { ...current, Description: 'New content' };

// 3. PUT complete object
PUT /api/v2/admin/module-items/{id}
Content-Type: application/x-www-form-urlencoded

Required Fields

  • ModuleId: 1522 (Pages module)
  • Name: Page title
  • UrlSlug: URL-safe identifier
  • Enabled: true/false visibility
  • ReleaseDate: Publication date (format: YYYY-MM-DDTHH:mm:ss)
  • ExpiryDate: Expiration date (use 2099-12-31T00:00:00 for no expiry)

Hierarchical Pages

Create parent-child relationships using ParentId:

// Parent page
POST /api/v2/admin/module-items
{ ModuleId: 1522, Name: 'Services', UrlSlug: 'services', ... }
// Returns: { Id: 100, ... }

// Child page
POST /api/v2/admin/module-items
{ ModuleId: 1522, Name: 'Web Design', UrlSlug: 'web-design', ParentId: 100, ... }
// URL will be: /services/web-design

SEO Metadata

Update SEO fields through a separate endpoint:

PUT /api/v2/admin/module-items/{id}/seo

{
  "SEOTitle": "About Us - Company Name",
  "MetaDescription": "Learn about our company...",
  "CanonicalLink": "https://example.com/about-us",
  "ShowPageForSearchEngine": true
}

Code Examples

// JavaScript: Complete Page Management
class PageManager {
  constructor(token, baseUrl) {
    this.token = token;
    this.baseUrl = baseUrl;
    this.moduleId = 1522;
  }
  
  async create(data) {
    const formData = new URLSearchParams();
    formData.append('ModuleId', this.moduleId);
    formData.append('Name', data.name);
    formData.append('UrlSlug', data.slug);
    formData.append('Description', data.content || '');
    formData.append('Enabled', data.enabled ?? true);
    formData.append('ReleaseDate', data.releaseDate || new Date().toISOString().split('T')[0] + 'T00:00:00');
    formData.append('ExpiryDate', '2099-12-31T00:00:00');
    formData.append('TemplateId', data.templateId || 0);
    formData.append('LayoutId', data.layoutId || 3156);
    
    if (data.parentId) {
      formData.append('ParentId', data.parentId);
    }
    
    const response = await fetch(`${this.baseUrl}/api/v2/admin/module-items`, {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${this.token}`,
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      body: formData.toString()
    });
    
    return await response.json();
  }
  
  async update(id, changes) {
    // GET current state
    const current = await this.get(id);
    
    // Merge changes
    const updated = { ...current, ...changes };
    
    // Remove read-only fields
    delete updated.Id;
    delete updated.CreatedDate;
    delete updated.LastUpdatedDate;
    delete updated.Url;
    delete updated.UrlList;
    
    // Convert to form data
    const formData = new URLSearchParams();
    Object.entries(updated).forEach(([key, value]) => {
      if (value !== null && value !== undefined) {
        formData.append(key, value);
      }
    });
    
    const response = await fetch(`${this.baseUrl}/api/v2/admin/module-items/${id}`, {
      method: 'PUT',
      headers: {
        'Authorization': `Bearer ${this.token}`,
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      body: formData.toString()
    });
    
    return await response.json();
  }
  
  async get(id) {
    const response = await fetch(`${this.baseUrl}/api/v2/admin/module-items/${id}`, {
      headers: { 'Authorization': `Bearer ${this.token}` }
    });
    return await response.json();
  }
  
  async list(where = null, orderBy = 'Name ASC', limit = 50) {
    const params = new URLSearchParams();
    if (where) params.append('Where', JSON.stringify(where));
    params.append('OrderBy', orderBy);
    params.append('Limit', limit);
    
    const response = await fetch(
      `${this.baseUrl}/api/v2/admin/module-items/${this.moduleId}/list?${params}`,
      { headers: { 'Authorization': `Bearer ${this.token}` } }
    );
    return await response.json();
  }
}

// Usage
const pages = new PageManager(token, 'https://your-site.webinone.com');

// Create a page
const page = await pages.create({
  name: 'About Us',
  slug: 'about-us',
  content: '

Welcome to our company

', enabled: true }); // Update the page await pages.update(page.Id, { Description: '

Updated content

' });