azure - Graph Api 响应中的 nextLink 不是绝对 Uri
问题描述
我们正在调用图形 api 以使用此 url在我们的 Azure B2C AD 中获取用户
https://graph.windows.net/TENANTNAME.onmicrosoft.com/users?api-version=1.6&$top=10&$select=objectId,userType,displayName,signInNames,createdDateTime&$filter=userType%20eq%20'Member'
请注意,在我编写此分页代码时,页面大小故意设置为 10 小
文档说,如果要提取更多数据,则响应中将有一个 nextLink 属性,如果存在,则应该使用 uri 来获取下一页数据。我们确实看到了一个更准确的 nextLink,odata.nextLink
但是该值不能用作下一个请求的 uri。
这是一个例子
directoryObjects/$/Microsoft.DirectoryServices.User?$select=objectId,userType,displayName,signInNames,createdDateTime&$filter=userType%20eq%20'Member'&$skiptoken=X'010001000000030000005903BF45BBE7EA4CB7378BD076AD388026EC6A89C7479240A83DE15C99D42A0C4B7E5E4C707FB448B45655AED90920FA6D7126F4D8990'
请注意,skiptoken 值已缩短
我可以解析 nextLink 并为下一页组装一个 uri,但这似乎是一个愚蠢的想法,因为 nextLink 的值对我来说应该是不透明的。
是因为我们调用的是 B2C 租户吗?
是否有解析该链接的商定方法?
解决方案
This is a problem caused by design, Azure AD graph api just provide this kind of nextlink. Actually, Microsoft is recommending to use Microsoft Graph in place of the Azure Active Directory Graph API in order to access Azure AD’s resources. So you can use Microsoft graph api "list users" to get the users in your AD, and it will show the absolute uri for the next link.
推荐阅读
- python - 可以从 pandas lambda 函数中访问全局变量吗?
- android-activity - android studio中的多个类和新活动
- swift - 如何在日期选择后以编程方式关闭 SwiftUI 图形 DatePicker
- delphi - Delphi 的代码格式化程序使用了太多的空格(使用菜单...)
- node.js - 在nodejs中读取属性文件
- c# - 在 C# 中,异步任务在执行之前等待完成另一个异步任务
- c# - 我需要将字符串数据从字节转换为浮点
- node.js - 如何在猫鼬中 30 分钟后从文档中删除字段
- html - 如何在另一行 pug 中写入特定列(动态 html)
- reactjs - 如何在 React 条形图中的堆栈下方绘制辅助标签