DeviceNetwork.Retrieve Method

Definition

Overloads

Retrieve(String, NetworkIdentifier, CancellationToken)

Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other APIs.

Retrieve(String, RequestContent, RequestContext)

[Protocol Method] Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other APIs.

Retrieve(String, NetworkIdentifier, CancellationToken)

Source:
DeviceNetwork.cs

Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other APIs.

public virtual Azure.Response<Azure.Communication.ProgrammableConnectivity.NetworkRetrievalResult> Retrieve (string apcGatewayId, Azure.Communication.ProgrammableConnectivity.NetworkIdentifier networkIdentifier, System.Threading.CancellationToken cancellationToken = default);
abstract member Retrieve : string * Azure.Communication.ProgrammableConnectivity.NetworkIdentifier * System.Threading.CancellationToken -> Azure.Response<Azure.Communication.ProgrammableConnectivity.NetworkRetrievalResult>
override this.Retrieve : string * Azure.Communication.ProgrammableConnectivity.NetworkIdentifier * System.Threading.CancellationToken -> Azure.Response<Azure.Communication.ProgrammableConnectivity.NetworkRetrievalResult>
Public Overridable Function Retrieve (apcGatewayId As String, networkIdentifier As NetworkIdentifier, Optional cancellationToken As CancellationToken = Nothing) As Response(Of NetworkRetrievalResult)

Parameters

apcGatewayId
String

The identifier of the APC Gateway resource which should handle this request.

networkIdentifier
NetworkIdentifier

Identifier for the network to be queried.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

apcGatewayId or networkIdentifier is null.

Examples

This sample shows how to call Retrieve.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "2024-02-09-preview");

NetworkIdentifier networkIdentifier = new NetworkIdentifier("<identifierType>", "<identifier>");
Response<NetworkRetrievalResult> response = client.Retrieve("<apcGatewayId>", networkIdentifier);

This sample shows how to call Retrieve with all parameters.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "2024-02-09-preview");

NetworkIdentifier networkIdentifier = new NetworkIdentifier("<identifierType>", "<identifier>");
Response<NetworkRetrievalResult> response = client.Retrieve("<apcGatewayId>", networkIdentifier);

Applies to

Retrieve(String, RequestContent, RequestContext)

Source:
DeviceNetwork.cs

[Protocol Method] Retrieves the network a given device is on. Returns network in a networkCode format that can be used for other APIs.

public virtual Azure.Response Retrieve (string apcGatewayId, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member Retrieve : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.Retrieve : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function Retrieve (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 Retrieve and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "2024-02-09-preview");

using RequestContent content = RequestContent.Create(new
{
    identifierType = "<identifierType>",
    identifier = "<identifier>",
});
Response response = client.Retrieve("<apcGatewayId>", content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("networkCode").ToString());

This sample shows how to call Retrieve with all parameters and request content and parse the result.

Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
DeviceNetwork client = new ProgrammableConnectivityClient(endpoint, credential).GetDeviceNetworkClient(apiVersion: "2024-02-09-preview");

using RequestContent content = RequestContent.Create(new
{
    identifierType = "<identifierType>",
    identifier = "<identifier>",
});
Response response = client.Retrieve("<apcGatewayId>", content);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("networkCode").ToString());

Applies to