List Products For A Tenant
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
Prerequisites
Required Scope
products.list_for_tenant:read
Code Dependencies
<dependency>
<groupId>com.wgtwo.api.v0.grpc</groupId>
<artifactId>products</artifactId>
<version>0.3.0</version>
</dependency>
Code
If targeting production, you would need to add authentication to the sample code.
#!/usr/bin/env bash
grpcurl \
-d '
{
"tenant": "wotel"
}
' \
sandbox.api.shamrock.wgtwo.com:443 \
wgtwo.products.v0.ProductService/ListProductsForTenant
package com.example.products
import com.wgtwo.api.v0.products.ProductServiceGrpc
import com.wgtwo.api.v0.products.ProductsProto.ListProductsForTenantRequest
import io.grpc.ManagedChannelBuilder
private val channel = ManagedChannelBuilder.forTarget("sandbox.api.shamrock.wgtwo.com:443").build()
private val stub = ProductServiceGrpc.newBlockingStub(channel)
fun main(vararg args: String) {
require(args.size <= 1) { "This program requires 1 or 0 arguments: [tenant-identifier]" }
val tenant = args.getOrNull(1) ?: "wotel"
val request = ListProductsForTenantRequest.newBuilder().apply {
this.tenant = tenant
}.build()
println("Request:
$request")
val response = stub.listProductsForTenant(request)
println("Response:
$response")
channel.shutdownNow()
}
Example Results
{
"products": [
{
"id": "10",
"name": "Product 10",
"subtitle": "Product 10 subtitle",
"productUrl": "https://product10.example",
"description": "Product 10 description. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"icon": {
"url": "https://picsum.photos/512?random=10"
},
"banner": {
"url": "https://picsum.photos/1024/512?random=10"
},
"images": [
{
"url": "https://picsum.photos/1024?random=310"
},
{
"url": "https://picsum.photos/1024?random=210"
}
]
},
{
"id": "6",
"name": "Product 6",
"subtitle": "Product 6 subtitle",
"productUrl": "https://product6.example",
"description": "Product 6 description. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
"icon": {
"url": "https://picsum.photos/512?random=6"
},
"banner": {
"url": "https://picsum.photos/1024/512?random=6"
}
}
]
}
products {
id: "10"
name: "Product 10"
subtitle: "Product 10 subtitle"
product_url: "https://product10.example"
description: "Product 10 description. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
icon {
url: "https://picsum.photos/512?random=10"
}
banner {
url: "https://picsum.photos/1024/512?random=10"
}
images {
url: "https://picsum.photos/1024?random=310"
}
images {
url: "https://picsum.photos/1024?random=210"
}
}
products {
id: "8"
name: "Product 8"
subtitle: "Product 8 subtitle"
product_url: "https://product8.example"
description: "Product 8 description. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
icon {
url: "https://picsum.photos/512?random=8"
}
banner {
url: "https://picsum.photos/1024/512?random=8"
}
}