从Account.getVirtualGuests()获取500内部服务器错误 [英] Getting 500 Internal Server Error from Account.getVirtualGuests()
问题描述
在过去的一年半中,我一直在使用一种特殊的方法来从我们的帐户中加载虚拟访客.在过去一周的某个时间,它坏了.以下代码(使用ruby gem 3.1.1)返回500 Internal Server Error:
I have been using a particular method for the past year and a half for loading the virtual guests from our account. Sometime in the past week, it broken. The following code (using ruby gem 3.1.1) returns a 500 Internal Server Error:
softlayer_client = SoftLayer::Client.new()
obj_svc = softlayer_client['Account']
obj_svc = obj_svc.object_mask('mask[ id,tagReferences ]')
result = obj_svc.getVirtualGuests()
result.each do |pre_obj|
puts pre_obj.inspect
end
但这不是:
softlayer_client = SoftLayer::Client.new()
obj_svc = obj_svc.object_mask('mask[ id ]')
result = obj_svc.getVirtualGuests()
result.each do |pre_obj|
puts pre_obj.inspect
end
好像tagReferences最近被破坏了,因为它已经工作了很长时间了.
Seems like tagReferences was broken recently, since this has been working for a long time.
推荐答案
我已经检查了您的第一段代码,它可以正常工作.但是,您面临的问题可能是由于该方法返回的对象(虚拟访客或标记对象)的数量所致.如以下示例所示,可以使用result_limit(OFFSET,LIMIT)避免这种情况:
I've reviewed your first block of code and it works OK. Nevertheless, the problem that you're facing might be due to the number of objects that the method's returning, either virtual guests or tag objects. This can be avoided using a result_limit(OFFSET, LIMIT) as in the next example:
OFFSET = 0
LIMIT = 5
USERNAME = 'set me'
API_KEY = 'set me'
softlayer_client = SoftLayer::Client.new(username: USERNAME, api_key: API_KEY)
obj_svc = softlayer_client['Account']
obj_svc = obj_svc.object_mask('mask[ id,tagReferences ]')
obj_svc = obj_svc.result_limit(OFFSET, LIMIT)
result = obj_svc.getVirtualGuests()
result.each do |pre_obj|
puts pre_obj.inspect
end
如果不能解决问题,请尝试下载最新的softlayer ruby客户端gem(即3.2.1)
If it doesn't solve your problem, try downloading the latest softlayer ruby client gem (i.e. 3.2.1)
您也可以查看下一个链接:
You could review the next link as well:
https://sldn.softlayer.com/blog/phil/How-Solve-Error-fetching-http-headers
这篇关于从Account.getVirtualGuests()获取500内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!