How to Create or Update Organisation

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

CreateOrUpdateOrganisation is a method that allows you to create or update organisation information in the IR21 database. An organisation consists of a name, country, TADIGs, MCCMNCs, GT prefixes, realms, and notes, and is part of a dataset.

If you have access to IR.21 records in the GSMA RAEX IR.21 XML format (see GSMA PRD IR.21 v17.0), then you should consider using CreateOrUpdateOrganisationFromXml.

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 CreateOrUpdateOrganisation 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 \
  -d '
  {
    "datasetUuid": "rM/IlHhOSQiHoQFiUHv6ww==",
    "organisation": {
      "name": "Example Telecom",
      "countryName": "Norway",
      "countryInitials": "NOR",
      "tadigs": [
        {
          "tadig": "EXMPL",
          "mccmncs": [
            {
              "mcc": "242",
              "mnc": "01"
            }
          ],
          "realms": [
            "epc.mnc001.mcc242.3gppnetwork.org"
          ],
          "gtPrefixes": [
            "4790000000"
          ]
        }
      ],
      "comment": "Example organisation for documentation"
    }
  }
  ' \
  sandbox.api.shamrock.wgtwo.com:443 \
  wgtwo.ir21.v1.Ir21Service/CreateOrUpdateOrganisation

package com.example.ir21

import com.google.protobuf.ByteString
import com.wgtwo.api.v1.common.networkIdentity
import com.wgtwo.api.v1.ir21.Ir21ServiceGrpcKt
import com.wgtwo.api.v1.ir21.createOrUpdateOrganisationRequest
import com.wgtwo.api.v1.ir21.organisation
import com.wgtwo.api.v1.ir21.tadig
import io.grpc.ManagedChannelBuilder
import io.grpc.Status
import io.grpc.StatusException
import kotlinx.coroutines.runBlocking
import kotlin.test.assertFailsWith

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

fun main() = runBlocking {
    // First create a dataset
    val createDatasetRequest = com.wgtwo.api.v1.ir21.createDatasetRequest {
        comment = "Dataset for organisation example"
    }
    val createDatasetResponse = stub.createDataset(createDatasetRequest)
    val createdDatasetUuid = createDatasetResponse.uuid

    val createOrUpdateOrganisationRequest = createOrUpdateOrganisationRequest {
        datasetUuid = createdDatasetUuid
        organisation = organisation {
            name = "Example Telecom"
            countryName = "Norway"
            countryInitials = "NOR"
            tadigs += tadig {
                tadig = "EXMPL"
                mccmncs += networkIdentity {
                    mcc = "242"
                    mnc = "01"
                }
                realms += "epc.mnc001.mcc242.3gppnetwork.org"
                gtPrefixes += "4790000000"
            }
            comment = "Example organisation for documentation"
        }
    }
    println("createOrUpdateOrganisationRequest:
$createOrUpdateOrganisationRequest")

    val createOrUpdateOrganisationResponse = stub.createOrUpdateOrganisation(createOrUpdateOrganisationRequest)
    println("createOrUpdateOrganisationResponse:
$createOrUpdateOrganisationResponse")

    // Test error case - empty dataset UUID
    val createOrUpdateOrganisationRequestWithEmptyDataset = createOrUpdateOrganisationRequest {
        datasetUuid = ByteString.EMPTY
        organisation = organisation {
            name = "This should fail"
        }
    }

    val exception = assertFailsWith<StatusException>("exception is not a StatusException") {
        stub.createOrUpdateOrganisation(createOrUpdateOrganisationRequestWithEmptyDataset)
    }

    assert(exception.status.code == Status.INVALID_ARGUMENT.code) {
        "status code is not INVALID_ARGUMENT: ${exception.status.code}"
    }
}

Example Results Success

{
  "uuid": "aCboRAlOSrSjYgkmLaQXVw=="
}
uuid: "aCboRAlOSrSjYgkmLaQXVw=="

Example Results Error

ERROR:
  Code: InvalidArgument
  Message: dataset_uuid is required
Status code: INVALID_ARGUMENT
Status description: dataset_uuid is required

Read More