> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/tposs/6.14/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/tposs/6.14/api-reference/subscriber_api.md).

# Subscriber API

This API may be used to provision subscribers and thereafter manage the
subscriber objects. The API provides CRUD functionality to manage subscriber
information. The following data model is exposed to the consumer:

```
   object Subscriber {
      SubscriberId : string
      IbsId : string
      UserId : string
      IMSI : string
      IMEI : string
      Username : string
      ChargingAccountId : string
      Carname : string
      Homecountry : string
      CustomerProfile : string
      PortalVersion : uint64
      PrimaryDNS: string
      SecondaryDNS: string
   }
```

| Attribute | Description
|---|---
| SubscriberId | Will be given by the 3rd party system AAX. 1:1 relation with `IbsId`.
| IbsId | The GCPID (The Global Customer Platform ID Uniquely identifies a customer) from the 3rd party system IBS. On account creation the IbsId will be saved on the AAX customer object and then will be updated by AAX on the subscriber object in UDR. 1:1 relation with `SubscriberId`.
| UserId | The `UserId` will be given by the 3rd party system AAX.
| IMSI | Unique identifier of a SIM card.
| IMEI | Unique identifier of a user device (15 digits).
| Username | The `IMSI` Code is used as Username.
| ChargingAccountId | The `ChargingAccountId` will be given by the 3rd party system AAX.
| Carname | An alphanumeric name for the car. This name is an additional attribute for the user account.
| Homecountry | ISO 3166-1 Alpha-2 code of user home country
| CustomerProfile | The `CustomerProfile` attribute allows grouping of subscribers. The attribute can hold arbitrary string values. One example use- case for these value is a subscriber-specific selection of portal (FPS) instances. The value "" (empty string) is the semantic default.
| PortalVersion | The `PortalVersion` attribute is an integer-value which allows a per subscriber version-specification for portal redirection purposes. The zero value is the semantic "default".
| PrimaryDNS | DNS server to use for this Subscriber, overwrites the PrimaryDNS from the service profile
| SecondaryDNS | Secondary (fallback) DNS server to use for this Subscriber, overwrites the SecondaryDNS from the service profile

## Methods

### Subscriber.Create

Registers a new subscriber with the given subscriber information. While
`SubscriberId` and `UserId` must always be unique, a subscriber may be
registered for multiple `UserId` s. In that sense the unique identification of
a subscriber object is done by considering both `SubscriberId` and `UserId`.

Following parameters could be passed:

| Name | Type | Requirement | Note |
|---|---|---|---|
| AuthKey | AuthKey | required | Pre-shared authentication key. |
| FeId | String | required | Static frontend identifier which should be unique to the system.
| FeSId | String | required | Dynamic frontend session identifier which should be reset upon system startup.
| IbsId | String | optional | Unique IBS identifier. |
| UserId | String | required | Unique user identifier. |
| IMSI | String | required | Unique IMSI of SIM card. |
| IMEI | String | optional | Unique identifier of a user device (15 digits). |
| Username | String | required | Unique username. |
| ChargingAccountId | String | required | The Charging account must exist before |
| | | | referencing it in this method. |
| Carname | String | optional | Name for user car. |
| Homecountry | String | optional | ISO 3166-1 Alpha-2 code of user home country. |
| CustomerProfile | String | optional | Grouping criteria for subscribers useable for subscriber-specific selection of portal (FPS) instances. Passing the value "" (empty string) will be semantically equivalent with not passing this attribute.
| PortalVersion | uint64 | optional | Determine the version of the portal instance used for this subscriber. Passing a zero value will be semantically equivalent with not passing this  attribute.
| PrimaryDNS | String | optional | DNS server to use for this Subscriber, overwrites the PrimaryDNS from the service profile |
| SecondaryDNS | String | optional | Secondary (fallback) DNS server to use for this Subscriber, overwrites the SecondaryDNS from the service profile |

Example of request:

