Skip to main content
Version: 1.0.0

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

PUT 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 scope from this document.

Import-Module MSAL.PS

$msalParam = @{
tenantId = "[TENANT_ID]"
clientId = "[CLIENT_ID]"
scopes = "[SCOPE]"
}
$uri = "[URI]"

# Get JWT authentication token.
if($token){
$token = Get-MsalToken @msalParam -Silent
} else {
$token = Get-MsalToken @msalParam -DeviceCode
}

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

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