【问题标题】:How can I get inventory item quantity by calling NETSUITE REST API on postman如何通过在邮递员上调用 NETSUITE REST API 来获取库存项目数量
【发布时间】:2020-02-20 11:38:43
【问题描述】:

我正在使用 Postman 测试 NETSUITE API。 我给了

  • 消费者密钥
  • 消费者秘密
  • 访问令牌
  • 令牌秘密 在授权 OAuth1.0 类型中。

我用商品 ID 调用 API“inventoryitem”

**https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/inventoryitem/155**

并获得库存项目详细信息作为响应..

{
"links": [
    {
        "rel": "self",
        "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/inventoryitem/155"
    }
],
"assetAccount": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/account/216"
        }
    ],
    "id": "216",
    "refName": "1420 Inventory Asset"
},
"atpmethod": "CUMULATIVE_ATP_WITH_LOOK_AHEAD",
"autoLeadTime": false,
"autoPreferredStockLevel": false,
"autoReorderPoint": false,
"averageCost": 25.5,
"billExchRateVarianceAcct": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/account/324"
        }
    ],
    "id": "324",
    "refName": "5017 Bill exchange variance"
},
"billPriceVarianceAcct": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/account/323"
        }
    ],
    "id": "323",
    "refName": "5016 Bill Price Variance"
},
"billQtyVarianceAcct": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/account/322"
        }
    ],
    "id": "322",
    "refName": "5015 Bill Quantity Variance"
},
"binNumber": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/inventoryitem/155/binNumber"
        }
    ]
},
"class": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/classification/22"
        }
    ],
    "id": "22",
    "refName": "Healthcare & Nutrition"
},
"cogsAccount": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/account/217"
        }
    ],
    "id": "217",
    "refName": "5005 COGS : Cost of Goods Sold"
},
"copyDescription": false,
"cost": 13.4,
"costEstimateType": "AVGCOST",
"costingMethod": "FIFO",
"costingMethodDisplay": "Lot Numbered",
"costUnits": "per Box 12",
"createdDate": "2018-11-20T13:48:00Z",
"currency": {
    "links": [],
    "id": "British pound",
    "refName": "British pound"
},
"custitem1": "511265",
"custitem3": 12,
"custitem_atlas_approved": false,
"custitem_nsts_ep_item_category": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/inventoryitem/155/custitem_nsts_ep_item_category"
        }
    ]
},
"custitem_wmsse_itemfamily": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/customrecord_wmsse_item_family/4"
        }
    ],
    "id": "4",
    "refName": "Non-Refrigerated Item Family"
},
"custitem_wmsse_itemgroup": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/customrecord_wmsse_itemgroup/2"
        }
    ],
    "id": "2",
    "refName": "Non-Refrigerated Item Group"
},
"custitem_wmsse_mix_item": true,
"custitem_wmsse_mix_lot": true,
"custitemcustcol4": "250ML",
"customForm": "139",
"custReturnVarianceAccount": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/account/326"
        }
    ],
    "id": "326",
    "refName": "4045 CUSTOMER RETURN VARIANCE"
},
"displayName": "DETTOL 12X250ML",
"dontshowprice": false,
"enforceminqtyinternally": true,
"excludefromsitemap": false,
"froogleproductfeed": false,
"handlingCostUnits": "per Box 12",
"id": "155",
"includeChildren": true,
"incomeAccount": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/account/251"
        }
    ],
    "id": "251",
    "refName": "4040 Sales : Income"
},
"internalid": 155,
"isdonationitem": false,
"isDropShipItem": false,
"isgcocompliant": false,
"isInactive": false,
"isonline": false,
"isSpecialOrderItem": false,
"itemId": "DETTOL 250ML",
"itemType": "InvtPart",
"itemVendor": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/inventoryitem/155/itemVendor"
        }
    ]
},
"lastModifiedDate": "2020-01-21T18:07:00Z",
"lastPurchasePrice": 24.53,
"locations": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/inventoryitem/155/locations"
        }
    ]
},
"matchBillToReceipt": true,
"minimumquantityUnits": "Box 12",
"nextagproductfeed": false,
"offerSupport": true,
"preferredLocation": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/location/20"
        }
    ],
    "id": "20",
    "refName": "8905 Highway 50"
},
"productfeed": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/inventoryitem/155/productfeed"
        }
    ]
},
"purchaseDescription": "DETTOL 12X250ML",
"purchaseOrderAmount": 0.1,
"purchaseOrderQuantity": 0.1,
"purchaseUnit": "9",
"quantityReorderUnits": "Quantity On Hand, Reorder Point, Quantity On Order, and Quantity Committed are in Box 12",
"receiptAmount": 0.1,
"receiptQuantity": 0.1,
"salesDescription": "DETTOL  250ML",
"saleUnit": "9",
"seasonalDemand": false,
"shipIndividually": false,
"shippingCostUnits": "per Box 12",
"shoppingproductfeed": false,
"shopzillaproductfeed": false,
"showdefaultdonationamount": false,
"sitecategory": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/inventoryitem/155/sitecategory"
        }
    ]
},
"stockUnit": "9",
"Subsidiary": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/inventoryitem/155/Subsidiary"
        }
    ]
},
"supplyReplenishmentMethod": "TIME_PHASED",
"taxSchedule": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/"
        }
    ],
    "id": "2",
    "refName": "Taxable"
},
"totalValue": 3522.66,
"trackLandedCost": true,
"transferPriceUnits": "per Box 12",
"unitsType": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/unitstype/1"
        }
    ],
    "id": "1",
    "refName": "Each"
},
"upcCode": "50158072",
"useBins": true,
"useMarginalRates": false,
"vendReturnVarianceAccount": {
    "links": [
        {
            "rel": "self",
            "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/account/325"
        }
    ],
    "id": "325",
    "refName": "5020 VENDOR RETURN VARIANCE"
},
"weight": 3.0,
"weightUnit": "3",
"weightUnits": "per Box 12",
"yahooproductfeed": false

}

