softlayer / softlayer-ruby

http://softlayer.github.io/softlayer-ruby/
MIT License
54 stars 35 forks source link

Retrieve "Assigned" Open Tickets via getOpenTickets Call #2

Closed gmcmillan closed 13 years ago

gmcmillan commented 13 years ago

Is there a way to retrieve all open tickets but include any tickets assigned to a Softlayer employee in that call? These assigned tickets show up in the Softlayer website portal as open/unresolved tickets but they are technically "assigned" so they aren't returned in the getOpenTickets call. Anyone using the getOpenTickets call is probably going to need to get the assigned ones also, or at the very least the hash should be modified so we can pick out which ones we want, like this:

"status"=>{"name"=>"Open", "id"=>1001}

"status"=>{"name"=>"Assigned", "id"=>1002} <= I think 1002 is the code

The status is inconsistent overall, if you do a getTickets call instead of getOpenTickets you don't even get the "status" returned, but instead you get a "statusId." There should be some consistency between these two calls.

softlayer commented 13 years ago

I wrote a short sample that grabs the list of open tickets for an account and that call retrieved all the open tickets, including those whose status was "Assigned" (those with a status ID of 1004). That sample was very basic:

softlayerAccount = SoftLayer::Service.new( "SoftLayer_Account", :username => 'username', :api_key => 'DEADBEEFBADF00D...')
pp softlayerAccount.getOpenTickets()

Changing the second line to filter out only the assigned tickets:

pp softlayerAccount.getOpenTickets().select { |ticket| ticket['statusId'] == 1004 }

Seems to work perfectly as well. I'm not seeing the problem that you are describing.

If you want the call to "getTickets" to return the full status record instead of just the statusID, then you can use an objectMask to add the status record to the result:

pp softlayerAccount.object_mask("status").getTickets()

I agree, however, that it would be nice if there were a single, consistent model returned for a "ticket" that could be enhanced by the caller (e.g. with object masks) as needed. I will enter an enhancement request into our tracking system.

If you wish to pursue this issue further, I recommend moving the discussion to the SoftLayer Forums at https://forums.softlayer.com/. If you do so, there will be a lot more folks who can look at the problem with you.

gmcmillan commented 13 years ago

Thanks for the quick response and glad to see an enhancement request was added!

I'd like to avoid having to pull all of our tickets (>17,000) via getTickets as it takes almost a minute to retrieve them via the API call.

Something is not working correctly. Using the getOpenTickets call is not retrieving "assigned" tickets which are also "open." Perhaps this is by design, so maybe a "getActiveTickets" call is needed for these situations so it will return tickets that are both open and open/assigned?

If I do the following:

softlayerAccount.getOpenTickets.each do |t|
  puts t['statusId']
end

Every ticket that is returned with the call above has a statusId of 1001, none of them are 1004. This is happening despite the fact that we do have several assigned active tickets right now showing on the Softlayer portal website (4 to be exact).