檢查 IoT Central 應用程式子域是否可用。
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkSubdomainAvailability?api-version=2021-06-01
URI 參數
名稱 |
位於 |
必要 |
類型 |
Description |
subscriptionId
|
path |
True
|
string
|
訂用帳戶標識碼。
|
api-version
|
query |
True
|
string
|
API 版本。
|
要求本文
名稱 |
必要 |
類型 |
Description |
name
|
True
|
string
|
要檢查的IoT Central 應用程式實例名稱。
|
type
|
|
string
|
要查詢的IoT Central資源類型。
|
回應
名稱 |
類型 |
Description |
200 OK
|
AppAvailabilityInfo
|
這是同步作業。 本文包含 JSON 串行化回應,指定 IoT Central 應用程式子域是否可用。 如果子域無法使用,主體會包含原因。
|
Other Status Codes
|
CloudError
|
DefaultErrorResponse
|
安全性
azure_auth
Azure Active Directory OAuth2 Flow
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
名稱 |
Description |
user_impersonation
|
模擬您的用戶帳戶
|
範例
Apps_SubdomainAvailability
範例要求
POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.IoTCentral/checkSubdomainAvailability?api-version=2021-06-01
{
"name": "myiotcentralapp",
"type": "IoTApps"
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.iotcentral.models.OperationInputs;
/** Samples for Apps CheckSubdomainAvailability. */
public final class Main {
/*
* x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CheckSubdomainAvailability.json
*/
/**
* Sample code: Apps_SubdomainAvailability.
*
* @param manager Entry point to IotCentralManager.
*/
public static void appsSubdomainAvailability(com.azure.resourcemanager.iotcentral.IotCentralManager manager) {
manager
.apps()
.checkSubdomainAvailabilityWithResponse(
new OperationInputs().withName("myiotcentralapp").withType("IoTApps"), Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.iotcentral import IotCentralClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-iotcentral
# USAGE
python apps_check_subdomain_availability.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = IotCentralClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.apps.check_subdomain_availability(
operation_inputs={"name": "myiotcentralapp", "type": "IoTApps"},
)
print(response)
# x-ms-original-file: specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CheckSubdomainAvailability.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armiotcentral_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iotcentral/armiotcentral"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/iotcentral/resource-manager/Microsoft.IoTCentral/stable/2021-06-01/examples/Apps_CheckSubdomainAvailability.json
func ExampleAppsClient_CheckSubdomainAvailability() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armiotcentral.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewAppsClient().CheckSubdomainAvailability(ctx, armiotcentral.OperationInputs{
Name: to.Ptr("myiotcentralapp"),
Type: to.Ptr("IoTApps"),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AppAvailabilityInfo = armiotcentral.AppAvailabilityInfo{
// NameAvailable: to.Ptr(true),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
code: 200
{
"nameAvailable": true
}
{
"error": {
"code": "Error code",
"message": "Error message",
"target": "Error target"
}
}
定義
AppAvailabilityInfo
Object
屬性,指出指定的IoT Central 應用程式名稱或子域是否可用。
名稱 |
類型 |
Description |
message
|
string
|
詳細的原因訊息。
|
nameAvailable
|
boolean
|
值,指出提供的名稱是否可用。
|
reason
|
string
|
無法使用的原因。
|
CloudError
Object
錯誤詳細數據。
名稱 |
類型 |
Description |
error.code
|
string
|
錯誤碼。
|
error.details
|
CloudErrorBody[]
|
錯誤的其他詳細數據清單。
|
error.message
|
string
|
錯誤訊息。
|
error.target
|
string
|
特定錯誤的目標。
|
CloudErrorBody
Object
錯誤回應的詳細數據。
名稱 |
類型 |
Description |
code
|
string
|
錯誤碼。
|
details
|
CloudErrorBody[]
|
錯誤的其他詳細數據清單。
|
message
|
string
|
錯誤訊息。
|
target
|
string
|
特定錯誤的目標。
|
Object
輸入值。
名稱 |
類型 |
預設值 |
Description |
name
|
string
|
|
要檢查的IoT Central 應用程式實例名稱。
|
type
|
string
|
IoTApps
|
要查詢的IoT Central資源類型。
|