subscribe_alert_preferences

UsersApi.subscribe_alert_preferences(role_id=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Subscribe to email alerts

Subscribes the calling user to email alerts. No request body. SMTP available: EmailSubscription is set to yes immediately. Otherwise SES sends a verification email and status is pending. Success Message is the confirmation-email text. If already subscribed, Message states the user is already subscribed. Pending re-subscribe within 5 minutes returns GE-1034 (HTTP 500). Service users return GE-1014.

Parameters:
  • role_id (str) – Amorphic role ID the request is authorized against. Must be a role the user belongs to. Also recorded in audit logs.

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

SubscribeAlertPreferencesResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: POST /alertpreferences

Success (HTTP 200)

New or pending subscribe returns {Message} with the confirmation-email text. Already subscribed returns {Message} stating the user is already subscribed.

Verification / confirmation path

{
  "Message": "Confirmation email sent to user1@example.com, please click the link in email to complete the subscription."
}

Already subscribed

{
  "Message": "User user1 is already subscribed to email alerts."
}

Errors

Documented error codes: GE-1014, GE-1020, GE-1034, GE-1090, GE-1108, GE-1008.

HTTP 400

Validation failure. Body is {“Message”: “<CODE> - <text>”}. Common codes: GE-1014 (service user), GE-1020 (USER table update failed).

Service user not supported

{
  "Message": "GE-1014 - Email subscription is not supported for service users"
}

Failed to persist subscription

{
  "Message": "GE-1020 - Unable to update USER table, please retry or contact administrator"
}

HTTP 500

Backend / SES failure. Body is {“Message”: “<CODE> - <text>”}. Common codes: GE-1034 (resend within 5 minutes), GE-1090 (verification email failed), GE-1108 (failed to tag SES identity), GE-1008 (unexpected).

Pending resend within 5 minutes

{
  "Message": "GE-1034 - Email has already been sent to user1@example.com. Please wait for 3 more minute(s) for another email or complete the existing Verification."
}

SES verification send failed

{
  "Message": "GE-1090 - Unable to send verification link to user user1 for email subscription"
}

Unexpected failure

{
  "Message": "GE-1008 - Could not complete the request. Please try again"
}