简体   繁体   English

使用REST API创建子网

[英]Creating a subnet using REST API

I am trying to provision a subnet using the below REST call 我正在尝试使用以下REST调用来配置子网

curl -H "Content-Type: application/json" --data @subnet-data.json https://<userid>:<apikey>@api.softlayer.com/rest/v3.1/SoftLayer_Network/4601/createSubnet

where 4601 is the id of my Network. 其中4601是我的网络的ID。

The JSON Payload is: JSON有效负载为:

{
"parameters": [
    {
        "networkIdentifier": "172.31.10.0",
        "cidr": 24,
        "podName": "dal09.pod01",
    }
]

} }

But I get the following error 但我收到以下错误

{"error":"Bad request","code":"SoftLayer_Exception_WebService_BadRequest"}

Please let me know the correct way to order a Subnet. 请让我知道订购子网的正确方法。 Also if you can let me know how to find the correct/required parameters that would be great. 另外,如果您可以让我知道如何找到正确的/必需的参数,那将会很好。

Thank you. 谢谢。

Take a look this forum please: 请看一下这个论坛:

If you have any question or doubt, let me know 如果您有任何疑问或疑问,请告诉我


Updated 更新

The price id depends from the catalog, try this request please, you will be able to see the id for Global IPv4 : 价格ID取决于目录,请尝试此请求,您将能够看到Global IPv4的ID:

http://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Package/0/getItemPrices?objectFilter={"itemPrices":{"item":{"description":{"operation":"Global IPv4"}}}}

Method: Get

If you don't have success, try the request below, sometimes it's necessary to encoded because we are using an objectFilter: 如果没有成功,请尝试以下请求,有时有必要进行编码,因为我们使用的是ObjectFilter:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Package/0/getItemPrices?objectFilter=%7B%22itemPrices%22%3A%7B%22item%22%3A%7B%22description%22%3A%7B%22operation%22%3A%22Global+IPv4%22%7D%7D%7D%7D

Method: Get

Replace: $user and $apiKey with you own information 用您自己的信息替换: $ user$ apiKey

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM