如何通过邮递员调用NETSUITE REST API来获得库存物品数量

问题描述 投票:-1回答:1

我正在使用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称为“库存状态”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称为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个回答
0
投票

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

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

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

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

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

GET .../v1/record/inventorystatus/1
© www.soinside.com 2019 - 2024. All rights reserved.