How to Get Active Datasets

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

GetActiveDatasets is a method that allows you to get a list of pairs where each pair contains a dataset UUID and a tenant UUID, representing the active datasets for tenants.

This method is part of the IR21 API and belongs to the Ir21Service.

Prerequisites

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

Code Dependencies

<dependency>
  <groupId>com.wgtwo.api.v1.grpc</groupId>
  <artifactId>ir21</artifactId>
  <version>1.16.3</version>
</dependency>

Code

The examples below demonstrate how to use the GetActiveDatasets 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 \
  sandbox.api.shamrock.wgtwo.com:443 \
  wgtwo.ir21.v1.Ir21Service/GetActiveDatasets

package com.example.ir21

import com.wgtwo.api.v1.ir21.Ir21ServiceGrpcKt
import com.wgtwo.api.v1.ir21.getActiveDatasetsRequest
import io.grpc.ManagedChannelBuilder
import kotlinx.coroutines.runBlocking

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

fun main() = runBlocking {
    val getActiveDatasetsRequest = getActiveDatasetsRequest {
        // No parameters needed for getting active datasets
    }
    println("getActiveDatasetsRequest:
$getActiveDatasetsRequest")

    val getActiveDatasetsResponse = stub.getActiveDatasets(getActiveDatasetsRequest)
    println("getActiveDatasetsResponse:
$getActiveDatasetsResponse")

    // Print each active dataset
    getActiveDatasetsResponse.activeDatasetsList.forEach { activeDataset ->
        println("Dataset UUID: ${activeDataset.datasetUuid.toStringUtf8()}")
        println("Tenant UUID: ${activeDataset.tenantUuid.toStringUtf8()}")
        println("---")
    }

    if (getActiveDatasetsResponse.activeDatasetsList.isEmpty()) {
        println("No active datasets found")
    }
}

Example Results Success

{
  "activeDatasets": [
    {
      "datasetUuid": "rM/IlHhOSQiHoQFiUHv6ww==",
      "tenantUuid": "NSQA6TA8RdSNNXUC4HOFTA=="
    },
    {
      "datasetUuid": "2lm3Uz7WQk2MW4mtRGO0WA==",
      "tenantUuid": "7yjZXAJgQAKRSK8bGcfjOA=="
    }
  ]
}
active_datasets {
  dataset_uuid: "rM/IlHhOSQiHoQFiUHv6ww=="
  tenant_uuid: "NSQA6TA8RdSNNXUC4HOFTA=="
}
active_datasets {
  dataset_uuid: "2lm3Uz7WQk2MW4mtRGO0WA=="
  tenant_uuid: "7yjZXAJgQAKRSK8bGcfjOA=="
}

Example Results Error

ERROR:
  Code: Unauthenticated
  Message: Authentication required
Status code: UNAUTHENTICATED
Status description: Authentication required

Read More