但此详细信息中缺少项目数量。我只想获取商品数量及其可用性状态。

我也将 API 称为“inventorystatus” https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/inventorystatus/ 并得到了这个细节..

{
"links": [
    {
        "rel": "self",
        "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/inventorystatus?limit=1000&offset=0"
    }
],
"count": 2,
"hasMore": false,
"items": [
    {
        "links": [
            {
                "rel": "self",
                "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/inventorystatus/2"
            }
        ],
        "id": "2"
    },
    {
        "links": [
            {
                "rel": "self",
                "href": "https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/inventorystatus/1"
            }
        ],
        "id": "1"
    }
],
"offset": 0,
"totalResults": 2

}

我用特定的项目 ID 调用 API“inventorystatus”

**https://1234567.suitetalk.api.netsuite.com/rest/platform/v1/record/inventorystatus/134**

得到了这个

{
"type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5",
"title": "Record does not exist.",
"status": 404,
"o:errorCode": "NONEXISTENT_ID"

}

但记录可用。

请任何人告诉我我应该使用哪个 API 来获取商品可用性状态及其可用数量(基本单位)。

【问题讨论】:

  • 需要更多细节。你试过什么?你得到什么错误?截图?索取样品?

标签: api postman netsuite


【解决方案1】:

NetSuite REST WS 使用 HATEOAS 链接浏览资源。 这些可以是子列表和子记录。 (请参阅 NetSuite 帮助中心:REST Web 服务关键概念和 NetSuite 记录结构)

默认情况下,这些资源不会显示在请求中,但您可以通过 HATEOAS 链接或使用查询参数 expandSubResources=true 访问它们。

要回答您问题的第一部分: 例如,如果您想查看 Inventory Item 上不同位置的数量,可以发送此请求:

GET .../v1/record/inventoryitem/155/locations/1

在您的第二个请求中,可以看到有两个 ID 为 12 的库存状态记录实例。以下请求应向您显示该记录上的所有正文字段:

GET .../v1/record/inventorystatus/1

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-03
    • 2018-05-10
    • 1970-01-01
    • 2015-04-06
    • 2018-07-23
    • 2019-05-25
    • 2021-01-17
    • 1970-01-01
    相关资源
    最近更新 更多