announcement Endpoint
This article describes two API calls related to announcements:
- returning all announcements
- returning all announcements that are attached to an element and are available to the user who executes the API call.
Retrieve All Announcements
API Call
$.ajax({
url: '/api/announcement?all=Y',
type: 'GET',
dataType: 'json',
success: function(data){console.log(data)},
});
{
announcements: [
{
allow_to_dismiss: "Y",
border_color: "#cc0000",
enabled: "Y",
end_time: "2019-03-13 14:04:27",
html_code: '<p style="text-align:center;"><strong>Schedule maintenance on Friday evening at 10pm</strong></p>',
id: "3",
requires_approval: "N",
show_on_homepage: "Y",
show_on_viewer: "N",
show_on_viewer_scope: "all",
start_time: "2019-03-12 14:04:27",
subject: "Manufacturing Announcement",
time_window: "N",
visible_to: "groups"
},
{
allow_to_dismiss: "Y",
border_color: "#0000ff",
enabled: "Y",
end_time: "2021-01-17 00:41:19",
html_code: '<p>Winter Carnival</p>',
id: "10",
requires_approval: "N",
show_on_homepage: "Y",
show_on_viewer: "Y",
show_on_viewer_scope: "all",
start_time: "2021-01-16 00:41:19",
subject: "Winter Carnival",
time_window: "N",
visible_to: "all"
}
]
}
Retrieve Element's Announcements
API Call
This API call returns all element's announcements that are visible for the user who executed the request and information about how the user can interact with these announcements.
The value of the element
parameter corresponds to the ID of the element, whose announcements are retrieved.
$.ajax({
type: 'GET',
url: '/content/index/announcements?element=146923',
dataType: 'JSON',
success: function (response) {
console.log(response)
}
});
{
announcements: [
{
allow_edit_ind: "Y",
allow_to_dismiss_ind: "Y",
announcement_id: "14",
announcement_suppressed_element_id: null,
border_color: "#43a01b",
created_by_user_id: "119",
created_time: "2019-03-13 14:04:27",
enabled_ind: "Y",
html_code: '<p style="text-align:center;"><strong>Test message</strong></p>',
requires_approval_ind: "N",
show_on_homepage_ind: "N",
show_on_viewer_ind: "Y",
show_on_viewer_scope: "all",
start_time: "2019-03-12 14:04:27",
subject: "Manufacturing Announcement",
time_window_ind: "N",
updated_time: "2023-06-01 11:47:01",
visible_to: "groups"
}
]
}