Communication Service - Check Name Availability
Check Name Availability
Checks that the CommunicationService name is valid and is not already in use.
POST https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability?api-version=2020-08-20
URI Parameters
Name
In
Required
Type
Description
subscriptionId
path
True
string
minLength: 1
The ID of the target subscription.
api-version
query
True
string
minLength: 1
The API version to use for this operation.
Request Body
Name
Required
Type
Description
name
True
string
The CommunicationService name to validate. e.g."my-CommunicationService-name-here"
type
True
string
The resource type. Should be always "Microsoft.Communication/CommunicationServices".
Responses
Name
Type
Description
200 OK
NameAvailability
Success. The response describes the name availability.
Other Status Codes
ErrorResponse
Error response describing why the operation failed.
Examples
Check name availability available
Sample request
POST https://management.azure.com/subscriptions/12345/providers/Microsoft.Communication/checkNameAvailability?api-version=2020-08-20
{
"type": "Microsoft.Communication/CommunicationServices",
"name": "MyCommunicationService"
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.communication.models.NameAvailabilityParameters;
/** Samples for CommunicationService CheckNameAvailability. */
public final class Main {
/*
* x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/checkNameAvailabilityAvailable.json
*/
/**
* Sample code: Check name availability available.
*
* @param manager Entry point to CommunicationManager.
*/
public static void checkNameAvailabilityAvailable(
com.azure.resourcemanager.communication.CommunicationManager manager) {
manager
.communicationServices()
.checkNameAvailabilityWithResponse(
new NameAvailabilityParameters()
.withType("Microsoft.Communication/CommunicationServices")
.withName("MyCommunicationService"),
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
package armcommunication_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/communication/armcommunication"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/checkNameAvailabilityAvailable.json
func ExampleServiceClient_CheckNameAvailability() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
client, err := armcommunication.NewServiceClient("12345", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := client.CheckNameAvailability(ctx,
&armcommunication.ServiceClientCheckNameAvailabilityOptions{NameAvailabilityParameters: &armcommunication.NameAvailabilityParameters{
Name: to.Ptr("MyCommunicationService"),
Type: to.Ptr("Microsoft.Communication/CommunicationServices"),
},
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// TODO: use response item
_ = res
}
To use the Azure SDK library in your project, see this documentation . To provide feedback on this code sample, open a GitHub issue
const { CommunicationServiceManagementClient } = require("@azure/arm-communication");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Checks that the CommunicationService name is valid and is not already in use.
*
* @summary Checks that the CommunicationService name is valid and is not already in use.
* x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/checkNameAvailabilityAvailable.json
*/
async function checkNameAvailabilityAvailable() {
const subscriptionId = "12345";
const nameAvailabilityParameters = {
name: "MyCommunicationService",
type: "Microsoft.Communication/CommunicationServices",
};
const options = {
nameAvailabilityParameters,
};
const credential = new DefaultAzureCredential();
const client = new CommunicationServiceManagementClient(credential, subscriptionId);
const result = await client.communicationService.checkNameAvailability(options);
console.log(result);
}
checkNameAvailabilityAvailable().catch(console.error);
To use the Azure SDK library in your project, see this documentation . To provide feedback on this code sample, open a GitHub issue
Sample response
{
"nameAvailable": true,
"reason": "NameAvailable",
"message": "Requested name is available for the requested type"
}
Check name availability unavailable
Sample request
POST https://management.azure.com/subscriptions/12345/providers/Microsoft.Communication/checkNameAvailability?api-version=2020-08-20
{
"type": "Microsoft.Communication/CommunicationServices",
"name": "MyCommunicationService"
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.communication.models.NameAvailabilityParameters;
/** Samples for CommunicationService CheckNameAvailability. */
public final class Main {
/*
* x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/checkNameAvailabilityUnavailable.json
*/
/**
* Sample code: Check name availability unavailable.
*
* @param manager Entry point to CommunicationManager.
*/
public static void checkNameAvailabilityUnavailable(
com.azure.resourcemanager.communication.CommunicationManager manager) {
manager
.communicationServices()
.checkNameAvailabilityWithResponse(
new NameAvailabilityParameters()
.withType("Microsoft.Communication/CommunicationServices")
.withName("MyCommunicationService"),
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
const { CommunicationServiceManagementClient } = require("@azure/arm-communication");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Checks that the CommunicationService name is valid and is not already in use.
*
* @summary Checks that the CommunicationService name is valid and is not already in use.
* x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/stable/2020-08-20/examples/checkNameAvailabilityUnavailable.json
*/
async function checkNameAvailabilityUnavailable() {
const subscriptionId = "12345";
const nameAvailabilityParameters = {
name: "MyCommunicationService",
type: "Microsoft.Communication/CommunicationServices",
};
const options = {
nameAvailabilityParameters,
};
const credential = new DefaultAzureCredential();
const client = new CommunicationServiceManagementClient(credential, subscriptionId);
const result = await client.communicationService.checkNameAvailability(options);
console.log(result);
}
checkNameAvailabilityUnavailable().catch(console.error);
To use the Azure SDK library in your project, see this documentation . To provide feedback on this code sample, open a GitHub issue
Sample response
{
"nameAvailable": false,
"reason": "AlreadyExists",
"message": "Requested name is unavailable for the requested type"
}
Definitions
ErrorAdditionalInfo
Object
The resource management error additional info.
Name
Type
Description
info
object
The additional info.
type
string
The additional info type.
ErrorDetail
Object
The error detail.
Name
Type
Description
additionalInfo
ErrorAdditionalInfo []
The error additional info.
code
string
The error code.
details
ErrorDetail []
The error details.
message
string
The error message.
target
string
The error target.
ErrorResponse
Object
Error response
Name
Type
Description
error
ErrorDetail
The error object.
NameAvailability
Object
Result of the request to check name availability. It contains a flag and possible reason of failure.
Name
Type
Description
message
string
The message of the operation.
nameAvailable
boolean
Indicates whether the name is available or not.
reason
string
The reason of the availability. Required if name is not available.
NameAvailabilityParameters
Object
Data POST-ed to the nameAvailability action
Name
Type
Description
name
string
The CommunicationService name to validate. e.g."my-CommunicationService-name-here"
type
string
The resource type. Should be always "Microsoft.Communication/CommunicationServices".