announcement Endpoint

This article describes two API calls related to announcements:  

Retrieve All Announcements

API Call

$.ajax({
   url: '/api/announcement?all=Y',
   type: 'GET',
   dataType: 'json',
   success: function(data){console.log(data)},
});
Example Response
{
    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"
       }
    ]
}

Fields Description

Field Name Value Type Description
allow_to_dismiss string Whether or not the users who see the announcement are able to remove it from the homepage or element viewer.
border_color string The hex value of the announcement's border color.
enabled string Whether or not the announcement is enabled.
end_time string The time until which the announcement is displayed.
html_code string The HTML code of the announcement message.
id string The ID of the announcement.
requires_approval string Whether or not the users who see the announcement will see the “Accept” button instead of “Dismiss”.
show_on_homepage string Whether or not the announcement is displayed on the homepage.
show_on_viewer string Whether or not the announcement is displayed on viewer.
show_on_viewer_scope string Whether the announcement is displayed on all elements' viewers (all) or only on selected elements' viewers (selected).
start_time string The time from which the announcement is displayed.
subject string The announcement's name.
time_window string The time interval in which the announcement is active
visible string Whether the announcement is visible for everyone (all) or for defined user groups (groups).

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)
   }
});
Example 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"
      }
   ]
}

Fields Description

Field Name Value Type Description
allow_edit_ind string Whether or not the user who ran the request can edit the announcement.
allow_to_dismiss_ind string Whether or not the users who ran the request can dismiss the announcement.
announcement_id string The ID of the announcement.
border_color string The hex value of the announcement's border color.
created_by_user_id string The ID of the user who created the announcement.
created_time string The time when the announcement has been created.
enabled string Whether or not the announcement is enabled.
end_time string The time until which the announcement is displayed.
html_code string The HTML code of the announcement message.
requires_approval_ind string Whether or not the users who see the announcement will see the “Accept” button instead of “Dismiss”.
show_on_homepage_ind string Whether or not the announcement is displayed on the homepage.
show_on_viewer_ind string Whether or not the announcement is displayed on the element's viewer.
show_on_viewer_scope string Whether the announcement is displayed on all elements' viewers (all) or only on selected elements' viewers (selected).
start_time string The time from which the announcement is displayed.
subject string The announcement's name.
time_window_ind string Whether or not a specific time window has been set for the announcement.
updated_time string The time of the last update of the announcement.
visible_to string Whether the announcement is visible for everyone (all) or for defined user groups (groups).