How to List 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
ListDatasets
is a method that allows you to list all datasets in the IR21 database.
This method is part of the IR21 API and belongs to the Ir21Service
.
Prerequisites
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 ListDatasets
function.
You can test our APIs without authorization by targeting
sandbox.api.shamrock.wgtwo.com
instead ofapi.{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/ListDatasets
package com.example.ir21
import com.wgtwo.api.v1.ir21.Ir21ServiceGrpcKt
import com.wgtwo.api.v1.ir21.listDatasetsRequest
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 listDatasetsRequest = listDatasetsRequest {
// No parameters needed for listing datasets
}
println("listDatasetsRequest:
$listDatasetsRequest")
val listDatasetsResponse = stub.listDatasets(listDatasetsRequest)
println("listDatasetsResponse:
$listDatasetsResponse")
// Print each dataset
listDatasetsResponse.datasetsList.forEach { dataset ->
println("Dataset UUID: ${dataset.uuid.toStringUtf8()}")
println("Dataset Comment: ${dataset.comment}")
println("---")
}
}
Example Results Success
{
"datasets": [
{
"uuid": "rM/IlHhOSQiHoQFiUHv6ww==",
"comment": "Example dataset"
},
{
"uuid": "2lm3Uz7WQk2MW4mtRGO0WA==",
"comment": "Another example dataset"
}
]
}
datasets {
uuid: "rM/IlHhOSQiHoQFiUHv6ww=="
comment: "Example dataset"
}
datasets {
uuid: "2lm3Uz7WQk2MW4mtRGO0WA=="
comment: "Another example dataset"
}
Example Results Error
ERROR:
Code: Unauthenticated
Message: Authentication required
Status code: UNAUTHENTICATED
Status description: Authentication required