How to List Routing Destinations

Warning: Beta software This API is in beta stage and may be subject to change. Therefore, we do not recommend using this in production.

Interested in this feature? Please reach out to mobility-services-developer@cisco.com

ListRoutingDestinations is a method that allows you list routing destinations.

This method is part of the Number Portability API and belongs to the RoutingDestinatinService.

Prerequisites

  1. An OAuth 2.0 client
  2. A client access token

Code Dependencies

curl -sL https://github.com/working-group-two/wgtwoapis/releases/latest/download/mobility.binpb --output mobility.binpb
<dependency>
  <groupId>com.wgtwo.api.v1.grpc</groupId>
  <artifactId>number_portability</artifactId>
  <version>1.10.1</version>
</dependency>

Code

The examples below demonstrate how to use the ListRoutingDestinations function.

You can test our APIs without authorization by targeting sandbox.api.shamrock.wgtwo.com instead of api.{region}.wgtwo.com and removing any authorization from the request/code sample.


#!/usr/bin/env bash
grpcurl \
  --protoset mobility.binpb \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '
  {
      "destinationId": "4f3b9735-ce28-4c46-9640-fd6a6291f490"
  }
  ' \
  sandbox.api.shamrock.wgtwo.com:443 \
  wgtwo.number_portability.v1.RoutingDestinationService/ListDestinations

package com.example.numberPortability

import com.wgtwo.api.v1.number_portability.RoutingDestinationServiceGrpcKt
import com.wgtwo.api.v1.number_portability.listDestinationsRequest
import io.grpc.ManagedChannelBuilder
import kotlinx.coroutines.runBlocking

private val channel = ManagedChannelBuilder.forAddress("sandbox.api.shamrock.wgtwo.com", 443).build()
private val stub = RoutingDestinationServiceGrpcKt.RoutingDestinationServiceCoroutineStub(channel)

fun main() = runBlocking {
    val listDestinationsRequest = listDestinationsRequest {
        destinationId = "4f3b9735-ce28-4c46-9640-fd6a6291f490"
    }
    println("listDestinationsRequest:
$listDestinationsRequest")

    val listDestinationsResponse = stub.listDestinations(listDestinationsRequest)
    println("listDestinationsResponse:
$listDestinationsResponse")

    assert(listDestinationsResponse.destinationsCount > 0) { "No routing destination returned" }
}

Example Results Success

{
  "destinations": [
    {
      "id": "360d6fce-0a15-4e21-83c7-2b28f0e17540",
      "name": "Routing destination 360d6fce-0a15-4e21-83c7-2b28f0e17540",
      "routingCode": "C1955"
    },
    {
      "id": "3b2fcc35-467f-4e1d-8d56-7d2d28dc0d0a",
      "name": "Another destination 3b2fcc35-467f-4e1d-8d56-7d2d28dc0d0a",
      "routingCode": "C99126"
    }
  ]
}
destinations {
  id: "9ad5c06f-afe6-4543-a450-46adfe60b4bd"
  name: "Routing destination 9ad5c06f-afe6-4543-a450-46adfe60b4bd"
  routing_code: "C1184"
}
destinations {
  id: "700a416e-163c-464d-a7e8-0706afeecea7"
  name: "Another destination 700a416e-163c-464d-a7e8-0706afeecea7"
  routing_code: "C97730"
}

Read More