当我发送GET https://api.softlayer.com/rest/v3/SoftLayer_Account
时,返回我的SoftLayer_Account数据:
<root>
<accountManagedResourcesFlag/>
<accountStatusId></accountStatusId>
<address1></address1>
<address2></address2>
<allowedPptpVpnQuantity></allowedPptpVpnQuantity>
<city></city>
<claimedTaxExemptTxFlag/>
<companyName></companyName>
<country></country>
<createDate></createDate>
<email></email>
<firstName></firstName>
<id></id>
<isReseller></isReseller>
<lastName></lastName>
<lateFeeProtectionFlag/>
<modifyDate></modifyDate>
<officePhone></officePhone>
<postalCode></postalCode>
<state></state>
<statusDate/>
</root>
有没有办法使用API更改我的帐户资料?
通过control.softlayer.com,我可以发送一些“配置文件更改请求”,有没有办法通过API发送此请求(并在请求被批准/拒绝时跟进)?
我已经尝试找到解决方案:
在http://sldn.softlayer.com/reference/services/SoftLayer_Account上查找了一些相关方法,找不到任何内容。
我试图用这些数据得到一些对象,所以我可以看到对象类型和操作
#getAddresses
#getActiveAddresses
但没有人返回一个我可以操作的对象(调用方法)
(我确实认为如果帐号上的数据与之相关联,则应在#getAddresses
上返回此地址)
谢谢
答案 0 :(得分:1)
要更新帐户个人资料,我们需要使用SoftLayer_Ticket::createAdministrativeTicket
查看:强>
http://sldn.softlayer.com/reference/services/SoftLayer_Ticket/createAdministrativeTicket
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://api.service.softlayer.com/soap/v3/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<SoftLayer_ObjectMask xsi:type="v3:SoftLayer_ObjectMask">
<mask xsi:type="xsd:string">1</mask>
</SoftLayer_ObjectMask>
<SoftLayer_TicketObjectMask xsi:type="v3:SoftLayer_TicketObjectMask">
<mask xsi:type="v3:SoftLayer_Ticket" />
</SoftLayer_TicketObjectMask>
<authenticate xsi:type="v3:authenticate">
<username xsi:type="xsd:string">?</username>
<apiKey xsi:type="xsd:string">?</apiKey>
</authenticate>
</soapenv:Header>
<soapenv:Body>
<v3:createAdministrativeTicket soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<templateObject xsi:type="v3:SoftLayer_Ticket">
<assignedUserId xsi:type="xsd:int">12345</assignedUserId>
<notifyUserOnUpdateFlag xsi:type="xsd:boolean">true</notifyUserOnUpdateFlag>
<title xsi:type="xsd:string">Account Profile Update Request</title>
</templateObject>
<contents xsi:type="xsd:string">address1: "Address Edited"
address2: "newAddress2"
city: "cityEdited"
companyName: "My Company"
country: "BR"
email: "mynewemail@softlayer.com"
faxPhone: ""
firstName: "EditedName"
lastName: "Last Name"
officePhone: "123456789"
postalCode: "11111-2222"</contents>
<rootPassword xsi:type="xsd:string">TestPassword</rootPassword>
<controlPanelPassword xsi:type="xsd:string">TestPassword</controlPanelPassword>
<accessPort xsi:type="xsd:string">22</accessPort>
<attachedFiles xsi:type="v3:SoftLayer_Container_Utility_File_AttachmentArray" />
</v3:createAdministrativeTicket>
</soapenv:Body>
</soapenv:Envelope>
如何获取“assignedUserId”?
使用:强>
https://api.softlayer.com/rest/v3/SoftLayer_Account/getMasterUser
<强>参考文献:强>
http://sldn.softlayer.com/reference/services/SoftLayer_Ticket/createAdministrativeTicket http://sldn.softlayer.com/reference/services/SoftLayer_Account/getMasterUser
<强> URL:强>
https:// [用户名]:[apikey] @ api.softlayer.com / rest / v3 / SoftLayer_Ticket / createAdministrativeTicket
方法: POST
Json(有效负载):
{
"parameters": [
{
"assignedUserId": 12345,
"title": "Account Profile Update Request"
},
"Request generated via API\nCompany Name: myComanyName\nFirst Name: nameEdited\nLast Name: LastNameEdited\nEmail: mynewemail@softlayer.com \nPrimary Phone: 21478270366\nSecondary Phone: \nStreet Address 1: myAddressEdited\nStreet Address 2: \nCity: newCity\nCountry: US\nState: CA\nPostal Code: 111-222\n"
]
}