使用SoftLayer_User_Customer REST API创建用户配置文件

时间:2017-06-06 14:36:14

标签: ibm-cloud-infrastructure

我正在尝试创建新的用户配置文件,并且忽略传入的JSON字段。

以下是方法POST

的网址
https://api.softlayer.com/rest/v3/SoftLayer_User_Customer.json

JSON有效负载是:

{
"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!"
 ]
}

从create返回的JSON是:

      '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'
    };

除了fiedl'displayName'

外,这一切看起来都不错

我现在发出带有GET请求的网址:

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]

返回的JSON有效负载是:

'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'

    }

请注意,th4e地址与create返回的地址不同,时区错误。创建忽略了在create上传入的某些字段。

1 个答案:

答案 0 :(得分:0)

对于使用bluemix的帐户,这是一个问题,并且已经报告过。地址和时区等某些值与主帐户数据一起保存。

您可以尝试使用方法SoftLayer_User_Customer::editObject编辑用户来更新/更改这些值。

您也可以提交一张票,以便获得有关此错误的进一步帮助。

关于displayName

如果您未在JSON请求中设置此值,则会使用firstName和lastName的第一个字符自动设置该值。