update_notifications¶
- UsersApi.update_notifications(update_notifications_request, role_id=None, custom_email_address=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
Update notification preferences
Saves email and push preferences for the caller. No system-settings check. custom_email_address=yes writes a custom email identity instead of the caller. UserId in the body is overwritten from the token.
- Parameters:
update_notifications_request (UpdateNotificationsRequest) – (required)
role_id (str) – Amorphic role ID the request is authorized against. Must be a role the user belongs to. Also recorded in audit logs.
custom_email_address (str) – Set to yes to subscribe a custom EmailAddress on each resource. Any other value, or omit, updates the caller.
_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:
- Returns:
Returns the result object.
Request and Response Examples¶
HTTP: PUT /notifications
Request¶
Request / response example
{
"ResourceType": "Datasets",
"Resources": [
{
"ResourceId": "dataset-a2f7d3b1-8e5c-4a6f-9d1e-2b3c4d5e6f7a",
"Email": {
"Update": true,
"Delete": false,
"AuthUpdate": true,
"DataError": false,
"DataUpdate": {
"FileUpload": true,
"TemporaryDeletedFiles": false,
"PermanentDeletedFiles": false,
"DeletePendingFiles": false,
"RestoreDeletedFiles": false,
"DeleteAllFiles": false
}
},
"Push": {
"Update": true,
"Delete": false,
"AuthUpdate": false
}
}
]
}
Success (HTTP 200)¶
Preferences were written. Custom-email path asks the recipient to confirm the SES subscription.
Updated caller preferences
{
"Message": "Successfully updated notification preferences."
}
Custom email subscription started
{
"Message": "Please confirm the email subcription to successfully start receiving notifications."
}
Errors¶
Documented error codes: IPV-1045, IPV-1001, GE-1001, IPV-1005, IPV-1013, IPV-1079, AUTH-1017, IPV-1002, GE-1004, GE-1109, DB-1001, GE-1020, GE-1008.
HTTP 400
Validation failure. Body is {“Message”: “<CODE> - <text>”}. Codes: IPV-1045 (ResourceType), IPV-1001 (empty Resources), GE-1001 (missing ResourceId or Email), IPV-1005, IPV-1013, IPV-1079 (view DataUpdate/DataError), AUTH-1017 (no access), IPV-1002 (Start/Stop on non-notebook datalab), GE-1004 (invalid custom email), GE-1109 (invalid custom emails after partial write).
ResourceType is not supported
{
"Message": "IPV-1045 - Invalid parameter - ResourceType, value either missing or is invalid."
}
Resources is empty
{
"Message": "IPV-1001 - Parameter Resources is a required value."
}
Caller cannot access a resource
{
"Message": "AUTH-1017 - User does not have access to Datasets - {'dataset-a2f7d3b1-8e5c-4a6f-9d1e-2b3c4d5e6f7a'}"
}
HTTP 500
DynamoDB put failure uses DB-1001. Unsupported datasource type uses GE-1020 (FailedToUpdateMetadataException is not mapped to 400). Other uncaught errors return {“Message”: “<str(ex)>”} with no GE-1008 wrap.
Failed to write DynamoDB item
{
"Message": "DB-1001 - Failed to create entry in the DynamoDB table, please check for errors"
}
Datasource type cannot be updated
{
"Message": "GE-1020 - Updating notifications for the redshift datasource is not supported"
}