0
votes

I am verifying order using the below REST Call in Mozilla Poster

https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Product_Order/verifyOrder

and the jSON payload for this call is:-

      {
      "parameters": [
         {
         "location": 138124,  
         "packageId": 240,
         "osFormatType": {
         "id": 12,
         "keyName": "LINUX"
         },
         "complexType": 
           SoftLayer_Container_Product_Order_Network_Storage_Enterprise",
         "prices": [
         {
          "id": 45064   # Endurance Storage
         },
         {
          "id": 45104   # Bloack Storage
         },
         {
          "id": 45074   # 0.25 IOPS/GB
         },
         {
          "id": 45354   # 100 GB Storage space
         },
         {
          "id": 6028    # 5 GB Snapshot space
         }
         ],
         "quantity": 1
        }
         ]
        }

Call used for snap shot space is :-

   https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/240/getItemPrices?objectFilter={%22itemPrices%22: {%22categories%22: {%22categoryCode%22: {%22operation%22: %22storage_snapshot_space%22}}}}

But still I am facing issue. Error I got is 500 Internal Server Error.

Please assist me in same. Thanks in Advance

1
mmm, the error 500 suggest that your request has a worng format, just in case did you remove the comments from the json? (e.g # Bloack Storage). Make sure that your json has the correct format, you can use this validator jsonlint.com . Then you need to make sure that the prices are the correct. - Nelson Raul Cabero Mendoza
@NelsonRaulCaberoMendoza I have removed comments also. Let me validate with jsonlint.com - Ravi Dutt
@NelsonRaulCaberoMendoza I validated it with jsonlint.com and result for same is Valid Json - Ravi Dutt
Also make sure that your user has the enough permisions to make orders. it is better if you first try with the master user of the account in order to avoid a permission issue. - Nelson Raul Cabero Mendoza
@NelsonRaulCaberoMendoza thanks for your support. It was permission issue and worked with different credentials successfully. One more question from my side:- How will I be able to delete the created storages that are not attached to any VM through rest call... ? - Ravi Dutt

1 Answers

0
votes

There were some mistakes in your template:

  1. The start quote (") for "SoftLayer_Container_Product_Order_Network_Storage_Enterprise" value is missing.
  2. The item price: "45354" refers to : "2000 GB Storage Space"
  3. The id: "6028" refers to "itemId". You should specify the "price identifier" ("id" property using SoftLayer_Product_Package::getItemPrices) instead of "itemId"

Try this template:

{  
   "parameters":[  
      {  
         "location":138124,
         "packageId":240,
         "osFormatType":{  
            "id":12,
            "keyName":"LINUX"
         },
         "complexType":"SoftLayer_Container_Product_Order_Network_Storage_Enterprise",
         "prices":[  
            {  
               "id":45064  # Endurance Storage
            },
            {  
               "id":45104  # Block Storage
            },
            {  
               "id":45074  # 0.25 IOPS/GB  
            },
            {  
               "id":45214  # 100 GB Storage space
            },
            {  
               "id":46126  # 5 GB Snapshot space
            }
         ],
         "quantity":1
      }
   ]
}

Some important references: