User APIs

Update User Email Preferences

OVERVIEW

Overview

Update a user's Email Preferences in Publisher

This API call is used to update a user's Email Preferences in the system, by replacing the Email Preferences with the provided Email Preferences object.

Since v4.6

HTTP Request

PUT  /api/2/users/<ID>/emailpreferences

OR

PUT  /api/2/users/<EMAIL>/emailpreferences

URL Parameters
Parameter Description
ID The ID of the user 
EMAIL The email address of the user 

 

HTTP Request Object

Email Preferences object, either in JSON or XML format.

 

HTTP Headers
HTTP Request Header Description Example
Authorization The API Authorisation token. "Bearer XXXXXXXXXXXXX"
Accept

The format of the expected response. 

  • "application/json"
  • "application/xml"

If no parameter is set, JSON is the default response given.

"application/xml"
Content-Type

The format of the provided content.

  • "application/json"
  • "application/xml"

If no parameter is set, JSON is the expected content by default.

"application/json"

 

HTTP Response

Success

HTTP response 200 with Email Preferences summary object

(Example below)

 

Error

See  API Error messages 

 

Example HTTP Request & Response

PUT http://example.com/context/api/2/users/3/emailpreferences

 

JSON Request

{

    "emailpreferences": {

        "frequency": "Daily",

        "metadatanodes": [

            {

                "node": "Countries",

                "metadata": [

                    "Algeria",

                    "Angola",

                    "Benin"

                ]

            },

            {

                "node": "American States",

                "metadata": [

                    "Alabama",

                    "Alaska",

                    "Arizona"

                ]

            }

        ],

        "modules": [

            {

                "name": "Publications",

                "preference": "Include"

            },

            {

                "name": "Events",

                "preference": "Off"

            },

            {

                "name": "News",

                "preference": "Custom",

                "frequency": "Weekly",

                "metadatanodes": [

                    {

                        "node": "Countries",

                        "metadata": [

                            "Algeria",

                            "Angola",

                            "Benin"

                        ]

                    },

                    {

                        "node": "American States",

                        "metadata": [

                            "Alabama",

                            "Alaska",

                            "Arizona"

                        ]

                    }

                ]

            }

        ],

        "alertservices": [

            {

                "name": "Email alert ABC",

                "preference": "On"

            },

            {

                "name": "Email alert XYZ",

                "preference": "Off"

            }

        ]

    }

}

 

 

JSON Response

{

    "emailpreferences": {

        "userid": 3,

        "link": "http://example.com/context/api/2/users/3/emailpreferences"

    }

}

 

 

Comments


0 Comments

Last Updated: Jun 10,2023