```
   $ curl -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d
     '{
         "id": "1", "jsonrpc": "2.0",
         "method": "Subscriber.Create",
         "params": {
            "AuthKey": "secret",
            "FeId": "TPUIBrowser",
            "FeSId": "TPUIBrowser",
            "SubscriberId": "700030010@subscriber.<tenant>",
            "IbsId": "700030010@subscriber.<tenant>",
            "UserId": "701976710@user.<tenant>",
            "IMSI": "262019876543210",
            "IMEI": "354311050022709",
            "Username": "262019876543210",
            "ChargingAccountId": "700032310@account.charging.<tenant>",
            "Carname": "my car",
            "Homecountry": "DE",
            "CustomerProfile": "OEM Customer",
            "PortalVersion": 2,
            "PrimaryDNS": "8.8.8.8",
            "SecondaryDNS": "16.16.16.16"
         }
      }' http://127.0.0.1:12001
```

Example of response:

```
   {
      "id": "1", "jsonrpc": "2.0",
      "result": "true"
   }
```

In a case of error following error codes could be returned:

- `-31404` - Duplicate subscriber
- `-31405` - Duplicate user
- `-31406` - Duplicate username
- `-31409` - Duplicate IMSI

### Subscriber.Read

Returns the object information for the subscriber object associated with the
given `SubscriberId` and `UserId`. Returns an error if no associated
subscriber object can be found.

Following parameters could be passed:

| Name | Type | Requirement | Note |
|---|---|---|---|
| AuthKey | AuthKey | required | Pre-shared authentication key. |
| FeId | String | required | Static frontend identifier which should be unique to the system.
| FeSId | String | required | Dynamic frontend session identifier which should be reset upon system startup.
| IbsId | String | optional | Unique IBS identifier. |
| UserId | String | required | Unique user identifier. |

Example of request:

```
   $ curl -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d
     '{
         "id": "1", "jsonrpc": "2.0",
         "method":"Subscriber.Read",
         "params": {
            "AuthKey": "secret",
            "FeId": "TPUIBrowser",
            "FeSId": "TPUIBrowser",
            "UserId": "701976710@user.<tenant>"
         }
      }' http://127.0.0.1:12001
```

Example of response:

```
   {
      "id": "1", "jsonrpc": "2.0",
      "result": {
         "SubscriberId": "700030010@subscriber.<tenant>",
         "IbsId": "700030010@subscriber.<tenant>",
         "UserId": "701976710@user.<tenant>",
         "IMSI": "262019876543210",
         "IMEI": "354311050022709",
         "Username": "262019876543210",
         "ChargingAccountId": "700032310@account.charging.<tenant>",
         "Carname": "Emma’s car",
         "Homecountry": "DE",
         "CustomerProfile": "OEM Customer",
         "PortalVersion": 2,
         "PrimaryDNS": "8.8.8.8"
      }
   }
```

In a case of error following error codes could be returned:

- `-31401` - Private user not found.

### Subscriber.Delete

Deletes all information associated with a given subscriber Id. Returns an error
if no subscriber can be found.

Following parameters could be passed:

| Name | Type | Requirement | Note |
|---|---|---|---|
| AuthKey | AuthKey | required | Pre-shared authentication key. |
| FeId | String | required | Static frontend identifier which should be unique to the system.
| FeSId | String | required | Dynamic frontend session identifier which should be reset upon system startup.
| IbsId | String | optional | Unique IBS identifier. |
| UserId | String | required | Unique user identifier. |

Example of request:

```
   $ curl -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d
     '{
         "id": "1", "jsonrpc": "2.0",
         "method":"Subscriber.Delete",
         "params": {
            "AuthKey": "secret",
            "FeId": "TPUIBrowser",
            "FeSId": "TPUIBrowser",
            "SubscriberId": "700030010@subscriber.<tenant>",
            "UserId": "701976710@user.<tenant>"
         }
      }' http://127.0.0.1:12001
```

Example of response:

```
   {
      "id": "101", "jsonrpc": "2.0",
      "result": "true"
   }
```

In a case of error following error codes could be returned:

- `-31401` - Subscriber not found

### Subscriber.Update

Updates the subscriber information for a subscriber object. The primary key for
this update operation is a combination of the given `SubscriberId` and
`UserId`. Returns an error if no associated subscriber cannot be found or an
update fails.

