Core - Notification Preferences =============================== .. Last update: 01/09/2020 The base url for the APIs in this page is at:: /api/mobile/ A JSON file with OpenAPI data about all core-related mobile APIs can be downloaded :download:`here `. Get Current notification settings --------------------------------- Get a list of the notification settings of the current user (it's a :ref:`paged-list-api`, as explained in the introduction): .. openapi:: /openapi/srv-core/api-src-WebMobile.json :paths: /v1/user/notifications Returns the list of notification settings for the current user:: [ { "UserId": 0, // Int "LastUpdated": "2020-04-07T11:43:50Z", // DateTime "LastUpdatedBy": "abelcedar.1263@gmail.com", // String "NotificationType": 0, // Int "IsEMail": true, // Boolean "IsSMS": true, // Boolean "IsPush": true, // Boolean "ID": 1 // Int }, ... ] Value types of ``NotificationType`` can be one of the :ref:`enum-notificationtypes` enumeration. If there is a problem in retrieving the current user information or if the user is deleted or disabled, the request will return a 401 Unauthorized Response. Add new or edit existing notification setting --------------------------------------------- Adds a new notification setting or edits an existing one for the current user: .. openapi:: /openapi/srv-core/api-src-WebMobile.json :paths: /v1/user/notifications The body of the request is the following:: { ID: 123, // Int NotificationType: 0, // Int (Required) IsEmail: true, // Boolean IsSMS: false, // Boolean IsPush false // Boolean } It is required that at least one between the IsEmail, IsSMS and IsPush field is set to 'true Value types of ``NotificationType`` must be one of the :ref:`enum-notificationtypes` enumeration. if ``ID`` (notification preference id) is not provided or set to 0, then the request will create a new record. The request will return a plain Json positive response if the notification setting has been successfully added or modified, or a plain Json negative response if there was an error while processing the request. Possible error messages are: ``err_InvalidElement`` No values provided in the body of the request for the required fields. ``err_NoEmailTemplateFound`` The field ``IsEmail`` is set to ``true`` but no message template has been found for the specified ``NotificationType`` for CombinedEmail and SimpleTextEmail formats ``err_NoSMSTemplateFound`` The field ``IsSMS`` is set to ``true`` but no message template has been found for the specified ``NotificationType`` for the SMS format ``err_NoEmailSMSTemplateFound`` The field ``IsEmail`` and ``IsSMS`` are set to ``true`` but no message template has been found for the specified ``NotificationType`` for CombinedEmail, SimpleTextEmail and SMS formats ``err_NoPushTemplateFound`` The field ``IsPush`` is set to ``true`` but no message template has been found for the specified ``NotificationType`` for PushNotification format ``err_NoEmailPushTemplateFound`` The field ``IsEmail`` and `IsPush`` are set to ``true`` but no message template has been found for the specified ``NotificationType`` for CombinedEmail, SimpleTextEmail and PushNotification formats ``err_NoSMSPushTemplateFound`` The field ``IsSMS`` and `IsPush`` to ``true`` but no message template has been found for the specified ``NotificationType`` for SMS and PushNotification formats ``err_NoNotificationTemplateFound`` The three boolean fields are set to ``true`` but no message template has been found for the specified ``NotificationType`` for any of the formats