curl -X POST "https://api.example.com/api/v2/admin/announcements" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"title": "New Feature Release",
"summary": "We have released exciting new features!",
"content": "Check out our new dashboard improvements and enhanced reporting capabilities.",
"type": "success",
"priority": 0,
"status": "published",
"is_push_enabled": true,
"is_public": false,
"topic": "FEATURES",
"push_title": "New Features Available!",
"push_body": "Discover the latest improvements to your dashboard",
"target_type": "all"
}'
const response = await fetch('/api/v2/admin/announcements', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'X-Tenant-ID': 'your-tenant-id',
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'New Feature Release',
summary: 'We have released exciting new features!',
content: 'Check out our new dashboard improvements and enhanced reporting capabilities.',
type: 'success',
priority: 0,
status: 'published',
is_push_enabled: true,
is_public: false,
topic: 'FEATURES',
push_title: 'New Features Available!',
push_body: 'Discover the latest improvements to your dashboard',
target_type: 'all'
})
});
const data = await response.json();
{
"success": true,
"message": "Announcement created successfully",
"data": {
"id": 2,
"tenant_id": "tenant-123",
"title": "New Feature Release",
"summary": "We have released exciting new features!",
"content": "Check out our new dashboard improvements and enhanced reporting capabilities.",
"type": "success",
"priority": 0,
"status": "published",
"is_push_enabled": true,
"is_public": false,
"scheduled_at": null,
"expires_at": null,
"topic": "FEATURES",
"push_title": "New Features Available!",
"push_body": "Discover the latest improvements to your dashboard",
"push_data": null,
"target_type": "all",
"target_value": null,
"push_status": "pending",
"push_error": null,
"sent_at": null,
"attachment_type": null,
"attachment_url": null,
"attachment_metadata": null,
"created_by": 1,
"creator": {
"id": 1,
"name": "Admin User",
"email": "admin@example.com"
},
"created_at": "2024-12-11T14:30:00Z",
"updated_at": "2024-12-11T14:30:00Z"
}
}
{
"success": false,
"errors": {
"title": ["The title field is required."],
"type": ["The selected type is invalid."]
}
}
Announcements
Create Announcement
Create a new announcement for the current tenant
POST
/
api
/
v2
/
admin
/
announcements
curl -X POST "https://api.example.com/api/v2/admin/announcements" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"title": "New Feature Release",
"summary": "We have released exciting new features!",
"content": "Check out our new dashboard improvements and enhanced reporting capabilities.",
"type": "success",
"priority": 0,
"status": "published",
"is_push_enabled": true,
"is_public": false,
"topic": "FEATURES",
"push_title": "New Features Available!",
"push_body": "Discover the latest improvements to your dashboard",
"target_type": "all"
}'
const response = await fetch('/api/v2/admin/announcements', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'X-Tenant-ID': 'your-tenant-id',
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'New Feature Release',
summary: 'We have released exciting new features!',
content: 'Check out our new dashboard improvements and enhanced reporting capabilities.',
type: 'success',
priority: 0,
status: 'published',
is_push_enabled: true,
is_public: false,
topic: 'FEATURES',
push_title: 'New Features Available!',
push_body: 'Discover the latest improvements to your dashboard',
target_type: 'all'
})
});
const data = await response.json();
{
"success": true,
"message": "Announcement created successfully",
"data": {
"id": 2,
"tenant_id": "tenant-123",
"title": "New Feature Release",
"summary": "We have released exciting new features!",
"content": "Check out our new dashboard improvements and enhanced reporting capabilities.",
"type": "success",
"priority": 0,
"status": "published",
"is_push_enabled": true,
"is_public": false,
"scheduled_at": null,
"expires_at": null,
"topic": "FEATURES",
"push_title": "New Features Available!",
"push_body": "Discover the latest improvements to your dashboard",
"push_data": null,
"target_type": "all",
"target_value": null,
"push_status": "pending",
"push_error": null,
"sent_at": null,
"attachment_type": null,
"attachment_url": null,
"attachment_metadata": null,
"created_by": 1,
"creator": {
"id": 1,
"name": "Admin User",
"email": "admin@example.com"
},
"created_at": "2024-12-11T14:30:00Z",
"updated_at": "2024-12-11T14:30:00Z"
}
}
{
"success": false,
"errors": {
"title": ["The title field is required."],
"type": ["The selected type is invalid."]
}
}
Headers
Body Parameters
Push Notification Parameters
Target value based on target_type:
- For
topic: topic name - For
users: comma-separated user IDs - For
all: leave empty
Attachment Parameters
Response
curl -X POST "https://api.example.com/api/v2/admin/announcements" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "X-Tenant-ID: your-tenant-id" \
-H "Content-Type: application/json" \
-d '{
"title": "New Feature Release",
"summary": "We have released exciting new features!",
"content": "Check out our new dashboard improvements and enhanced reporting capabilities.",
"type": "success",
"priority": 0,
"status": "published",
"is_push_enabled": true,
"is_public": false,
"topic": "FEATURES",
"push_title": "New Features Available!",
"push_body": "Discover the latest improvements to your dashboard",
"target_type": "all"
}'
const response = await fetch('/api/v2/admin/announcements', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'X-Tenant-ID': 'your-tenant-id',
'Content-Type': 'application/json'
},
body: JSON.stringify({
title: 'New Feature Release',
summary: 'We have released exciting new features!',
content: 'Check out our new dashboard improvements and enhanced reporting capabilities.',
type: 'success',
priority: 0,
status: 'published',
is_push_enabled: true,
is_public: false,
topic: 'FEATURES',
push_title: 'New Features Available!',
push_body: 'Discover the latest improvements to your dashboard',
target_type: 'all'
})
});
const data = await response.json();
{
"success": true,
"message": "Announcement created successfully",
"data": {
"id": 2,
"tenant_id": "tenant-123",
"title": "New Feature Release",
"summary": "We have released exciting new features!",
"content": "Check out our new dashboard improvements and enhanced reporting capabilities.",
"type": "success",
"priority": 0,
"status": "published",
"is_push_enabled": true,
"is_public": false,
"scheduled_at": null,
"expires_at": null,
"topic": "FEATURES",
"push_title": "New Features Available!",
"push_body": "Discover the latest improvements to your dashboard",
"push_data": null,
"target_type": "all",
"target_value": null,
"push_status": "pending",
"push_error": null,
"sent_at": null,
"attachment_type": null,
"attachment_url": null,
"attachment_metadata": null,
"created_by": 1,
"creator": {
"id": 1,
"name": "Admin User",
"email": "admin@example.com"
},
"created_at": "2024-12-11T14:30:00Z",
"updated_at": "2024-12-11T14:30:00Z"
}
}
{
"success": false,
"errors": {
"title": ["The title field is required."],
"type": ["The selected type is invalid."]
}
}