NumberVerification.VerifyWithCode Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
VerifyWithCode(String, NumberVerificationWithCodeContent, CancellationToken) |
Verifies the phone number (MSISDN) associated with a device. |
VerifyWithCode(String, RequestContent, RequestContext) |
[Protocol Method] Verifies the phone number (MSISDN) associated with a device.
|
VerifyWithCode(String, NumberVerificationWithCodeContent, CancellationToken)
- Source:
- NumberVerification.cs
Verifies the phone number (MSISDN) associated with a device.
public virtual Azure.Response<Azure.Communication.ProgrammableConnectivity.NumberVerificationResult> VerifyWithCode (string apcGatewayId, Azure.Communication.ProgrammableConnectivity.NumberVerificationWithCodeContent numberVerificationWithCodeContent, System.Threading.CancellationToken cancellationToken = default);
abstract member VerifyWithCode : string * Azure.Communication.ProgrammableConnectivity.NumberVerificationWithCodeContent * System.Threading.CancellationToken -> Azure.Response<Azure.Communication.ProgrammableConnectivity.NumberVerificationResult>
override this.VerifyWithCode : string * Azure.Communication.ProgrammableConnectivity.NumberVerificationWithCodeContent * System.Threading.CancellationToken -> Azure.Response<Azure.Communication.ProgrammableConnectivity.NumberVerificationResult>
Public Overridable Function VerifyWithCode (apcGatewayId As String, numberVerificationWithCodeContent As NumberVerificationWithCodeContent, Optional cancellationToken As CancellationToken = Nothing) As Response(Of NumberVerificationResult)
Parameters
- apcGatewayId
- String
The identifier of the APC Gateway resource which should handle this request.
- numberVerificationWithCodeContent
- NumberVerificationWithCodeContent
Request to verify number of device - second call.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
apcGatewayId
or numberVerificationWithCodeContent
is null.
Examples
This sample shows how to call VerifyWithCode.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "2024-02-09-preview");
NumberVerificationWithCodeContent numberVerificationWithCodeContent = new NumberVerificationWithCodeContent("<apcCode>");
Response<NumberVerificationResult> response = client.VerifyWithCode("<apcGatewayId>", numberVerificationWithCodeContent);
This sample shows how to call VerifyWithCode with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "2024-02-09-preview");
NumberVerificationWithCodeContent numberVerificationWithCodeContent = new NumberVerificationWithCodeContent("<apcCode>");
Response<NumberVerificationResult> response = client.VerifyWithCode("<apcGatewayId>", numberVerificationWithCodeContent);
Applies to
VerifyWithCode(String, RequestContent, RequestContext)
- Source:
- NumberVerification.cs
[Protocol Method] Verifies the phone number (MSISDN) associated with a device.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler VerifyWithCode(String, NumberVerificationWithCodeContent, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response VerifyWithCode (string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member VerifyWithCode : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.VerifyWithCode : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function VerifyWithCode (apcGatewayId As String, content As RequestContent, Optional context As RequestContext = Nothing) As Response
Parameters
- apcGatewayId
- String
The identifier of the APC Gateway resource which should handle this request.
- content
- RequestContent
The content to send as the body of the request.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
apcGatewayId
or content
is null.
Service returned a non-success status code.
Examples
This sample shows how to call VerifyWithCode and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "2024-02-09-preview");
using RequestContent content = RequestContent.Create(new
{
apcCode = "<apcCode>",
});
Response response = client.VerifyWithCode("<apcGatewayId>", content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("verificationResult").ToString());
This sample shows how to call VerifyWithCode with all parameters and request content and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
NumberVerification client = new ProgrammableConnectivityClient(endpoint, credential).GetNumberVerificationClient(apiVersion: "2024-02-09-preview");
using RequestContent content = RequestContent.Create(new
{
apcCode = "<apcCode>",
});
Response response = client.VerifyWithCode("<apcGatewayId>", content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("verificationResult").ToString());
Applies to
Azure SDK for .NET