我有很多SL ID並想更改腳本中的密碼。這可能使用API嗎?任何樣品都表示讚賞。有沒有辦法爲多個Softlayer ID編寫腳本密碼更改?
回答
問題不明確。如果我是對的,你想改變賬戶的用戶密碼。我會爲您提供一些參考,可以幫助你:
首先要改變用戶的密碼,你可以用:
http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer/updatePassword
注:用戶只能更新自己的密碼。一個賬戶的 主用戶可以更新他們的任何賬戶用戶的密碼。正如我 不知道你用的是什麼語言,下面有使用我的帳戶的主用戶更新孩子的用戶一個REST示例 :網址:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_User_Customer/[ User_Customer_ID]/updatePassword
方法:POST
Json的有效載荷
{
"parameters": [
"Yourpassword1#"
]
}
要獲得用戶的信息,你[R賬戶(即User_Customer_ID),請參閱:
http://sldn.softlayer.com/reference/services/SoftLayer_Account/getUsers
我希望這些信息對您有幫助
我想通過腳本更改多個SoftLayer帳戶的密碼。該帳戶的管理員提供了默認密碼,我不想使用該門戶一次登錄並更改每個帳戶密碼1。 –
我猜你有一個品牌帳戶,你已經創建了若干帳戶,更改密碼所有這些帳戶的方法是登錄到帳戶使用模擬並調用SoftLayer_User_Customer :: updatePassword方法。我有這個例子來登錄您品牌中的賬戶(它使用Softlayer的Ruby客戶端和SOAP請求),您需要更改SOAP來調用updatePassword。我希望它有幫助
# Creates new account and create API key for that account
#
# The script creates a new account using the createCustomerAccount() method,
# then the script will create the API key for that account, in order to achieve
# that goal it is necessary to make soap request because in oder to create
# the API key we need to call the method addApiAuthenticationKey() using the
# the credentials of the new account as we do not have that information we are
# calling the method using impersonation.
# For perform the impersonation we need the userId and the token for the authentication.
# For more details please see below.
#
# Important manual pages
# http://sldn.softlayer.com/reference/services/SoftLayer_Account/addApiAuthenticationKey
# http://sldn.softlayer.com/reference/services/SoftLayer_Account/getApiAuthenticationKeys
# http://sldn.softlayer.com/reference/services/SoftLayer_Account/getOwnedBrands
# http://sldn.softlayer.com/reference/datatypes/SoftLayer_Account/
# http://sldn.softlayer.com/reference/datatypes/SoftLayer_Brand/
# http://sldn.softlayer.com/reference/services/SoftLayer_Brand
# http://sldn.softlayer.com/reference/services/SoftLayer_Brand/createCustomerAccount
# http://sldn.softlayer.com/reference/services/SoftLayer_Brand/getUsers
# http://sldn.softlayer.com/reference/services/SoftLayer_Brand/getToken
#
# License: http://sldn.softlayer.com/article/License
# Author: SoftLayer Technologies, Inc.<[email protected]> require 'softlayer_api' require 'pp'
# Your SoftLayer API username and key. USERNAME = 'set me' API_KEY = 'set me' ENDPOINT = 'set me'
# Declaring the API client to use the SoftLayer_Virtual_Guest API service client = SoftLayer::Client.new( username: USERNAME, api_key: API_KEY, endpoint_url: ENDPOINT)
brand_service = client.service_named('SoftLayer_Brand') account_service = client.service_named('SoftLayer_Account')
begin # Getting the brand for our account # the account could belong to several brands # you need to select one brand for the new account. brands = account_service.getOwnedBrands
# Creating an SoftLayer_Account object which contains the data # of our new account. account_template = {
'address1' => '8200 Warden Ave',
'city' => 'Markham',
'companyName' => 'IBM Bluemix Dedicated',
'email' => '[email protected]',
'firstName' => 'FirstName',
'lastName' => 'Surename',
'officePhone' => 'number',
'postalCode' => 'L6G 1C7',
'state' => 'TX',
'brandId' => brands[0]['id'],
'country' => 'CA' }
# Creating the new account new_account = brand_service.createCustomerAccount(account_template)
# Looking for the master user for the new account new_master_user
= nil users = brand_service.object_with_id(brands[0]['id']).getUsers users.each do |user|
if user['accountId'] == new_account['id']
new_master_user = user
break
end end
# Getting the token token = brand_service.object_with_id(brands[0]['id']).getToken(new_master_user['id'])
print token # This is the token you need to send to the SOAP request print ' ' print new_master_user['id'] # This is the userId you need to send to the SOAP request
rescue StandardError => exception puts "Unable to create the new account : #{exception}" end
# Here call the soap methods
=begin This is a soap example to create the API key to the account. It will create the API key for the master account of the new account. In case the master account already has an API key the request will return an error. Please replace the values $TOKEN and $USERID
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.service.softlayer.com/soap/v3/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Header>
<ns1:clientLegacySession>
<userId>$USERID</userId>
<authToken>$TOKEN</authToken>
</ns1:clientLegacySession>
<ns1:SoftLayer_User_CustomerInitParameters>
<id>$USERID</id>
</ns1:SoftLayer_User_CustomerInitParameters> </SOAP-ENV:Header> <SOAP-ENV:Body>
<ns1:addApiAuthenticationKey/> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
You Also can execute this SOAP request to get the APIKey of the master account Note: The user should already has the APIKey created
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.service.softlayer.com/soap/v3/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Header>
<ns1:clientLegacySession>
<userId>$USERID</userId>
<authToken>$TOKEN</authToken>
</ns1:clientLegacySession>
<ns1:SoftLayer_User_CustomerInitParameters>
<id>$USERID</id>
</ns1:SoftLayer_User_CustomerInitParameters> </SOAP-ENV:Header> <SOAP-ENV:Body>
<ns1:getApiAuthenticationKeys/> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
=end
- 1. 有沒有辦法爲Winamp編寫腳本?
- 2. 有沒有辦法編寫一個創建和執行代碼的Python腳本?
- 3. 有沒有更好的方法來編寫這個jQuery腳本?
- 4. 有沒有辦法使用java以編程方式更改gmail密碼?
- 5. 有沒有辦法在NSIS腳本中更改DirText字體
- 6. 有沒有辦法在SwiftMailer中更改頭文件的編碼?
- 7. 有沒有辦法在Ruby Watir自動化腳本中加密密碼?
- 8. 有沒有辦法編寫一個greasemonkey腳本來註冊熱鍵?
- 9. 有沒有辦法將產品版本從major.minor.build更改爲major.build.minor?
- 10. 有沒有辦法檢查出我的所有shell用戶已更改密碼
- 11. 有沒有辦法退出Greasemonkey腳本?
- 12. 有沒有辦法壓縮這個JavaScript代碼更多?
- 13. 有沒有辦法在Struts分頁中確定「編碼表ID」?
- 14. 爲多個用戶更改密碼的有效方法
- 15. 密碼更改腳本
- 16. 有沒有辦法傾聽Animatable.isRunning更改?
- 17. 有沒有辦法安排html更改?
- 18. 有沒有辦法用ipywidgets定義密碼文本框?
- 19. 有沒有什麼辦法可以編寫簡潔的代碼?
- 20. C - 有沒有辦法用較少的代碼來編寫它?
- 21. 有沒有辦法寫unity3d
- 22. 有沒有辦法寫每個對象
- 23. 有沒有辦法重寫這個URL?
- 24. 有沒有辦法使用「SHC」在OSX上編譯shell腳本?
- 25. 有沒有辦法從Python編寫格式化文本?
- 26. 有沒有辦法爲php mysqli登錄存儲散列密碼?
- 27. 有沒有辦法來改變列編碼和校對
- 28. 有沒有辦法改變MS ACCESS字符編碼?
- 29. 有沒有辦法爲gameboy編程?
- 30. 有沒有辦法讓腳本自動更正掃描文檔?
請問您能澄清更多嗎?你想更改用戶的密碼嗎? – mcruz