-1

would like to know is it possible to get users who are allowed to access/login for a specific devices

it's not useful for me to get information for all my servers. i would like to know for some specific devices

please advice

donsar
  • 15
  • 2

1 Answers1

1

Try the following requests for Virtual Guests:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests?objectFilter={"virtualGuests":{"hostname":{"operation":"in","options":[{"name":"data","value":["vsi1","vsi2"]}]}}}&objectMask=mask[users]

Replace: $username, $apiKey and vsi1 and vsi2 with the vsi's hostnames

  • In this case the mask[users] mask will retrieve a lot of information and it can raise an issue due to the large set of data. See: How to Solve: Error fetching http headers, for that reason I recommend to use a mask like this: mask[users[id,username]]

To get users which has access for a specific BMS:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Account/getHardware?objectFilter={"hardware":{"hostname":{"operation":"in","options":[{"name":"data","value":["server1","server2","server3"]}]}}}&objectMask=users
  • Unfortunately, in this case it's not possible to get only id and username from users, it will retrieve a lot of set of information from the users

To get users for VSI/BMS through FQDN

I can recommend another alternative using rest, but you can only get devices (bms/vsi) which has a specific text in its fullyQualifiedDomainName, in this example I tried for servers with "testName", replace it for your requirements

https://$username:$apiKey@api.softlayer.com/rest/v3.1/SoftLayer_Search/advancedSearch?objectMask=mask[resource(SoftLayer_Hardware_Server)[id,datacenter,fullyQualifiedDomainName,users.id,users.username],resource(SoftLayer_Virtual_Guest)[id,datacenter,fullyQualifiedDomainName,users.id,users.username]]

Method: Post

{"parameters":["fullyQualifiedDomainName:testName _objectType:SoftLayer_Virtual_Guest,SoftLayer_Hardware _sort:[fullyQualifiedDomainName:asc]"]}

I hope it helps, let me know if you need further assistance or any doubt

References: