PowerApps中通过Azure AD调用Graph API的POST/PATCH请求体构造问题
Azure AD连接器POST/PATCH请求体正确构造方式
Azure AD连接器的POST/PATCH请求必须使用标准JSON格式,以下是正确的构造规则和示例:
核心规则
- 所有键名和字符串类型的值必须用双引号
"包裹,禁止使用单引号或无引号 - 嵌套结构的大括号
{}必须成对匹配,不能遗漏或多写 - 数据类型严格区分:布尔值为小写的
true/false,数值直接书写(无需引号),数组用方括号[]包裹 - 必须符合Azure AD对应API的字段要求,必填字段不能缺失
POST请求示例(以创建用户为例)
{ "accountEnabled": true, "displayName": "John Doe", "mailNickname": "johndoe", "userPrincipalName": "john.doe@contoso.com", "passwordProfile": { "forceChangePasswordNextSignIn": true, "password": "P@ssw0rd123!" } }
PATCH请求示例(以更新用户信息为例)
{ "displayName": "John M. Doe", "jobTitle": "Senior Engineer", "department": "Engineering" }
常见错误排查
- 错误写法:
{'displayName': 'John'}→ 修正为{"displayName": "John"}(单引号替换为双引号) - 错误写法:
{displayName: "John"}→ 修正为{"displayName": "John"}(键名添加双引号) - 错误写法:
{"accountEnabled": True}→ 修正为{"accountEnabled": true}(布尔值改为小写) - 错误写法:缺少闭合大括号 → 检查所有
{是否对应有}
内容的提问来源于stack exchange,提问作者NewOne
相关产品推荐
相关产品推荐

