How to Manage Subscriptions

If targeting production, you would need to add authentication to the sample code.

Required Scope

  • subscription.read
  • subscription.write

Code Dependencies

<none>
<dependency>
  <groupId>com.wgtwo.api</groupId>
  <artifactId>rest</artifactId>
  <version>1.2.1</version>
</dependency>

Get Subscription Info


#!/usr/bin/env bash
# Access token must be obtained via the client credentials flow
curl -s \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
   https://sandbox.api.shamrock.wgtwo.com/subscription/v2/msisdn/46737678218

package com.wgtwo.examples.provision

import com.wgtwo.api.rest.ApiClient
import com.wgtwo.api.rest.handler.SubscriptionProfileApi

private val apiClient = ApiClient().apply {
    setUsername("CLIENT_ID")
    setPassword("CLIENT_SECRET")
}
private val subscriptionProfileApi = SubscriptionProfileApi(apiClient)

fun main() {
    val subscription = subscriptionProfileApi.getSubscription("47xxxxxxxx")
    println("My enabled services: ${subscription.services!!.keys}")
}

Activate New User

# Access token must be obtained via the client credentials flow
curl \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H 'Content-Type: application/json' \
    -d '
    {
        "bssid": "operator_name",
        "iccid": "2420198416000015720",
        "msisdn": "46737678218",
        "userid": "random-userid-123"
    }
    ' \
    https://sandbox.api.shamrock.wgtwo.com/provision/v2/activate

Provision Replacement SIM

Depending on the logistics of getting a new SIM just using /provision/v2/changesim can also work, since the old SIM already becomes nonfunctional after changesim.

Steps

  1. Block the subscription
  2. Change the SIM
  3. Unblock subscription

Block Subscription

# Access token must be obtained via the client credentials flow
curl \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H 'Content-Type: application/json' \
    -d '
    {
        "bssid": "operator_name",
        "msisdn": "46737678218"
    }
    ' \
    https://sandbox.api.shamrock.wgtwo.com/provision/v2/block

Change SIM

# Access token must be obtained via the client credentials flow
curl \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H 'Content-Type: application/json' \
    -d '
    {
        "bssid": "operator_name",
        "iccid": "2420198416000015720",
        "newIccid": "2420198412148748973"
    }
    ' \
    https://sandbox.api.shamrock.wgtwo.com/provision/v2/changesim

Unblock Subscription

# Access token must be obtained via the client credentials flow
# Can also use IMSI or ICCID as identifier
curl \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H 'Content-Type: application/json' \
    -d '
    {
        "bssid": "operator_name",
        "msisdn": "46737678218"
    }
    ' \
    https://sandbox.api.shamrock.wgtwo.com/provision/v2/unblock

Freeze Subscription

See block subscription

Unfreeze Subscription

See unblock subscription

Restrict Highspeed Data

# Access token must be obtained via the client credentials flow
curl \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H 'Content-Type: application/json' \
    -d '
    {
        "bssid": "operator_name",
        "services": {
            "delete": ["DATA_HIGHSPEED"]
        },
        "msisdn": "46737678218"
    }
    ' \
    https://sandbox.api.shamrock.wgtwo.com/provision/v2/update

Disable Roaming

Steps:

  1. Remove roaming
  2. Remove roaming data

Remove Roaming

# Access token must be obtained via the client credentials flow
curl \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H 'Content-Type: application/json' \
    -d '
    {
        "bssid": "operator_name",
        "services": {
            "delete": ["ROAMING"]
        },
        "msisdn": "46737678218"
    }
    ' \
    https://sandbox.api.shamrock.wgtwo.com/provision/v2/update

Remove Roaming Data


#!/usr/bin/env bash
# Access token must be obtained via the client credentials flow
curl -s \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H 'Content-Type: application/json' \
    -d '
    {
        "bssid": "operator_name",
        "services": {
            "delete": ["ROAMING_DATA"]
        },
        "msisdn": "46737678218"
    }
    ' \
    https://sandbox.api.shamrock.wgtwo.com/provision/v2/update

package com.wgtwo.examples.provision

import com.wgtwo.api.rest.ApiClient
import com.wgtwo.api.rest.handler.SubscriptionProfileApi
import com.wgtwo.api.rest.model.UpdateSubscriptionRequest
import com.wgtwo.api.rest.model.UpdateSubscriptionRequestService.NameEnum

