softlayer - Soflayer Billing API using Ruby- Extracting per user billing details -
have question softlayer billing api. when try run api code extract data object mask receive error below:
/library/ruby/gems/2.0.0/gems/softlayer_api-3.2.1/lib/softlayer/apiparameterfilter.rb:82:in object_mask': object_mask expects strings (argumenterror) /library/ruby/gems/2.0.0/gems/softlayer_api-3.2.1/lib/softlayer/service.rb:156:in
object_mask' testauthentication_old.rb:53:in `'
require 'softlayer_api' require 'pp' user_id = "your user id" api_key = "your api key" object_mask = {"orderitem" => {"order" => {"userrecord" => {"username" => ""}}}, "invoiceitem" => {"totalrecurringamount" => ""}} billing = softlayer::service.new("softlayer_account",:username => user_id,:api_key => api_key) user_bill=billing.object_mask(object_mask).getnextinvoicetoplevelbillingitems pp user_bill item in user_bill if item.key?("orderitem") && item["orderitem"]["order"]["userrecord"]["username"] == "" pp("user " + "" + " has invoice item of " + item["invoiceitem"]["totalrecurringamount"].to_s()) end`
the authentication worked okay somehow complaining of object mask. can please provide insight. in different post on softlayer there mention in changing billing apis. if so, need define object mask differently? can please let me know? appreciated.
it seems softlayer api ruby expecting string in object_mask , not object shows in example specified here.
anyway, try mask please:
object_mask = "mask[orderitem[order[userrecord[username]]], invoiceitem[totalrecurringamount]]" billing = softlayer::service.new("softlayer_account",:username => user_id,:api_key => api_key) user_bill=billing.object_mask(object_mask).getnextinvoicetoplevelbillingitems
i let know if other masks (object type) not longer supported client.
Comments
Post a Comment