执行Intune customTextNotification时遇400 Bad Request错误排查
解决Intune customTextNotification操作的400 Bad Request错误
核心问题定位
你的请求体中notificationTitle设为null,这是触发400错误的关键原因。尽管官方文档未明确标注该字段为必填,但实际调用customTextNotification操作时,notificationTitle和notificationBody均为必填字段,不能为null或空字符串。
执行customTextNotification的全部条件
1. 请求体必填字段
actionName:固定为customTextNotification,不能拼写错误deviceIds:至少包含1个有效的托管设备ID,且目标设备必须处于已注册、活跃状态notificationTitle:非空字符串,作为通知的标题内容notificationBody:非空字符串,作为通知的正文内容deviceName:可选字段,可设为null,无需额外赋值
2. 权限要求
你当前令牌包含的权限完全满足要求,只需具备以下任一权限即可:
DeviceManagementManagedDevices.ReadWrite.AllDeviceManagementManagedDevices.PrivilegedOperations.All
3. 设备端要求
- 目标设备必须是Intune托管的设备(支持Windows、iOS/iPadOS、Android)
- 设备需处于在线状态,能正常与Intune服务通信
- iOS/iPadOS设备需开启通知权限;Windows设备需确保Intune管理扩展正常运行
4. 请求格式要求
- 请求方法必须为
POST,端点固定为beta/deviceManagement/managedDevices/executeAction - 请求体需为合法JSON格式,无语法错误
修正后的请求体示例
{ "actionName": "customTextNotification", "deviceIds": ["你的设备ID"], "notificationTitle": "测试通知标题", "notificationBody": "BF test - 12/8/2023 - 7:34AM EST", "deviceName": null }
内容的提问来源于stack exchange,提问作者dog27
相关产品推荐
相关产品推荐

