Search code examples
pythonibm-cloud-infrastructure

Internal Server Error when get the tags of the virtual guest


The API is returning Internal Server Error when I try to get the tags of the virtual guests of a customer account.

Code example using the SoftLayer API library:

api = SoftLayer.Client(username=customer_id, api_key=customer_apikey)
api['Account'].getVirtualGuests(mask='fullyQualifiedDomainName,tagReferences.tag.name')

The exception is:

File "scripts/getting_tags.py", line 16, in <module>
  for item in func(mask='fullyQualifiedDomainName,tagReferences.tag.name'):
File "/home/mfilipe/workspace/SoftLayerBilling/venv/lib/python2.7/site-packages/SoftLayer/API.py", line 362, in call_handler
  return self(name, *args, **kwargs)
File "/home/mfilipe/workspace/SoftLayerBilling/venv/lib/python2.7/site-packages/SoftLayer/API.py", line 330, in call
  return self.client.call(self.name, name, *args, **kwargs)
File "/home/mfilipe/workspace/SoftLayerBilling/venv/lib/python2.7/site-packages/SoftLayer/API.py", line 226, in call
  return self.transport(request)
File "/home/mfilipe/workspace/SoftLayerBilling/venv/lib/python2.7/site-packages/SoftLayer/transports.py", line 162, in __call__
  raise exceptions.TransportError(ex.response.status_code, str(ex))
SoftLayer.exceptions.TransportError: TransportError(500): 500 Server Error: Internal Server Error

Couple months ago that API call was working properly. When I execute the same call for the hardware (api['Account'].getHardware) or remove tagReferences from mask, it works.


Solution

  • it looks like an error because the reponse contains a big amount of data try to add limits in your request:

    api = SoftLayer.Client(username=customer_id, api_key=customer_apikey)
    api['Account'].getVirtualGuests(mask='fullyQualifiedDomainName,tagReferences.tag.name',limit=10, offset=0)
    

    for more information about limits see:

    http://softlayer-api-python-client.readthedocs.io/en/latest/api/client/

    Regards