/admin/web_pages
Path: /admin/web_pages
Namespace: admin
Resource: web_pages
Overview
The WebPage (Page) resource represents web pages and content for public-facing sites. Web pages support markdown/content management, file uploads, permalinks, and visibility settings.
Powerful Feature: Web pages can completely redesign ActiveAdmin UI without code changes. Create custom HTML/CSS/JavaScript pages that use ActiveAdmin's JSON API to build custom interfaces.
Relationships
WebPage connects to:
- Domain (
host_id) - Tenant domain
Key Features
- Content Management: Manage page content (body, markdown)
- Permalink Management: Define URL paths for pages
- File Support: Upload and manage files (PDFs, images, etc.)
- Visibility Control: Control page visibility (public, user, admin, invisible)
- Domain Scoping: Pages can be scoped to domains
- Publishing: Published at date/time for scheduled publishing
- Redirects: Support for redirects to other URLs
- ActiveAdmin Redesign: Create custom admin interfaces without code changes
ActiveAdmin Redesign
Web pages enable complete ActiveAdmin UI redesign without code changes:
- Custom Dashboards: Create custom admin dashboards with charts and visualizations
- Enhanced Views: Build custom detail views with enhanced UI
- Full UI Replacement: Replace ActiveAdmin entirely with custom interface
- Hybrid Approach: Mix custom pages with ActiveAdmin for optimal UX
How It Works:
- Create HTML pages with JavaScript
- Fetch data from ActiveAdmin JSON APIs (
/admin/*.json) - Render custom interfaces with full control over UI/UX
- All managed through the browser - no code changes needed
Available Operations
List Web Pages (GET)
Endpoint: GET /admin/web_pages.json
Query Parameters:
q[field_predicate]=value- Ransack query filters for advanced filteringscope=name- Apply named scope (e.g.,public_visible,user_visible,admin_visible)page=N- Page number for paginationper_page=N- Items per page (default: 25)
Request Examples:
curl -X GET "https://your-company.erpax.com/admin/web_pages.json" \
-H "Accept: application/json" \
-H "Cookie: session_cookie"curl -X GET "https://your-company.erpax.com/admin/web_pages.json?scope=public_visible" \
-H "Accept: application/json"JavaScript Example:
const response = await fetch('/admin/web_pages.json', {
credentials: 'include',
headers: { 'Accept': 'application/json' }
});
const data = await response.json();Response (200 OK):
{
"web_pages": [
{
"id": 1,
"permalink": "/about",
"body": "# About Us\n\nContent here...",
"visibility": "public",
"published_at": "2024-01-15T10:00:00Z",
"created_at": "2024-01-10T10:00:00Z"
}
],
"meta": {
"current_page": 1,
"per_page": 25,
"total_pages": 1,
"total_count": 5
}
}Show Web Page (GET /:id)
Endpoint: GET /admin/web_pages/:id.json
Request Example:
curl -X GET "https://your-company.erpax.com/admin/web_pages/1.json" \
-H "Accept: application/json" \
-H "Cookie: session_cookie"Response (200 OK):
{
"web_page": {
"id": 1,
"permalink": "/about",
"body": "# About Us\n\nContent here...",
"visibility": "public",
"published_at": "2024-01-15T10:00:00Z",
"content_type": "text/html",
"file_size": 1024,
"created_at": "2024-01-10T10:00:00Z",
"updated_at": "2024-01-15T12:00:00Z"
}
}Create Web Page (POST)
Endpoint: POST /admin/web_pages.json
Request Example:
curl -X POST "https://your-company.erpax.com/admin/web_pages.json" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Cookie: session_cookie" \
-d '{
"web_page": {
"permalink": "/contact",
"body": "# Contact Us\n\nGet in touch...",
"visibility": "public",
"published_at": "2024-01-15T10:00:00Z"
}
}'JavaScript Example:
const response = await fetch('/admin/web_pages.json', {
method: 'POST',
credentials: 'include',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
web_page: {
permalink: '/contact',
body: '# Contact Us\n\nGet in touch...',
visibility: 'public',
published_at: '2024-01-15T10:00:00Z'
}
})
});
const webPage = await response.json();Response (201 Created):
{
"web_page": {
"id": 2,
"permalink": "/contact",
"body": "# Contact Us\n\nGet in touch...",
"visibility": "public",
"created_at": "2024-01-15T14:30:00Z"
}
}Update Web Page (PATCH /:id)
Endpoint: PATCH /admin/web_pages/:id.json
Request Example:
curl -X PATCH "https://your-company.erpax.com/admin/web_pages/1.json" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Cookie: session_cookie" \
-d '{
"web_page": {
"body": "# Updated About Us\n\nNew content..."
}
}'JavaScript Example:
const response = await fetch('/admin/web_pages/1.json', {
method: 'PATCH',
credentials: 'include',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
web_page: {
body: '# Updated About Us\n\nNew content...'
}
})
});
const data = await response.json();Response (200 OK):
{
"web_page": {
"id": 1,
"body": "# Updated About Us\n\nNew content...",
"updated_at": "2024-01-15T15:00:00Z"
}
}Delete Web Page (DELETE /:id)
Endpoint: DELETE /admin/web_pages/:id.json
Request Example:
curl -X DELETE "https://your-company.erpax.com/admin/web_pages/1.json" \
-H "Accept: application/json" \
-H "Cookie: session_cookie"Response (204 No Content):
(empty response)Batch Actions
Endpoint: POST /admin/web_pages/batch_action.json
Available batch actions:
- update - Update selected pages with form fields (domain, old_location, new_location)
Request Example:
curl -X POST "https://your-company.erpax.com/admin/web_pages/batch_action.json" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Cookie: session_cookie" \
-d '{
"batch_action": "update",
"collection_selection": [1, 2, 3],
"web_page": {
"domain": "newdomain.com"
}
}'Member Actions
Custom actions available on individual web pages via API:
Extract Content
Endpoint: POST /admin/web_pages/:id/extract
Description: Extract content from a URL and populate the web page.
Request Example:
curl -X POST "https://your-company.erpax.com/admin/web_pages/123/extract" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Cookie: session_cookie" \
-d '{
"url": "https://example.com/page"
}'Response (200 OK):
{
"web_page": {
"id": 123,
"body": "Extracted content from URL...",
"updated_at": "2024-01-15T15:00:00Z"
}
}Scopes
- all (default) - All pages
- public_visible - Publicly visible pages
- user_visible - User-visible pages
- admin_visible - Admin-visible pages
- invisible - Invisible/hidden pages
- current_domain - Pages for current domain
- other_domains - Pages for other domains
Usage Example:
GET /admin/web_pages.json?scope=public_visible
GET /admin/web_pages.json?scope=admin_visibleFilters
Available filters for searching and filtering web pages:
- domain - Select filter (multiple) - Filter by domain
- page_contains - Text filter - Search page content
- permalink - Text filter - Filter by permalink/URL
- body - Text filter - Search body content
- visibility - Select filter - Filter by visibility level
- published_at - Date filter - Filter by publication date
- updated_at - Date filter - Filter by update date
- created_at - Date filter - Filter by creation date
- content_sha256 - Text filter - Filter by content hash
- content_type - Text filter - Filter by content type
- file_size - Numeric filter - Filter by file size
- original_filename - Text filter - Filter by filename
- redirect - Text filter - Filter by redirect URL
- file - File filter - Filter by file
Filtering Examples:
# Filter by visibility
GET /admin/web_pages.json?q[visibility_eq]=public
# Search by permalink
GET /admin/web_pages.json?q[permalink_cont]=about
# Filter by domain
GET /admin/web_pages.json?q[domain_id_eq]=1Business Rules
- Permalink Uniqueness: Permalinks should be unique within a domain
- Visibility Control: Pages can have different visibility levels (public, user, admin, invisible)
- Domain Scoping: Pages can be scoped to specific domains
- Publishing: Pages can be scheduled for publication using published_at
Related Resources
- Domains - Domains for page scoping