0
votes

I am trying to make REST API call to create an account on the SoftLayer platform. However, it keeps returning the following message even I have provided value for email:

{"error":"Missing email address.","code":"SoftLayer_Exception_Public"}

I am trying to execute the following method:
http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer/createObject

I am using curl to setup the POST REST call like the following:

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:

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

}

BTW, I can't find references to values that can be set on "permrissionSystemVersion", "timezoneId" and "userStatusId" attributes. If anyone can point me to them, it would be great.

Thanks

1

1 Answers

0
votes

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

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": "[email protected]",
            "address1": "address1",
            "city": "Toronto",
            "companyName": "Company",
            "country": "CA",
            "firstName": "Dickson",
            "lastName": "Fu",
            "secondaryLoginManagementFlag": true,
            "managedByOpenIdConnectFlag": true,
            "openIdConnectUserName" : "[email protected]",
            "timezoneId": 117,
            "username" : "[email protected]",
            "userStatusId": 1001
    }
]
}

Please try it and let me know your results or if you need further assistance