简体   繁体   English

使用REST API在SoftLayer中创建门户网站用户

[英]Creating Portal Users in SoftLayer using REST API

I am trying to make REST API call to create an account on the SoftLayer platform. 我正在尝试进行REST API调用,以在SoftLayer平台上创建一个帐户。 However, it keeps returning the following message even I have provided value for email: 但是,即使我为电子邮件提供了价值,它也会一直返回以下消息:

{"error":"Missing email address.","code":"SoftLayer_Exception_Public"} {“错误”:“缺少电子邮件地址。”,“代码”:“ SoftLayer_Exception_Public”}

I am trying to execute the following method: 我正在尝试执行以下方法:
http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer/createObject http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer/createObject

I am using curl to setup the POST REST call like the following: 我正在使用curl来设置POST REST调用,如下所示:

curl -H "Content-Type: application/json" --data @User-Account-Create.json https://<USER>:<API_KEY>@api.softlayer.com/rest/v3/SoftLayer_User_Customer/createObject

The content of User-account-Create.json is the following: User-account-Create.json的内容如下:

{
"parameters" : [
    {
            "email": "user@server.com",
            "address1": "address1",
            "city": "Toronto",
            "companyName": "Company",
            "country": "CA",
            "firstName": "Dickson",
            "lastName": "Fu",
            "secondaryLoginManagementFlag": true,
            "managedByOpenIdConnectFlag": true,
            "openIdConnectUserName" : "user@server.com",
            "permissionSystemVersion": 0,
            "timezoneId": 8,
            "username" : "user@server.com",
            "userStatusId": 0
    }
]

} }

BTW, I can't find references to values that can be set on "permrissionSystemVersion", "timezoneId" and "userStatusId" attributes. 顺便说一句,我找不到对可以在“ permrissionSystemVersion”,“ timezoneId”和“ userStatusId”属性上设置的值的引用。 If anyone can point me to them, it would be great. 如果有人可以将我指向他们,那太好了。

Thanks 谢谢

To get timezone identifiers: 要获取时区标识符:

curl -H "Content-Type: application/json" https://<USER>:<API_KEY>@api.softlayer.com/rest/v3/SoftLayer_Locale_Timezone/getAllObjects

To get user status identifiers: 获取用户状态标识符:

curl -H "Content-Type: application/json" https://<USER>:<API_KEY>@api.softlayer.com/rest/v3/SoftLayer_User_Customer_Status/getAllObjects

Regarding to: permissionSystemVersion , it's not necessary to send this property, it will be automaticaly filled with value: 2 关于: PermissionSystemVersion ,不必发送此属性,它将自动填充值:2

If you would like to add permissions to the user, you need to use the following method: 如果要向用户添加权限,则需要使用以下方法:

This is an example of template that it's working fine: 这是模板的示例,它可以正常工作:

{
"parameters" : [
    {
            "email": "user4@server.com",
            "address1": "address1",
            "city": "Toronto",
            "companyName": "Company",
            "country": "CA",
            "firstName": "Dickson",
            "lastName": "Fu",
            "secondaryLoginManagementFlag": true,
            "managedByOpenIdConnectFlag": true,
            "openIdConnectUserName" : "user@server.com",
            "timezoneId": 117,
            "username" : "user4@server.com",
            "userStatusId": 1001
    }
]
}

Please try it and let me know your results or if you need further assistance 请尝试一下,让我知道您的结果,或者如果您需要进一步的帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM