Creating a user profile with SoftLayer_User_Custom

2019-08-21 02:29发布

问题:

I am trying to create a new user profile and the JSON fields passed in are ignored.

The following is the URL with method POST

https://api.softlayer.com/rest/v3/SoftLayer_User_Customer.json

The JSON payload is:

{
"parameters" : [
    {
      "address1" : "1101 Kitchawan Road",
      "city" : "Yorktown Heights",
      "companyName" : "IBM - www Account",
      "state" : "NY",
      "country" : "US",
      "postalCode" : "10598",
      "firstName" : "hello",
      "lastName" : "thisguy",
      "email" : "thisguy@nn.ibm.com",
      "permissionSystemVersion" : "1",
      "timezoneId" : "117",
      "username" : "286900_thisguy@nn.ibm.com",
      "secondaryPasswordTimeoutDays" : 90,
      "managedByOpenIdConnectFlag" : false,
      "userStatusId" : 1001,
      "sslVpnAllowedFlag" : true
   },
  "xxxxxxxx!",
  "xxxxxxxx!"
 ]
}

The JSON returned from the create is:

      'userStatusId' => 1001,
      'timezoneId' => 117,
      'accountId' => 286900,
      'statusDate' => undef,
      'userLinks' => [],
      'locale' => {
                    'friendlyName' => 'English',
                    'name' => 'English',
                    'id' => 1,
                    'languageTag' => 'en-US'
                  },
      'state' => 'NY',
      'secondaryLoginRequiredFlag' => undef,
      'msn' => '',
      'managedByOpenIdConnectFlag' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ),
      'email' => 'thisguy@nn.ibm.com',
      'permissionSystemVersion' => 2,
      'vpnManualConfig' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
      'id' => 6713227,
      'secondaryPasswordTimeoutDays' => 0,
      'yahoo' => '',
      'denyAllResourceAccessOnCreateFlag' => $VAR1->{'vpnManualConfig'},
      'secondaryLoginManagementFlag' => undef,
      'localeId' => 1,
      'firstName' => hello',
      'timezone' => {
                      'longName' => '(GMT-05:00) America/New York - EST',
                      'name' => 'America/New_York',
                      'id' => 117,
                      'shortName' => 'EST',
                      'offset' => '-0500'
                    },
      'sslVpnAllowedFlag' => $VAR1->{'vpnManualConfig'},
      'companyName' => 'IBM - www Account',
      'isMasterUserFlag' => $VAR1->{'vpnManualConfig'},
      'username' => '286900_thisguy@nn.ibm.com',
      'pptpVpnAllowedFlag' => $VAR1->{'vpnManualConfig'},
      'userStatus' => {
                        'name' => 'Active',
                        'id' => 1001,
                        'keyName' => 'ACTIVE'
                      },
      'passwordExpireDate' => undef,
      'address1' => '1101 Kitchawan Road',
      'sms' => '',
      'daylightSavingsTimeFlag' => $VAR1->{'vpnManualConfig'},
      'officePhone' => '',
      'city' => 'Yorktown Heights',
      'icq' => '',
      'createDate' => '2017-06-06T08:46:54-04:00',
      'savedId' => '6713227',
      'lastName' => 'thisguy',
      'displayName' => 'CarlosF',
      'secondaryPasswordModifyDate' => '2017-06-06T08:46:55-04:00',
      'country' => 'US',
      'modifyDate' => '2017-06-06T08:46:55-04:00',
      'alternatePhone' => '',
      'forumPasswordHash' => '._staIj7diist1',
      'aim' => '',
      'managedByFederationFlag' => $VAR1->{'vpnManualConfig'},
      'address2' => '',
      'parentId' => 151785,
      'postalCode' => '10598'
    };

This all looks good, except for the fiedl 'displayName'

I now issue the URL with a GET request:

https://api.softlayer.com/rest/v3/SoftLayer_Account/getUsers/6713227.json?objectMask=mask[virtualGuestCount,virtualGuests.id,virtualGuests.hostname,virtualGuests.status,hardwareCount,hardware.id,hardware.hostname,hardware.hardwareStatus,userStatus,apiAuthenticationKeyCount,apiAuthenticationKeys,loginAttemptCount,successfulLoginCount,unsuccessfulLoginCount]

The JSON payload returned is:

'userStatusId' => 1001,
'timezoneId' => 113,
'accountId' => 286900,
'permissions' => [
]
'state' => 'NY',
'secondaryLoginRequiredFlag' => undef,
'managedByOpenIdConnectFlag' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ),
'email' => 'thisguy@nn.ibm.com',
'actionCount' => 25,
'permissionSystemVersion' => 2,
'vpnManualConfig' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
'id' => 6713227,
'secondaryPasswordTimeoutDays' => 0,
'denyAllResourceAccessOnCreateFlag' => $VAR1->{'vpnManualConfig'},
'secondaryLoginManagementFlag' => undef,
'firstName' => 'hello',
'localeId' => 1,
'parent' => { 
]
'timezone' => {
     'longName' => '(GMT-06:00) America/Chicago - CST',
     'name' => 'America/Chicago',
     'id' => 113,
     'shortName' => 'CST',
     'offset' => '-0600'
    },
'sslVpnAllowedFlag' => $VAR1->{'vpnManualConfig'},
'companyName' => 'IBM - www Account',
'isMasterUserFlag' => $VAR1->{'vpnManualConfig'},
'username' => '286900_thisguy@us.ibm.com',
'pptpVpnAllowedFlag' => $VAR1->{'vpnManualConfig'},
'userStatus' => {
                        'name' => 'Active',
                        'id' => 1001,
                        'keyName' => 'ACTIVE'
                      },
 'apiAuthenticationKeys' => [
 ]
 'passwordExpireDate' => undef,
 'loginAttemptCount' => 0,
 'address1' => '2455 South Rd',
 'openIdConnectUserName' => 'thisguy@nn.ibm.com',
 'actions' => [
 ]
 'daylightSavingsTimeFlag' => $VAR1->{'vpnManualConfig'},
      'unsuccessfulLoginCount' => 0,
      'successfulLoginCount' => 0,
      'city' => 'Poughkeepsie',
      'createDate' => '2017-06-06T08:46:54-04:00',
      'savedId' => '6713227',
      'lastName' => 'thisguy',
      'displayName' => 'hellog',
      'country' => 'US',
      'secondaryPasswordModifyDate' => '2017-06-06T08:46:55-04:00',
      'modifyDate' => '2017-06-06T08:46:55-04:00',
      'apiAuthenticationKeyCount' => 1,
      'forumPasswordHash' => '._staIj7diist1',
      'managedByFederationFlag' => $VAR1->{'vpnManualConfig'},
      'parentId' => 151785,
      'postalCode' => '12601-5400'

    }

Notice that th4e address is not the same as returned from the create and the timezone is wrong. The create ignored certain fields passed in on the create.

回答1:

This is an issue for accounts with bluemix and it is already reported. Some values like address and time zone are saved with data of master account.

You can try to update/change those values by editing the user with the method SoftLayer_User_Customer::editObject.

Also you can submit a ticket in order to get further assistance with this bug.

About displayName

If you don't set this value in the JSON request, it is automatically set with the firstName and first character of lastName.