private val apiClient = ApiClient().apply {
    setUsername("CLIENT_ID")
    setPassword("CLIENT_SECRET")
}
private val subscriptionProfileApi = SubscriptionProfileApi(apiClient)

fun main() {
    val request = UpdateSubscriptionRequest().apply {
        bssid = "IDENTIFIER PROVIDED BY CISCO"
        msisdn = "47xxxxxxxx"
        services = UpdateSubscriptionRequestServices().apply {
            delete = listOf(NameEnum.ROAMING_DATA)
        }
    }
    subscriptionProfileApi.updateService(request)
}

Enable Roaming

Steps to enable roaming:

  1. Add roaming
  2. Add roaming data

Add Roaming

# Access token must be obtained via the client credentials flow
curl \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H 'Content-Type: application/json' \
    -d '
    {
        "bssid": "operator_name",
        "services": {
            "add": [
              { "servicename": "ROAMING" }
            ]
        },
        "msisdn": "46737678218"
    }
    ' \
    https://sandbox.api.shamrock.wgtwo.com/provision/v2/update

Add Roaming Data


#!/usr/bin/env bash
# Access token must be obtained via the client credentials flow
curl -s \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H 'Content-Type: application/json' \
    -d '
    {
        "bssid": "operator_name",
        "services": {
            "add": [
              { "servicename": "ROAMING_DATA" }
            ]
        },
        "msisdn": "46737678218"
    }
    ' \
    https://sandbox.api.shamrock.wgtwo.com/provision/v2/update

package com.wgtwo.examples.provision

import com.wgtwo.api.rest.ApiClient
import com.wgtwo.api.rest.handler.SubscriptionProfileApi
import com.wgtwo.api.rest.model.UpdateSubscriptionRequest
import com.wgtwo.api.rest.model.UpdateSubscriptionRequestService.NameEnum

private val apiClient = ApiClient().apply {
    setUsername("CLIENT_ID")
    setPassword("CLIENT_SECRET")
}
private val subscriptionProfileApi = SubscriptionProfileApi(apiClient)

fun main() {
    val request = UpdateSubscriptionRequest().apply {
        bssid = "IDENTIFIER PROVIDED BY CISCO"
        msisdn = "47xxxxxxxx"
        services = UpdateSubscriptionRequestServices().apply {
            add = listOf(
                UpdateSubscriptionRequestServices.add().apply {
                    servicename = NameEnum.ROAMING_DATA
                },
            )
        }
    }
    subscriptionProfileApi.updateService(request)
}

Terminate Subscription

# Access token must be obtained via the client credentials flow
# Can also be terminated using IMSI or ICCID as identifier
curl \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H 'Content-Type: application/json' \
    -d '
    {
        "bssid": "operator_name",
        "msisdn": "46737678218"
    }
    ' \
    https://sandbox.api.shamrock.wgtwo.com/provision/v2/terminate

Change MSISDN for a SIM

# Access token must be obtained via the client credentials flow
# Can also use IMSI or ICCID as identifier instead of MSISDN
curl \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H 'Content-Type: application/json' \
    -d '
    {
        "bssid": "operator_name",
        "msisdn": "46737678218",
        "newMsisdn": "46727678209"
    } ' \
    https://sandbox.api.shamrock.wgtwo.com/provision/v2/changemsisdn

Remove a SIM from Subscription

# Access token must be obtained via the client credentials flow
curl \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H 'Content-Type: application/json' \
    -d '
    {
        "bssid": "operator_name",
        "msisdn": "46737678218",
        "iccid": "2420198416000015720"
    }
    ' \
    https://sandbox.api.shamrock.wgtwo.com/provision/v2/disengagesim

Add a Bundled Product

# Access token must be obtained via the client credentials flow
curl \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H 'Content-Type: application/json' \
    -d '
    {
        "bssid": "operator_name",
        "services": {
            "add": [
              {
                "servicename": "PRODUCT_BUNDLING",
                "config": {
                    "products": ["some_product_id"]
                }
              }
            ]
        },
        "msisdn": "46737678218"
    }
    ' \
    https://sandbox.api.shamrock.wgtwo.com/provision/v2/update

Read More