For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

You are reading Travelping Open Subscriber Server 6.19, an older release. The newest release is 6.20. Read this page in 6.20

JSON-RPC 2.0 API

TPOSS provides the following RPC APIs:

All the RPC APIs are accessible through the TPOSS API Gateway component and not directly through TPOSS. All the APIs follow a uniform design. This design is meant to ease the adoption and consumption of the different APIs that TPOSS API Gateway exposes. The APIs are based on open protocols and common concepts to lower the barrier for developers.

All APIs follow the JSON-RPC 2.0Opens in a new tab protocol. The protocol itself is implemented by client libraries in various programming languages. The JSON-RPC 2.0 protocol specification defines the message flow between a client and a server. Whenever APIs require notification-like message behaviour, the Request-ResponseOpens in a new tab pattern is used to support endpoint acknowledgement as defined by the JSON-RPC 2.0 protocol. The notification messages defined in JSON-RPC 2.0 aren’t used. Since JSON-RPC 2.0 defines a message identification used to match Request-Response pairs, it is possible to multiplex RPC calls between a single client and the TPOSS server.

Each RPC API call is an HTTP POST request with the following fields:

  • jsonrpc - a string specifying the JSON-RPC protocol version. It must be 2.0.
  • id - an identifier established by the client that must contain a number.
  • method - a string representing the name of the RPC method implemented by TPOSS.
  • params - a set of RPC call parameters.

The TPOSS APIs define RPC methods with their parameters and return types that the clients can call remotely. Whenever a client sends a request to the TPOSS API Gateway server, it can expect a response for that request. The underlying messaging protocol defines how a response is matched to a particular request.

Naming rules

Parameter and attribute names are written in camel case. For example:

  • ChargingAccountId
  • Sort

Method names are prefixed with the API namespace they are part of. For example:

  • Subscriber.Read
  • Cdr.List

Frontend identifiers

All the API requests require clients to identify themselves against the API. For this reason, clients may use identifiers that are then handled as opaque data by TPOSS. TPOSS uses these identifiers for request authorization and logging.

Clients must pass these two frontend identifiers in each request:

  • FeId (Frontend Identifier) - must be a static value associated with the client application. For example: CFP12.
  • FeSId (Frontend Session Identifier) - must be a dynamic value generated at the client's startup. It allows TPOSS to detect malfunctioning client behaviour and allows easier auditing of request logs.

Authentication

TPOSS APIs are authenticated based on secret API keys. Before a client is authenticated, it needs an authentication key. Such a key must be configured in the TPOSS API configuration by a TPOSS operator. Each request must contain the AuthKey field and the FeId field to authenticate the API user. Both authentication identifiers are configured at the TPOSS side using the following configuration option:

yaml

The tposs_http_api.secret_keys is a list of the FeId and AuthKey split by a dash and separated by a comma. For example, in clientid-secret, the clientid is FeId and the secret is AuthKey. If the client does not provide them or provides unknown values for TPOSS, TPOSS returns the -33333 Not authenticated error.

After you configure TPOSS with the given API authentication keys, you must share the keys with the client so that it can use these keys for API requests. This procedure is out-of-band and not handled by the authentication API itself. Once an authentication key is obtained, a client can use it for authenticated API requests. All the TPOSS API methods require an authentication key to be passed along with the other parameters.

API parameters

All the TPOSS APIs have a set of defined input parameters described in the corresponding API documents. The parameters marked as required must be passed to the method; otherwise, TPOSS returns an error. The optional parameters are marked as optional and can be omitted in the API calls. TPOSS ignores input parameters that are not defined for the API method with no impact on the result of the API method execution. All the values that are not valid for an API method result in the error response. Additionally, the log message with the parameter and the parameter's value is printed at least at the logging level - debug.

The most API methods support a set of common parameters to enable clients to narrow down request result sets as needed. These common parameters are:

  • Limit
  • Offset
  • Sort
  • Filter
  • Fields

You can refer to the individual API specifications to find out which API methods support these parameters.

Limit

The Limit parameter allows the client to specify an upper limit on the number of records returned in a response.

Offset

The Offset parameter allows the client to specify a number of objects to skip before collecting the result entries. The offset is taken into account after sorting if the Sort parameter is passed.

Sort

The Sort parameter allows the client to sort the results according to an attribute in the directions asc (ascending) or desc (descending). For example:

text

This parameter allows you to sort the API request results according to IMSI from lower to higher values.

Filter

The Filter parameter allows the client to apply specific filtering rules to the result. The following filter operations are supported:

  • is - equal to
  • lte - lower than or equal to
  • lt - lower than
  • gte - greater than or equal to
  • gt - greater than
  • ends_with - ends with a given pattern
  • starts_with - starts with a given pattern
  • contains - contains a given pattern

The ends_with, starts_with, and contains filter operators allow you to specify a pattern to match. For example:

text

or

text

All these filter operators work only with the string data but not with dates, timestamps, and IP addresses.

It's possible to specify more than one filter. Comma-separated filters are evaluated like logical and. For example:

text

You may use this filter to get a session by a given NAT IP address and one known NAT port.

Fields

The Fields parameter allows the client to specify a list of object attributes (separated by colons) which should be returned by a query. By removing attributes from irrelevant results, you can execute more efficient queries.

For example:

text

or:

text

or:

text

Common error scenarios

Despite each TPOSS API method may have its own set of possible errors, all the APIs methods share common error scenarios:

  • Authentication key not valid - If the authentication key can’t be verified for the calling client, the server does not allow a client to access the requested API method. In this case, the -33333 error code is returned.
  • Required field missed - If a request should contain mandatory input parameters and at least one of them is missing, the server doesn't allow a client to access the requested API method. In this case, the -30000 error code is returned.
  • Type mismatch error - If a request has input parameters and at least one of their values has the wrong data type, the -31810 error code is returned with the related error message.

All the possible errors related to the API methods are described in the respective TPOSS API documents.