Get Consents For A Subscription

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

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

Required Scope

  • subscription.consent:read

Code Dependencies

<dependency>
  <groupId>com.wgtwo.api.v0.grpc</groupId>
  <artifactId>consents</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 '
  {
    "id": {
      "value": "my_unique_subscription_id_here",
      "tenant": {
        "name": "my_tenant_name_here"
      }
    }
  }' \
  sandbox.api.shamrock.wgtwo.com:443 \
  wgtwo.consents.v0.ConsentService/GetConsentsForSubscription

package com.example.consents

import com.wgtwo.api.v0.common.TypesProto
import com.wgtwo.api.v0.consent.ConsentServiceGrpc
import com.wgtwo.api.v0.consent.ConsentsProto.GetConsentsForSubscriptionRequest
import io.grpc.ManagedChannelBuilder

private val channel = ManagedChannelBuilder.forTarget("sandbox.api.shamrock.wgtwo.com:443").build()
private val stub = ConsentServiceGrpc.newBlockingStub(channel)

fun main(vararg args: String) {
    val subscriptionId = "my_unique_subscription_id_here"
    val tenant = "my_tenant_name_here"
    val request = GetConsentsForSubscriptionRequest.newBuilder().apply {
        this.id = TypesProto.SubscriptionIdentifier.newBuilder().apply {
            this.value = subscriptionId
            this.tenant = TypesProto.Tenant.newBuilder().apply {
                this.name = tenant
            }.build()
        }.build()
    }.build()
    println("Request:
$request")

    val response = stub.getConsentsForSubscription(request)
    println("Response:
$response")

    channel.shutdownNow()
}

Example Result


{
  "products": [
    {
      "id": "3",
      "name": "Product 3",
      "subtitle": "Product 3 subtitle",
      "productUrl": "https://product3.example",
      "description": "Product 3 description. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
    },
    {
      "id": "1",
      "name": "Product 1",
      "subtitle": "Product 1 subtitle",
      "productUrl": "https://product1.example",
      "description": "Product 1 description. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
    }
  ]
}

consents {
  owner {
    tenant {
      name: "my_tenant_name_here"
    }
  }
  product_id: "976"
  scopes {
    property: "products.tenant:read"
  }
  scopes {
    property: "phone"
  }
  scopes {
  }
  scopes {
    property: "events.periodic_country.subscribe"
  }
  scopes {
    property: "subscription.periodic_country:read"
  }
  scopes {
    property: "subscription.read"
  }
  scopes {
    property: "call.routing:write"
  }
  scopes {
    property: "events.voicemail.subscribe"
  }
  scopes {
    property: "subscription.id:read"
  }
}
consents {
  owner {
    tenant {
      name: "my_tenant_name_here"
    }
  }
  product_id: "156"
  scopes {
    property: "data.content_filtering:write"
  }
  scopes {
    property: "callforwarding.to_voicemail"
  }
  scopes {
    property: "events.location.subscribe"
  }
  scopes {
    property: "callforwarding.to_number"
  }
  scopes {
    property: "events.handset_update.subscribe"
  }
  scopes {
    property: "voicemail.update"
  }
  scopes {
    property: "subscription.periodic_country:read"
  }
  scopes {
    property: "sms.data:send_to_subscriber"
  }
}
status_code: STATUS_CODE_OK

Read More