0
votes

When I send a GET https://api.softlayer.com/rest/v3/SoftLayer_Account returns my SoftLayer_Account data:

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

Is there any way to change my Account profile using the API?

Via control.softlayer.com, I can send kind of "request for profile change", is there any way to send this request via API (and follow up when request was approved/denied)?

What I already did trying to find a solution:

  1. Looked up for some related method on http://sldn.softlayer.com/reference/services/SoftLayer_Account, nothing was found.

  2. I tried to get some object with this data, so I could see the object type and manipulate

    • #getAddresses
    • #getActiveAddresses

but none returned a Object I could manipulate (call methods on)

  1. Is there http://sldn.softlayer.com/reference/services/SoftLayer_Account_Address but seems I need to create one, what I want is change the existing data

(I do really believe that this address should be returned on #getAddresses if data on Account was linked to it)

Thank you

1

1 Answers

1
votes

To update the Account profile, we need to create a Request Profile Update using SoftLayer_Ticket::createAdministrativeTicket

See:

http ://sldn.softlayer.com/reference/services/SoftLayer_Ticket/createAdministrativeTicket

SOAP example:

<?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: "[email protected]"
                                                    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>

How to get the “assignedUserId”?

Use:

https ://api.softlayer.com/rest/v3/SoftLayer_Account/getMasterUser

References:

http://sldn.softlayer.com/reference/services/SoftLayer_Ticket/createAdministrativeTicket http://sldn.softlayer.com/reference/services/SoftLayer_Account/getMasterUser

REST example:

URL:

https ://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Ticket/createAdministrativeTicket

Method: POST

Json (payload):

{
    "parameters": [
        {
            "assignedUserId": 12345,
            "title": "Account Profile Update Request"
        },
        "Request generated via API\nCompany Name: myComanyName\nFirst Name: nameEdited\nLast Name: LastNameEdited\nEmail: [email protected] \nPrimary Phone: 21478270366\nSecondary Phone: \nStreet Address 1: myAddressEdited\nStreet Address 2: \nCity: newCity\nCountry: US\nState: CA\nPostal Code: 111-222\n"
    ]
}