如何通过调用NETSUITE REST API从所有位置获取库存商品数量
获取…/record/v1/inventoryitem/155/locations/1 通过使用上面的api来获取项目数量,我得到了下面的错误如何通过调用NETSUITE REST API从所有位置获取库存商品数量,netsuite,Netsuite,获取…/record/v1/inventoryitem/155/locations/1 通过使用上面的api来获取项目数量,我得到了下面的错误 "title": "Unknown (sub-)resource (i.e., sublist, sublist line, subrecord, reference, ultiselect) locations in request URL.", "status": 404, "o:errorC
"title": "Unknown (sub-)resource (i.e., sublist, sublist line, subrecord,
reference, ultiselect) locations in request URL.",
"status": 404,
"o:errorCode": "NONEXISTENT_ID"
请告诉我获取物品可用数量必须使用哪个API。您可以在脚本中使用搜索API从所有位置检索库存物品数量。下面是搜索的代码段(使用SuiteScript 1.0和2.0创建),用于检索项目所有位置的库存数量 使用SuiteScript 1.0创建的搜索:
var inventoryitemSearch = nlapiSearchRecord("inventoryitem",null,
[
["type","anyof","InvtPart"],
"AND",
["internalidnumber","equalto","57"] // Enter the internal id of item
],
[
new nlobjSearchColumn("itemid"),
new nlobjSearchColumn("inventorylocation"),
new nlobjSearchColumn("locationquantityavailable")
]
);
var inventoryitemSearch = search.create({
type: "inventoryitem",
filters:
[
["type","anyof","InvtPart"],
"AND",
["internalidnumber","equalto","57"] // Enter the internal id of item
],
columns:
[
search.createColumn({name: "itemid", label: "Name"}),
search.createColumn({name: "inventorylocation", label: "Inventory Location"}),
search.createColumn({name: "locationquantityavailable", label: "Location Available"})
]
});
使用SuiteScript 2.0创建的搜索:
var inventoryitemSearch = nlapiSearchRecord("inventoryitem",null,
[
["type","anyof","InvtPart"],
"AND",
["internalidnumber","equalto","57"] // Enter the internal id of item
],
[
new nlobjSearchColumn("itemid"),
new nlobjSearchColumn("inventorylocation"),
new nlobjSearchColumn("locationquantityavailable")
]
);
var inventoryitemSearch = search.create({
type: "inventoryitem",
filters:
[
["type","anyof","InvtPart"],
"AND",
["internalidnumber","equalto","57"] // Enter the internal id of item
],
columns:
[
search.createColumn({name: "itemid", label: "Name"}),
search.createColumn({name: "inventorylocation", label: "Inventory Location"}),
search.createColumn({name: "locationquantityavailable", label: "Location Available"})
]
});
附加说明:您可以在搜索中添加额外的列,以检索有关该项目的更多信息。您还可以调整搜索过滤器以检索许多项目记录的信息 您可以执行SuiteQL查询
POST https://[account].suitetalk.api.netsuite.com/services/rest/query/v1/suiteql
Header: Prefer: transient
Body:
{
"q": "SELECT item, location, quantityavailable FROM inventoryitemlocations WHERE item=155"
}
来自我的测试帐户的示例输出:
{
"links": [
{
"rel": "self",
"href": "https://[accountid].suitetalk.api.netsuite.com/services/rest/query/v1/suiteql?limit=1000&offset=0"
}
],
"count": 3,
"hasMore": false,
"items": [
{
"links": [],
"item": "857",
"location": "1",
"quantityavailable": "50"
},
{
"links": [],
"item": "857",
"location": "16",
"quantityavailable": "50"
},
{
"links": [],
"item": "857",
"location": "12",
"quantityavailable": "50"
}
],
"offset": 0,
"totalResults": 3
}
记录和字段ID位于分析浏览器中:。此请求适用于我的记录,因此需要您提供更多信息。您确定ID为155的inventoryitem记录上存在ID为1的位置吗?Request GET…/record/v1/inventoryitem/155/locations将返回给定项目的所有位置id。您好,Request GET…/record/v1/inventoryitem/155/locations->return empty(如下所示),但该记录存在8个位置。[155是项目内部id]{“链接”:[{“rel”:“self”,“href”:“***/record/v1/inventoryitem/155/locations”}],“items”:[],“totalResults”:0}男孩,很难找到SuiteQL的记录/表名。我到处都在查找inventoryitemlocations。我在分析浏览器的“I”下查找,出于某种原因,它列在“L”下“带有位置的标题。另外,为什么它没有列在item表的联接中。SuiteQL看起来不错,但需要自己的记录浏览器。@BenMills/app/recordscatalog/rcbrowser.nl?whence=#/record\u ss/location这似乎是记录浏览器,但仍然不是100%