MS6
MS6

Reputation: 3

Softlayer Python API:multiple local properties of billing item are not returned

Calling the billing_Item Python API, a billing_item is returned BUT a lot of (interesting) local properties are not returned. The local properties of my interest all have to do with uptime and fees (e.g. laborFee, oneTimeFee, hoursUsed, recurringFee, ...), but they are not returned.

What I do:

import SoftLayer

conn = SoftLayer.create_client_from_env(username='',api_key='')

allParents = conn.call('Account','getAllTopLevelBillingItems') #allParents is a list with billing_Items

allParents[0] # returns the first billing_Item as a dict but without a lot of relevant parameters

Also, the children billing items of each parent billing item lack a lot of local properties.

Upvotes: 0

Views: 116

Answers (2)

mcruz
mcruz

Reputation: 1532

The below python script displays the local properties that you need. Also, if your script doesn't return the properties that you need, please apply object masks, like this example:

import SoftLayer
# For nice debug output:
from pprint import pprint as pp

apiUsername = 'set me'
apiKey = 'set me'

client = SoftLayer.Client(
    username=apiUsername,
    api_key=apiKey
)

objectMask = 'mask[id,laborFee,oneTimeFee,recurringFee]'

try:
    result = client['SoftLayer_Account'].getAllTopLevelBillingItems(mask=objectMask)
    pp(result)
except Exception as e:
    pp('Failed ............', e)

I hope it helps you.

Upvotes: 1

This may be an issue with your account. I suggest you try a simple Rest Call like this:

https://$Username:[email protected]/rest/v3.1/SoftLayer_Account/getAllTopLevelBillingItems
Repalce $Username and $Apikey

If you get the same issue. Report it by opening a ticket in the Softlayer´s Portal in order the Softlayer guys take a look at this

Upvotes: 0

Related Questions