Add a usage counter definition to a plan definition

This POST operation adds a usage counter to an existing plan definition. A usage counter measures a plan definition’s usage either via volume or time.

If successful, you receive an HTTP response code of 201 as well as a JSON response body showing the information passed in the JSON request payload.

See HTTP response codes for other response codes.

POST /pcc/spcm/planDefinitions/<planDefinitionId>/usageCounterDefinitions + JSON request payload


HEADER INFO

tenant: <tenantName>

authorisation: HTTP Basic Auth

content-type: application/JSON

accept: application/hal+JSON

permissions: SPCM_PLAN_DEFINITION_CREATE_PERMISSION

URL parameters

There is one mandatory parameter.

Parameter Type Description

planDefinitionId

integer

A unique identifier for a plan definition which was assigned by the server upon creating the plan definition.

JSON request payload

The following example shows a usage counter named fairUsageCounter added to whatever plan definition you passed in the planDefinitionId parameter in the URL.

All key:value pairs shown below are mandatory with the exception of absoluteResetTime. See Usage counter definition descriptions for descriptions.


{
    "name": "fairUsageCounter",
    "timeUnit": "NONE",
    "unitMeteringType": "VOLUME",
    "usageScope": "PLAN",
    "absoluteResetTime": "00:00:00"
}


JSON response

The following example shows our JSON response from the above JSON request payload. Note the id added.

{
    "id": 42,
    "name": "fairUsageCounter",
    "timeUnit": "NONE",
    "unitMeteringType": "VOLUME",
    "usageScope": "PLAN",
    "absoluteResetTime": "00:00:00",
    "_links": {
        "self": {
        "href": "http://localhost:8080/spcm-rest-ws/pcc/spcm/planDefinitions/
        167/usageCounterDefinitions/715"
        },
        "pccProfiles": {
        "href": "http://localhost:8080/spcm-rest-ws/pcc/spcm/planDefinitions/
        167/usageCounterDefinitions/715/pccProfiles"
        }
    }
}


Usage counter definition type descriptions

Field Type Description

id

integer

The unique identifier for the usage counter. This is assigned by the server upon creation.

mandatory

name

string

The name of the usage counter.

mandatory

timerUnit

string

The timer unit being measured such as DAY, WEEK, MONTH, or NONE.

mandatory

unitMeteringType

string

The type of usage being counted. This can be time (seconds), volume (bytes), or credit (lowest denomination of local currency, e.g, $1 = 100 units).

mandatory

usageScope

string

The scope of this particular usage rule.

options
  • PLAN = count all usage on this plan

  • PROFILE = count the usage of a pcc profile

mandatory

absoluteResetTime

string

Specifies a specific time at which the counter should be reset. Format = hh:mm:ss.

It defaults to NULL which indicates the counter resets relative to the plan lifecycle.

HTTP response codes

Code Description

201/204

success!

If you receive a 204 code, you will not see a JSON response.

207

Multistatus response

Check out HTTP statuses for more details.
This is not applicable to all operations.

400

malformed request

401

unauthorised; bad username or password

403

forbidden; user does not have appropriate privileges

404

usage counter definition not found

409

conflict with target resource

This often occurs if the item already exists, such as a plan, group, or name.
This is not applicable to all operations.

412

failed validation; this typically means that a property was not set or a value is out of range.

example
HTTP 412
{
  "errors" : [
        {
          "field" : "name",
          "description" : "name is mandatory"
        }
    ]
}

422

failed processing (after passing validation).

example
HTTP 422
{
    "message": "Subscriber max plan count exceeded",
    "errorCode": 1
}

500

internal error

example
HTTP/1.1 500
{
    "message": "Internal server error - [Failed to get session information]",
    "status": "error"
}

503

request rejected due to overload