0

I am a beginner to softlayer and trying to implement block storage functionality. I got the Locations on the basis of selected Storage Type using below mentioned rest call:-

URL:-

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Package/240/getRegions.json?objectMask=mask[priceGroups[id, name]] 

GET

As I locations data successfully but based on the any of the selected values Now I need to make another rest call for getting Storage Sizes available at that selected location. I used below URL to make this requirement fulfil:-

URL :-

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Package/240/getItems?objectMask=mask[id,description,prices[pricingLocationGroup[locations]],categories]&objectFilter={"items":{"prices":{"pricingLocationGroup":{"locations":{"name":{"operation":"hkg02"}}}}}}

GET

Here code used for location is hkg02. I need to have available Storage Sizes for selected Storage Type and location. I Need to filter above URL to get Storage sizes only. As we are getting redundant data as well. What will be required filter for this.

Please make a needful favour. Thanks in advance.

Ravi Dutt
  • 135
  • 2
  • 4
  • 16
  • 1
    It would be a good idea to remove your 'API credentials' because it is a sensitive data and this is a public forum (at least your 'apikey' could be removed) :). Regards. – mcruz Feb 26 '16 at 18:10
  • As a beginner I think better you start reading documentation see http://sldn.softlayer.com/blog/cmporter/location-based-pricing-and-you there is the answer you are looking for. Also see http://sldn.softlayer.com/blog/bpotter/Going-Further-SoftLayer-API-Python-Client-Part-3 in order to understand how to order – Nelson Raul Cabero Mendoza Feb 26 '16 at 18:47

1 Answers1

0

You can add some properties in your “object filter”, for example:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Product_Package/240/getItems?objectMask=mask[id,description,prices[pricingLocationGroup[locations]],categories]&objectFilter={   "items": {     "prices": {       "pricingLocationGroup": {         "locations": {           "name": {             "operation": "hkg02"           }         }       }     },     "categories": {       "categoryCode": {         "operation": "performance_storage_space"       }     }   } }

Method: GET

Below is a list of filter operators that can help you:

OBJECT_FILTER_OPERATORS = 

[   '*=',   # Contains (ignoring case)
    '^=',   # Begins with (ignoring case)
    '$=',   # Ends with (ignoring_case)
    '_=',   # Matches (ignoring case)
    '!=',   # Is not Equal To (case sensitive)
    '<=',   # Less than or Equal To (case sensitive)
    '>=',   # Greater than or Equal To (case sensitive)
    '<',    # Less Than (case sensitive)
    '>',    # Greater Than (case sensitive)
    '~',    # Contains (case sensitive)
    '!~'    # Does not Contain (case sensitive)
  ]

References may help you: Using object filters with SoftLayer Ruby API

Community
  • 1
  • 1
mcruz
  • 1,534
  • 2
  • 11
  • 14