在进行“列表路径”时,需要帮助获取延续令牌。 REST API呼叫Azure Data Lake Storage gen2

发布于 2025-02-03 14:46:50 字数 1260 浏览 4 评论 0 原文

当我呼吁使用MaxResults中列出ADLS Gen2中的路径并延续为URI参数时。

最初,我要获得正确的延续令牌作为响应标头返回,但是当我尝试列出列出剩余文件的随后电话时,有时ADLS以“ ==”结尾的延续令牌返回(有时将其称为“ =”)如果使用普通令牌返回(二型)。现在,当我尝试使用第一种类型进行API调用时,ADL会给我一个错误,并且在其他令牌的情况下它可以正常工作。

我以前搜索过这个答案之一,我必须忽略令牌返回以“ ==”结束的响应,我们必须一次又一次地拨打电话,以忽略持续令牌(不使用这个令牌在URI和使用相同的先前请求URI中)返回,直到我们获得第二种(工作)类型的令牌为止。

当涉及到大量文件时,这是一项复杂的任务,对此有更好的解决方案吗? 是否有更好的解决方案来获得正确类型的延续令牌来进行随后的呼叫?

返回的示例请求是

GET https://storageAccountName.dfs.core.windows.net/sampleDirectory?recursive={recursive}&resource=filesystem&maxresults={maxresults}&continuation={continuation}

返回的两种类型的示例连续令牌,为

  1. lcjhbgcioijsuzi1niising1dci6imptmvhvmu9xrgpfntj2ynd == (不工作一个) >
  2. (工作一个)

ADLS GEN2的正式文档用于列表路径是

我所引用的无法获得ADLS GEN2 REST延续令牌上班

When I make API call for listing the paths in ADLS Gen2 using maxResults and Continuation as uri parameters.

Initially I'm getting the correct continuation token returned as response headers but when i try to make subsequent calls for listing the remaining files, sometimes ADLS returns with a continuation token that ends with "=="(lets call it type one) and sometimes if returns with the normal token(type two).Now,when I try to make API call using the first type, ADLS gives me an error and it works fine in the case of the other token.

I searched this before and what I found in one of the answers was that we have to ignore the response in which the token returned ends with "==" and we have to make calls again and again ignoring the continuation token(not using this token in the uri and using the same previous request uri) returned until we get the second(working) type of token.

This is a complex task when it comes to larger amount of files,is there a better solution for this?
Is there a better solution for getting the right type of continuation token for making subsequent calls?

The Sample request for making the call is

GET https://storageAccountName.dfs.core.windows.net/sampleDirectory?recursive={recursive}&resource=filesystem&maxresults={maxresults}&continuation={continuation}

The two types of sample continuation tokens returned are

  1. LCJhbGciOiJSUzI1NiIsIng1dCI6ImpTMVhvMU9XRGpfNTJ2Ynd==(Not working one)
  2. LCJhbGciOiJSUzI1NiIsIng1dCI6ImpTMVhvMU9XRGpfNTJ2Ynd (working one)

The Official Documentation for ADLS Gen2 for listing paths is
https://learn.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/list

The link to the stackoverflow answer which I was referring to can't get ADLS Gen2 REST continuation token to work

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文