如何获取超过 100 个桶对象?如何列出所有存储桶对象?
How can I get more than 100 bucket objects? How can I list all the bucket objects?
使用 https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-GET/ ,我可以将限制设置为 100 并提取存储桶对象。但是我怎样才能得到一个bucket key中的所有bucket对象呢?
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://developer.api.autodesk.com/oss/v2/buckets/mybucketkey/objects?limit=100");
request.Method = "Get";
request.KeepAlive = true;
request.ContentType = "appication/json";
request.Headers.Add("Authorization", "Bearer my token" );
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string myResponse = "";
using (System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream()))
{
myResponse = sr.ReadToEnd();
}
这样我可以列出100个。但我找不到如何将它们全部列出。会不会跟startAt参数有关?
如果回复包含“next”属性,那么您必须使用它来获取接下来的 100 个项目。继续这样做,直到获得所有物品。
是的,startAt 参数将指定您要返回的下一个 100
参见例如https://github.com/Autodesk-Forge/forge-buckets-tools/blob/master/server/data.management.js#L247
使用 https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-GET/ ,我可以将限制设置为 100 并提取存储桶对象。但是我怎样才能得到一个bucket key中的所有bucket对象呢?
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://developer.api.autodesk.com/oss/v2/buckets/mybucketkey/objects?limit=100");
request.Method = "Get";
request.KeepAlive = true;
request.ContentType = "appication/json";
request.Headers.Add("Authorization", "Bearer my token" );
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string myResponse = "";
using (System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream()))
{
myResponse = sr.ReadToEnd();
}
这样我可以列出100个。但我找不到如何将它们全部列出。会不会跟startAt参数有关?
如果回复包含“next”属性,那么您必须使用它来获取接下来的 100 个项目。继续这样做,直到获得所有物品。 是的,startAt 参数将指定您要返回的下一个 100
参见例如https://github.com/Autodesk-Forge/forge-buckets-tools/blob/master/server/data.management.js#L247