get_alert_preferences

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

Get email alert subscription status

Returns the calling user’s email-alert subscription status. Body is {“Message”: “<status>”} where status is yes (subscribed), no (not subscribed / default when EmailSubscription is unset), or pending (SES verification in flight). When no SMTP mail server is enabled, GET may check SES identity verification and persist yes/pending back to the user record (not purely read-only). DynamoDB update failure returns GE-1020 (HTTP 400).

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:

GetAlertPreferencesResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: GET /alertpreferences

Success (HTTP 200)

Current subscription status in Message (yes, no, or pending).

User is subscribed

{
  "Message": "yes"
}

Not subscribed (or unset, defaulted to no)

{
  "Message": "no"
}

SES verification pending

{
  "Message": "pending"
}

Errors

Documented error codes: GE-1014, GE-1020, GE-1008, EMF-1001.

HTTP 400

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

Service user not supported

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

Failed to persist SES status

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

HTTP 500

Backend failure. Body is {“Message”: “<CODE> - <text>”} (typically GE-1008 via EMF-1001). Missing user record can AttributeError into this path.

Unexpected failure

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