Skip to content

API Issues Gotchas Wishlist

Scott Brightwell edited this page Jun 3, 2016 · 5 revisions

Things with the API that you wish you knew sooner:

  • check for 'message' prior to using results from the api

      if 'message' in symmetrix_list_response:
      # Unisphere returns a key called 'message' in a dict when no results found
      # you can get the value of 'message' and print it to see what the issue is
      message = symmetrix_list_response.get('message')
    
  • sometimes results that can only be a single value are returned in a list. you have to reference the result_list[0] to get at the data dict you're looking for

  • to figure out how to reference the particular key-value elements of the result you're given by the API, you'll have to read the api docs or experiment with periodically printing the results. Use a provided call (as in the example) vmax_api.rest.printJSON(result_of_api_call) to output a nicely formatted data structure. You'll have to reference the result result_of_api_call[0]['symmetrixId'] in sometimes funky ways to get the data you're after.

Wish List

  1. I'm looking for references to subscription rates. Anyone found reference to querying subscribed capacity in the API?
Clone this wiki locally