Update MAC filter¶
PUT/
Switch Management API · MacFiltering
Update MAC filter settings for the tenant.
Parameters¶
| Name | In | Type | Required | Description |
|---|---|---|---|---|
X-Tenant-ID | header | string (uuid) | Yes | Tenant ID. |
Request body¶
Content type: application/json
Request body fields
macAddressesarray of string (mac)List of MAC addresses.
Must contain at most 256 items. Items must be unique.
Must contain at most 256 items. Items must be unique.
Request samples¶
curl -X PUT "https://api-<data-region>.central.sophos.com/switch/v1/settings/mac-filtering" -H "Authorization: Bearer <access-token>" -H "X-Tenant-ID: <tenant-id>" -H "Content-Type: application/json" -d "{
\"macAddresses\": [
\"5c:85:7e:32:97:26\",
\"5c:85:7e:32:98:28\"
]
}"
import requests
response = requests.put(
"https://api-<data-region>.central.sophos.com/switch/v1/settings/mac-filtering",
headers={
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
"Content-Type": "application/json",
},
json={'macAddresses': ['5c:85:7e:32:97:26', '5c:85:7e:32:98:28']},
)
print(response.json())
$headers = @{
"Authorization" = "Bearer <access-token>"
"X-Tenant-ID" = "<tenant-id>"
"Content-Type" = "application/json"
}
$body = '{
"macAddresses": [
"5c:85:7e:32:97:26",
"5c:85:7e:32:98:28"
]
}'
Invoke-RestMethod -Method PUT -Uri "https://api-<data-region>.central.sophos.com/switch/v1/settings/mac-filtering" -Headers $headers -Body $body -ContentType "application/json"
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
req, err := http.NewRequest("PUT", "https://api-<data-region>.central.sophos.com/switch/v1/settings/mac-filtering", strings.NewReader(`{
"macAddresses": [
"5c:85:7e:32:97:26",
"5c:85:7e:32:98:28"
]
}`))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer <access-token>")
req.Header.Set("X-Tenant-ID", "<tenant-id>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
const response = await fetch("https://api-<data-region>.central.sophos.com/switch/v1/settings/mac-filtering", {
method: "PUT",
headers: {
"Authorization": "Bearer <access-token>",
"X-Tenant-ID": "<tenant-id>",
"Content-Type": "application/json",
},
body: JSON.stringify({
"macAddresses": [
"5c:85:7e:32:97:26",
"5c:85:7e:32:98:28"
]
}),
});
const data = await response.json();
console.log(data);
Responses¶
201 — MAC filter policies updated.¶
Response fields
tenantobjectTenant ID.
Show child attributesHide child attributes
idstring (uuid)requiredTenant ID.
createdByobjectPrincipal reference.
Show child attributesHide child attributes
idstringrequiredPrincipal email or client ID.
typestring (enum)requiredPrincipal type.
Must be one of:
Must be one of:
user, service.accountTypestringAccount type.
Must be one of:
Must be one of:
partner, tenant, organization.accountIdstring (uuid)Account ID.
createdAtstring (date-time)Timestamp when this setting is created.
updatedByobjectPrincipal reference.
Show child attributesHide child attributes
idstringrequiredPrincipal email or client ID.
typestring (enum)requiredPrincipal type.
Must be one of:
Must be one of:
user, service.accountTypestringAccount type.
Must be one of:
Must be one of:
partner, tenant, organization.accountIdstring (uuid)Account ID.
updatedAtstring (date-time)Timestamp when this setting is updated.
macAddressesarray of string (mac)requiredList of MAC addresses.
Must contain at most 256 items. Items must be unique.
Must contain at most 256 items. Items must be unique.
Errors¶
| Status | Meaning |
|---|---|
400 | Bad request. |
401 | Authentication required. |
403 | Authorization required. |
404 | Resource not found. |
500 | Unexpected error. |
All error responses share the same shape — see the error response object.
Response examples¶
201¶
{
"macAddresses": [
"5c:85:7e:32:97:26",
"5c:85:7e:32:98:28"
],
"tenant": {
"id": "3e382b8e-49fd-4cd9-8360-a364371d7650"
},
"createdBy": {
"id": "97483e58-55d7-44fb-b03f-9422f106ef66",
"type": "user",
"accountId": "3e382b8e-49fd-4cd9-8360-a364371d7650",
"accountType": "tenant"
},
"createdAt": "2022-03-30T05:43:59.492",
"updatedBy": {
"id": "97483e58-55d7-44fb-b03f-9422f106ef66",
"type": "user",
"accountId": "3e382b8e-49fd-4cd9-8360-a364371d7650",
"accountType": "tenant"
},
"updatedAt": "2022-03-30T05:43:59.492"
}
See the guide for a narrative walkthrough of this API.