0

I have an '@' in my user id "12345_name@company.com" , this when passed in the Rest Call is causing the error "Softlayer Access Denied" .

{ "error": "Access Denied. ", "code": "SoftLayer_Exception_Public"

}

Please suggest ways to get around this. Can we use an Alias instead of the "12345_name@company.com" user if.

Below is the Rest call I am trying to make.

https://12345_name@company.com:@api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests.json?objectMask=mask[hostname;domain;id;startCpus;maxCpuUnits;powerState;datacenter[name,longName];maxMemory;powerState;createDate;hourlyBillingFlag;averageDailyPublicBandwidthUsage;billingItem[id,item[id,description],category[name,id],children[id,item[id,description],category[id,name]]];networkComponents[status,ipAddressBindings.ipAddress,id,networkId,primaryIpAddress,port,maxSpeed];networkVlans[subnets[networkIdentifier,networkVlan.primaryRouter.hostname,cidr,gateway,id,netmask,addressSpace,networkVlanId,routingTypeName]]]

Raj
  • 1

2 Answers2

0

It seems that depends on the REST client that you are using, using Insonmia REST client or Chrome I did not get any issue.

try encoding the characters @ like this:

As your user id has an special character, the ‘@’ on this case, you need to use the URL encoding as following:

                 https://12345_name%40company.com:@api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests.json?objectMask........

Where %40 is the URL encoding of ‘@’.

Regards

0

Sometimes it's necessary to use "Basic Authentication" in order to avoid special characters, in that case, you need to encode your username and apiKey, for example:

  • username: 123123_ruber@softlayer.com
  • apiKey: 375f50232aaba2d002eca7bc5e9dc4f6a042a8a65982254df8

you need to encode:

  • username space apiKey
  • 123123_ruber@softlayer.com 375f50232aaba2d002eca7bc5e9dc4f6a042a8a65982254df8

A tool I can recommend for encoding: https://www.base64encode.org/

Here the example encoded:

MTIzMTIzX3J1YmVyQHNvZnRsYXllci5jb20gMzc1ZjUwMjMyYWFiYTJkMDAyZWNhN2JjNWU5ZGM0ZjZhMDQyYThhNjU5ODIyNTRkZjg=

It's necessary to add Basic word before the credentials encoded

Basic MTIzMTIzX3J1YmVyQHNvZnRsYXllci5jb20gMzc1ZjUwMjMyYWFiYTJkMDAyZWNhN2JjNWU5ZGM0ZjZhMDQyYThhNjU5ODIyNTRkZjg=

Then you can add "authorization" as a header like the following example (I used Advanced Rest Client for Chrome):

enter image description here