understanding undef locationGroupId entries in pac

2019-06-14 00:33发布

问题:

I ran a SL REST API query to get the list of items available for the 240 (Endurance iSCSI) package for only the common price entries, by querying only those price entries with a locationGroupId value of undefined. Here is the query I ran:

curl -u : https://api.softlayer.com/rest/v3/SoftLayer_Product_Package/240/getItems.json?objectFilter=%7B%22items%22:%7B%22prices%22:%7B%22locationGroupId%22:%7B%22operation%22:%22is%20null%22%7D%7D%7D%7D

I am a bit confused by the result. Here is an excerpt:

...

   {
      "upgradeItemId" : null,
      "description" : "4000 GB Storage Space",
      "capacity" : "4000",
      "keyName" : "4000_GB_PERFORMANCE_STORAGE_SPACE",
      "itemCategory" : {
         "quantityLimit" : 0,
         "name" : "Storage Space",
         "id" : 382,
         "categoryCode" : "performance_storage_space"
      },
      "softwareDescriptionId" : null,
      "id" : 5146,
      "itemTaxCategoryId" : 166,
      "prices" : [
         {
            "recurringFee" : "58",
            "setupFee" : "0",
            "quantity" : null,
            "packageReferences" : [
               {
                  "packageId" : 240,
                  "id" : 386831,
                  "itemPriceId" : 46625
               }
            ],
            "onSaleFlag" : null,
            "oneTimeFee" : "0",
            "itemId" : 5146,
            "sort" : 10,
            "currentPriceFlag" : null,
            "laborFee" : "0",
            "id" : 46625,
            "locationGroupId" : null
         },
         {
            "recurringFee" : "145",
            "setupFee" : "0",
            "quantity" : null,
            "packageReferences" : [
               {
                  "packageId" : 240,
                  "id" : 385796,
                  "itemPriceId" : 46096
               }
            ],
            "onSaleFlag" : null,
            "oneTimeFee" : "0",
            "itemId" : 5146,
            "sort" : 10,
            "currentPriceFlag" : null,
            "laborFee" : "0",
            "id" : 46096,
            "locationGroupId" : null
         },
         {
            "recurringFee" : "290",
            "setupFee" : "0",
            "quantity" : null,
            "packageReferences" : [
               {
                  "packageId" : 240,
                  "id" : 385806,
                  "itemPriceId" : 46106
               }
            ],
            "onSaleFlag" : null,
            "oneTimeFee" : "0",
            "itemId" : 5146,
            "sort" : 10,
            "currentPriceFlag" : null,
            "laborFee" : "0",
            "id" : 46106,
            "locationGroupId" : null
         },
         {
            "recurringFee" : "290",
            "setupFee" : "0",
            "quantity" : null,
            "packageReferences" : [
               {
                  "packageId" : 240,
                  "id" : 383598,
                  "itemPriceId" : 45364
               }
            ],
            "onSaleFlag" : null,
            "oneTimeFee" : "0",
            "itemId" : 5146,
            "sort" : 10,
            "currentPriceFlag" : null,
            "laborFee" : "0",
            "id" : 45364,
            "locationGroupId" : null
         },
         {
            "recurringFee" : "362.5",
            "setupFee" : "0",
            "quantity" : null,
            "packageReferences" : [
               {
                  "packageId" : 240,
                  "id" : 386841,
                  "itemPriceId" : 46635
               }
            ],
            "onSaleFlag" : null,
            "oneTimeFee" : "0",
            "itemId" : 5146,
            "sort" : 10,
            "currentPriceFlag" : null,
            "laborFee" : "0",
            "id" : 46635,
            "locationGroupId" : null
         },
         {
            "recurringFee" : "435",
            "setupFee" : "0",
            "quantity" : null,
            "packageReferences" : [
               {
                  "packageId" : 240,
                  "id" : 385816,
                  "itemPriceId" : 46116
               }
            ],
            "onSaleFlag" : null,
            "oneTimeFee" : "0",
            "itemId" : 5146,
            "sort" : 10,
            "currentPriceFlag" : null,
            "laborFee" : "0",
            "id" : 46116,
            "locationGroupId" : null
         },
         {
            "recurringFee" : "580",
            "setupFee" : "0",
            "quantity" : null,
            "packageReferences" : [
               {
                  "packageId" : 240,
                  "id" : 383608,
                  "itemPriceId" : 45374
               }
            ],
            "onSaleFlag" : null,
            "oneTimeFee" : "0",
            "itemId" : 5146,
            "sort" : 10,
            "currentPriceFlag" : null,
            "laborFee" : "0",
            "id" : 45374,
            "locationGroupId" : null
         },
         {
            "recurringFee" : "580",
            "setupFee" : "0",
            "quantity" : null,
            "packageReferences" : [
               {
                  "packageId" : 240,
                  "id" : 1302339,
                  "itemPriceId" : 183991
               }
            ],
            "onSaleFlag" : null,
            "oneTimeFee" : "0",
            "itemId" : 5146,
            "sort" : 10,
            "currentPriceFlag" : null,
            "laborFee" : "0",
            "id" : 183991,
            "locationGroupId" : null
         },
         {
            "recurringFee" : "725",
            "setupFee" : "0",
            "quantity" : null,
            "packageReferences" : [
               {
                  "packageId" : 240,
                  "id" : 386851,
                  "itemPriceId" : 46645
               }
            ],
            "onSaleFlag" : null,
            "oneTimeFee" : "0",
            "itemId" : 5146,
            "sort" : 10,
            "currentPriceFlag" : null,
            "laborFee" : "0",
            "id" : 46645,
            "locationGroupId" : null
         },
         {
            "recurringFee" : "1015",
            "setupFee" : "0",
            "quantity" : null,
            "packageReferences" : [
               {
                  "packageId" : 240,
                  "id" : 383618,
                  "itemPriceId" : 45384
               }
            ],
            "onSaleFlag" : null,
            "oneTimeFee" : "0",
            "itemId" : 5146,
            "sort" : 10,
            "currentPriceFlag" : null,
            "laborFee" : "0",
            "id" : 45384,
            "locationGroupId" : null
         },
         {
            "recurringFee" : "1450",
            "setupFee" : "0",
            "quantity" : null,
            "packageReferences" : [
               {
                  "packageId" : 240,
                  "id" : 1300099,
                  "itemPriceId" : 181751
               }
            ],
            "onSaleFlag" : null,
            "oneTimeFee" : "0",
            "itemId" : 5146,
            "sort" : 10,
            "currentPriceFlag" : null,
            "laborFee" : "0",
            "id" : 181751,
            "locationGroupId" : null
         },
         {
            "recurringFee" : "1682",
            "setupFee" : "0",
            "quantity" : null,
            "packageReferences" : [
               {
                  "packageId" : 240,
                  "id" : 1295927,
                  "itemPriceId" : 178645
               }
            ],
            "onSaleFlag" : null,
            "oneTimeFee" : "0",
            "itemId" : 5146,
            "sort" : 10,
            "currentPriceFlag" : null,
            "laborFee" : "0",
            "id" : 178645,
            "locationGroupId" : null
         }
      ],
      "units" : "GB"
   },
