Skip to main content
Version: 1.26.1

Retrieve the Blocklist

The EasyLife 365 Mail API facilitates the direct updating of the mail blocklists. The blocklist feature prevents end-users from creating resources that match or contain blocklist terms. Blocklist terms are either specific email prefixes or simple wildcard terms using an asterisk (*) to denote multiple characters. For instance, an organization might want to avoid using email addresses that use common prefixes such as admin@, marketing@, sales@, and other common email prefixes to help reduce unsolicited emails and other exploits.

Permissions​

Permission TypePermissions (Scope)
Delegated (work or school account)https://api.easylife365.cloud/admin/Mail.Blocklist.Read
ApplicationNot supported.

HTTP Request​

GET https://api.easylife365.cloud/admin/v1/blocklist
Content-Type: application/json

HTTP Request Headers​

HeaderValue
AuthorizationBearer token. (Required)
Content-Typeapplication/json

In this example, we demonstrate how to retrieve the current blocklist.

Request Body​

This request does not require or support any data.

Response​

Upon queuing the request, with an array of configured blocklists. A sample payload might look like this.

[ "admin", "info", "marketing", "admin*", "*test*", "*user" ]

Example 1: Retrieve the Blocklist​

This example retrieves the current blocklist.

Request​

GET https://api.easylife365.cloud/admin/v1/blocklist
Content-Type: application/json

Response​

[ "admin", "info", "marketing", "admin*", "*test*", "*user" ]

Example 2: Retrieve the Blocklist using PowerShell​

The following example demonstrates how to retrieve the blocklist using PowerShell. Before executing the script, ensure you've registered an application and obtained the TenantId and ClientId. Also, retrieve the correct URI and scope from this document.

$tenantId = "[TENANT_ID]"
$scope = "[SCOPE]"
$uri = "[URI]"

az login --tenant $tenantId | Out-Null

$accessToken = az account get-access-token `
--tenant $tenantId `
--scope $scope `
--query accessToken `
--output tsv

# Invoke the API and capture responses.
$headers = @{
"Authorization"= "Bearer $($accessToken)"
"Content-Type" = "application/json"
}

$blocklist = Invoke-RestMethod -Method GET -Uri $uri -Headers $headers
Write-Information "Current Blocklist: $blocklist" -InformationAction Continue