How to Update Email Settings for a Specific Site Using the REST API
This article provides guidance on how to update email settings of a specific site using the REST API. Users who have admin rights permission to email settings are able to update the email settings.
Authorization
To perform this action, an access token must be included in the request header. For details on obtaining the access token, please refer to the relevant documentation here.
Authorization: bearer <token>
Endpoints
Self-Hosted Server
https://{yourdomain}/bi/api/site/<site_identifier>/v6.0/settings/email
Bold BI Cloud Server
https://{yourdomain}/bi/api/v6.0/settings/email
Request Type
- PUT: This request type is used to update email settings through an API request.
Steps to Update Email Settings for a Specific Site Using the REST API
- Configure the Endpoint
In your API client, set the request to PUT and use the endpoint:
https://{yourdomain}/bi/api/site/<site_identifier>/v6.0/settings/email
- Add the Authorization Header
Include the access token in the request headers:
Authorization: bearer <token>
3. Set Up the Request Body
- In the Body tab, select raw and set the format to JSON. Provide the details in the following structure
{
"EmailAccount": "string",
"SMTPServer": "string",
"SMTPPort": "string",
"SenderName": "string",
"SenderEmailAddress": "string",
"AuthenticationType": "string",
"Username": "string",
"Password": "string",
"EnableSSL": true,
"TenantId": "string",
"ClientId": "string",
"ClientSecret": "string"
}
Request Body Schema
-
EmailAccount:
string
Specify the email account. Values allowed are SMTP, Microsoft365 and default value is SMTP -
SMTPServer:
string
Specify the SMTP server name. Applicable only for SMTP -
SMTPPort:
string
Specify the SMTP port number. Applicable only for SMTP. -
SenderName:
string
Specify the Sender name for the email. Applicable only for SMTP. -
SenderEmailAddress (required):
string
Specify the Sender email address. -
AuthenticationType (required):
string
Specify the Authentication type of the email. Values allowed are Basic, Anonymous, OAuth. OAuth only applicable for Microsoft365 -
QueryMetricsEnabled:
boolean
Specify true to enable the query metrics dashboard setting. -
Username:
string
Specify the Username for Basic Authentication type. Applicable only for SMTP. -
Password:
string
Specify the Password for Basic Authentication type. Applicable only for SMTP. -
EnableSSL:
boolean
Specify true to enable SSL to connect with SMTP server. Applicable only for SMTP. -
TenantId:
string
Specify the Tenant name. Applicable only for Microsoft365. -
ClientId:
string
Specify the Client id. Applicable only for Microsoft365. -
ClientSecret:
boolean
Specify the Client secret. Applicable only for Microsoft365.
- Example JSON Data
{
"EmailAccount": "SMTP",
"SMTPServer": "smtp.office365.com",
"SMTPPort": "87",
"SenderName": "Test User",
"SenderEmailAddress": "[email protected]",
"AuthenticationType": "Basic",
"Username": "[email protected]",
"Password": "testuser@123",
"EnableSSL": false
}
- Send the request
Execute the request by pressing Send icon. If the request is successful, it will return the response as true.
Responses
- 200 - Email settings have been updated successfully.
- 400 - The content of the request body is missing or incomplete.
- 401 - Access denied.
- 405 - Request type was not PUT.
- 412 - Email address is invalid (or) Authentication type is invalid.
- 417 - Failed to update email settings.