...

For this item, "4000_GB_PERFORMANCE_STORAGE_SPACE", there are multiple price ids that have a locationGroupId of undefined. The only thing I can see as different are the recurringFee value. I don't understand which of these prices objects to choose. It seems I should just choose the cheapest one, but I assume there is some other difference, but I don't know what it is. Any help would be appreciated.

回答1:

Those prices have different categories, for example they can be:

  • Performance Storage Replication
  • Storage Snapshot Space
  • Storage Space
  • Storage Replication

You need to use the price according the order that you would like to placed, also you need to consider the capacity for these prices (capacityRestrictionMaximum and capacityRestrictionMinimum properties)

To get this kind information, you need to add a mask like the below rest request:

https://api.softlayer.com/rest/v3/SoftLayer_Product_Package/240/getItems.json?objectFilter={"items":{"prices":{"locationGroupId":{"operation":"is null"}}}}&objectMask=mask[prices[categories]]

Method: Get

Encoding:

https://api.softlayer.com/rest/v3/SoftLayer_Product_Package/240/getItems.json?objectFilter=%7B%22items%22%3A%7B%22prices%22%3A%7B%22locationGroupId%22%3A%7B%22operation%22%3A%22is+null%22%7D%7D%7D%7D&objectMask=mask%5Bprices%5Bcategories%5D%5D

Method: Get

References:

  • API for Performance and Endurance storage(Block storage)