rest - NetSuite REST API 调用是否存在已知的偏移限制?
问题描述
世界!我们正在尝试使用NetSuite SuiteQL REST API来拉取数据。它对于我们采购的大多数记录都非常有效,但是当我们遇到大表时,我们遇到了一个有趣的障碍。
由于单页数据的已知限制是 1,000 行,我们只是以 1,000 的限制来调用它,并将偏移量设置为 1,000 行增量。当我们为大于 100,000 行的记录获得 100,000 行的偏移量时,会发生一些有趣的事情。
如果我们调用https://myinstance.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=1000&offset=98000,我们会得到我们期望的所有链接。
{
"links": [
{
"rel": "previous",
"href": "https://myinstance.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=1000&offset=97000"
},
{
"rel": "first",
"href": "https://myinstance.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=1000&offset=0"
},
{
"rel": "next",
"href": "https://myinstance.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=1000&offset=99000"
},
{
"rel": "last",
"href": "https://myinstance.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=1000&offset=753000"
},
{
"rel": "self",
"href": "https://myinstance.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=1000&offset=98000"
}
],
"count": 1000,
"hasMore": true,
"items": [
{
[heres my data]...
将其设置为 99,000,很多信息就会消失。就好像它认为这是最后一页。
{
"links": [
{
"rel": "previous",
"href": "https://myinstance.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=1000&offset=98000"
},
{
"rel": "first",
"href": "https://myinstance.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=1000&offset=0"
},
{
"rel": "self",
"href": "https://myinstance.suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=1000&offset=99000"
}
],
"count": 1000,
"hasMore": false,
"items": [
{
[heres my data]...
将其设置为 100,000 会给我一个错误。
{
"type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5",
"title": "Not Found",
"status": 404,
"o:errorDetails": [
{
"detail": "The specified query parameter 'offset' is out of bounds. Provide value between 0 and 753000.",
"o:errorQueryParam": "offset",
"o:errorCode": "INVALID_PARAMETER"
}
]
有没有人见过这种行为?我浏览了文档,找不到任何关于页面偏移限制的提及,所以我认为这可能是某种错误(事实上它甚至告诉你最大界限并且它明显高于指定的偏移量使得我认为这是一个错误),但希望有人可能以前见过这个,甚至更好的是,对如何解决这个问题有想法!
解决方案
NetSuite REST Web 服务的官方文档提到了这个限制 [ 1 ]:
使用 SuiteQL 查询,您最多可以返回 100,000 个结果。有关详细信息,请参阅 query.runSuiteQLPaged(options)。
推荐阅读
- c# - Microsoft EWS 获取可用会议室
- squish - 更新到最新的 Squish 版本 6.4.2
- python - 现有行更新或使用 django 模型插入新行
- java - 将图像添加到自定义 ArrayList 以进行序列化 Intent
- python - 使用 sqlite3 在 Flask 中查询多个表
- php - Symfony 4.1 PHP 7.2.10 注意:iconv():错误的字符集,不允许从 `UTF-8' 转换为 `UTF-16BE'
- java - Maven 无法识别本地存储库中的 Jar
- r - R中数据表中的Wordcloud
- amadeus - Amadeus 测试环境的 API 使用(每秒请求数)限制是多少?
- c# - 执行字符串检查