使用API(Ruby),是否可以在订购子网后立即可靠地将文本应用于子网的注释字段?
谢谢
答案 0 :(得分:1)
订购子网后,无法立即放置子网注释,因为它的配置时间很短。这通常需要5分钟,一旦配置了子网,就可以成功应用注释。
# Edits a note for a SoftLayer_Network_Subnet
#
# Important manual pages
# http://sldn.softlayer.com/reference/services/SoftLayer_Network_Subnet/editNote
#
# License: http://sldn.softlayer.com/article/License
# Author: SoftLayer Technologies, Inc. <sldn@softlayer.com>
require 'rubygems'
require 'softlayer_api'
SL_API_USERNAME = 'set me'
SL_API_KEY = 'set me'
network_subnet_id = 123456
note_data = 'testing note'
softlayer_client = SoftLayer::Client.new(username: SL_API_USERNAME,
api_key: SL_API_KEY)
network_subnet_service = softlayer_client.service_named('SoftLayer_Network_Subnet')
begin
result = network_subnet_service.object_with_id(network_subnet_id)
.editNote(note_data)
p result
rescue StandardError => e
raise e
end
答案 1 :(得分:1)
您可以使用以下请求通过orderId检索子网:
https://$username:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Account/getSubnets?objectFilter={"subnets":{"billingItem":{"orderItem":{"order":{"id":{"operation":9041210}}}}}}
替换: $ username,$ apiKey和9041210(orderId)