| Name | Type | Requirement | Note |
|---|---|---|---|
| AuthKey | AuthKey | required | Pre-shared authentication key. |
| FeId | String | required | Static frontend identifier which should be unique to the system.
| FeSId | String | required | Dynamic frontend session identifier which should be reset upon system startup.
| IbsId | String | optional | Unique IBS identifier. |
| UserId | String | required | Unique user identifier. |
| IMSI | String | required | Unique IMSI of SIM card. |
| IMEI | String | optional | Unique identifier of a user device (15 digits). |
| Username | String | required | Unique username. |
| ChargingAccountId | String | required | The Charging account must exist before |
| | | | referencing it in this method. |
| Carname | String | optional | Name for user car. |
| Homecountry | String | optional | ISO 3166-1 Alpha-2 code of user home country. |
| CustomerProfile | String | optional | Grouping criteria for subscribers useable for subscriber-specific selection of portal (FPS) instances. Passing the value "" (empty string) will be semantically equivalent with not passing this attribute.
| PortalVersion | uint64 | optional | Determine the version of the portal instance used for this subscriber. Passing a zero value will be semantically equivalent with not passing this  attribute.
| PrimaryDNS | String | optional | DNS server to use for this Subscriber, overwrites the PrimaryDNS from the service profile |
| SecondaryDNS | String | optional | Secondary (fallback) DNS server to use for this Subscriber, overwrites the SecondaryDNS from the service profile |

Example of request:

```
   $ curl -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d
     '{
         "id": "1", "jsonrpc": "2.0",
         "method": "Subscriber.Update",
         "params": {
            "AuthKey": "secret",
            "FeId": "TPUIBrowser",
            "FeSId": "TPUIBrowser",
            "SubscriberId": "700030010@subscriber.<tenant>",
            "IbsId": "700030010@subscriber.<tenant>",
            "UserId": "701976710@user.<tenant>",
            "IMSI": "262019876543210",
            "IMEI": "354311050022709",
            "Username": "262019876543210",
            "ChargingAccountId": "700032310@account.charging.<tenant>",
            "Carname": "my car",
            "Homecountry": "DE",
            "CustomerProfile": "OEM Customer",
            "PortalVersion": 2,
            "PrimaryDNS": "8.8.8.8"
         }
      }' http://127.0.0.1:12001
```

Example of response:

```
   {
      "id": "1", "jsonrpc": "2.0",
      "result": "true"
   }
```

In a case of error following error codes could be returned:

- `-31401` - Subscriber not found
- `-31409` - Duplicate IMSI

### Subscriber.List

Returns a list of subscribers. If the number of results exceeds the internal query limit, only an
initial subset will be returned. Returns an error if no valid query parameter is passed.

| Name | Type | Requirement | Note |
|---|---|---|---|
| AuthKey | AuthKey | required | Pre-shared authentication key. |
| FeId | String | required | Static frontend identifier which should be unique to the system.
| FeSId | String | required | Dynamic frontend session identifier which should be reset upon system startup.
| Limit | uint16 | optional | Specify the maximum size of the result set. |
| Offset | uint16 | optional | Number of results to be skipped in the result set. |
| Sort | string | optional | Define Sorting |
| Filter | string | optional | Define Filter |
| Fields | string | optional | Define list of fields to be returned. |

Example of request:

```
   $ curl -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d
     '{
         "id": "1", "jsonrpc": "2.0",
         "method":"Subscriber.List",
         "params": {
            "AuthKey": "secret",
            "FeId": "TPUIBrowser",
            "FeSId": "TPUIBrowser",
            "Filter": "SubscriberId:is:700030010@subscriber.<tenant>"
         }
      }' http://127.0.0.1:12001
```

Example of response:

```
   {
      "id": "1", "jsonrpc": "2.0",
      "result": {
         "TotalResults": 1,
         "Subscribers": [
            {
               "SubscriberId": "700030010@subscriber.<tenant>",
               "IbsId": "700030010@subscriber.<tenant>",
               "UserId": "701976710@user.<tenant>",
               "IMSI": "262019876543210",
               "IMEI": "354311050022709",
               "Username": "262019876543210",
               "ChargingAccountId": "700032310@account.charging.<tenant>",
               "Carname": "Emma’s car",
               "Homecountry": "DE",
               "CustomerProfile": "OEM Customer",
               "PortalVersion": 2,
               "PrimaryDNS": "8.8.8.8"
            }
         ]
      }
   }
```

In a case of error following error codes could be returned:

- `-31411` - Invalid list Query. This error may occur under different
   circumstances such a wrong format of a `Filter` expression, unknown field
   passed to `Fields`, `Sort` or `Filter`, and etc.
