REST HTTP Interface - Products

Provisioning of Products is supported via a REST HTTP Interface which is implemented using the standard HTTP methods  GETPUTPOST  and  DELETE . The interface supports XML and JSON formats, and enables external systems to provision and update Products.

The REST HTTP Interface runs on the EC Web Interface and is started when the EC process is started. Authentication is performed against the Platform, if possible. If the Platform is unreachable, the user is authenticated against the locally defined user (configured in  EC web interface properties).

The UDRs available in the Products REST Interface are:

  • Capacity

  • Enforcement

  • Notification

  • Product

  • ProductMapping

To retrieve one UDR:

http://<host>:<port>/PCC/Products/<area>/<udr-type>/<udr-id>

To retrieve all UDRs of a certain type:

http://<host>:<port>/PCC/Products/<area>/<udr-type>

Note!

In the examples in this chapter, HTTP/1.0 have been used, but REST supports HTTP/1.1 as well.

Creating a UDR

A UDR can be created by sending data to the HTTP Interface using POST to the base URL for the resource. The response will be the created UDR. Default format for the response is XML if nothing is specified. The format of the response is determined by the Accept HTTP header.

Example - Creating a ProductMapping UDR in area TEST using XML

POST http://localhost:9090/PCC/Products/TEST/ProductMapping HTTP/1.0 
Content-Type: application/xml 

The xml-data should be structured as follows:
<ProductMapping> 
	<Priority>1</Priority> 
	<Arguments>Arg 1</Arguments> 
	<Arguments>Arg 2</Arguments> 
	<Targets>1000</Targets> 
	<Targets>1001</Targets>
</ProductMapping>

Example Creating a ProductMapping UDR in area TEST using JSON

POST http://localhost:9090/PCC/Products/TEST/ProductMapping HTTP/1.0
Content-Type: application/json

The json-data should be structured as follows:
{
    "Priority": 20,
    "Arguments": [
        "21",
		"22"
    ],
    "Targets": [
        101,
        200
    ]
}

Retrieving a UDR

The format of the response is determined by the  Accept  HTTP header.

Retrieving all Capacity UDRs in area TEST as JSON

GET http://localhost:9090/PCC/Products/TEST/Capacity/ HTTP/1.0 
Accept: application/json
Example output:


{                 
     "Capacitys": [                   
         { 
             "Misc": {          
                "entry": [                   
                     {
                        "key": "qht",
                         "type": "int",
                        "value": "600"
                     }
                 ]
             },  
             "ID": 1001,     
             "Name": "4GB Roaming",>
             "Capacity": 10240,
             "CapacityUnit": 1,>
             "CounterType": 2,
             "CounterUnit": 1,
             "QuotaDefault": 1024,
             "QuotaMinimum": 256
         },
         {         
             "Misc": {          
                 "entry": [
                     {
                         "key": "qht",
                         "type": "int",
                         "value": "1850"
                     }                   
                 ]
             },  
             "ID": 1002,     
             "Name": "5GB national",
             "Capacity": 5120,
             "CapacityUnit": 1,
             "CounterType": 2,
             "CounterUnit": 1,
             "QuotaDefault": 4096,
             "QuotaMinimum": 2048
         }
     ]          
 }


Retrieving a specific Capacity UDR in area TEST as JSON

GET http://localhost:9090/PCC/Products/TEST/Capacity/1024 HTTP/1.0 
 Accept: application/json Example output:
{
    "Misc": {
        "entry": [
            {
                "key": "vqt",
                "type": "double",
                "value": "0.2"
            },
            {
                "key": "qht",
                "type": "int",
                "value": "600"
            }            
        ]
    },
    "ID": 1024,
    "Name": "10GB Roaming",
    "Capacity": 10240,
    "CapacityUnit": 1,
    "CounterType": 2,
    "CounterUnit": 1,
    "QuotaDefault": 1024,
    "QuotaMinimum": 256
}

Retrieving all Enforcement UDRs in area TEST as JSON

GET http://localhost:9090/PCC/Products/TEST/Enforcement HTTP/1.0 
Accept: application/json

Example output:

{
    "Enforcements": [
        {
            "ID": 1001,
            "Name": "Enf100%",
            "CounterType": 2,
            "Level": 1
        },
        {
            "ID": 1002,
            "Name": "Enf0%",
            "CounterType": 2,
            "Level": 0
        },              
    ]
}


Retrieving a specific Enforcement UDR in area TEST as JSON

GET http://localhost:9090/PCC/Products/TEST/Enforcement/1001 HTTP/1.0 
Accept: application/json


Example output:

{
    "ID": 1001,
    "Name": "Enf100%",
    "CounterType": 2,
    "Level": 1
}

Retrieving all Notification UDRs in area TEST as JSON

GET http://localhost:9090/PCC/Products/TEST/Notification HTTP/1.0 
Accept: application/json


Example output:

{
    "Notifications": [
        {
            "ID": 1001,
            "Name": "Surf Europe 4GB 80%",
            "Message": "TH_80",
            "CounterType": 2,
            "Level": 0.8,
            "Required": true,
            "Type": "0",
            "Address": "127.0.0.1"
        },
        {
            "ID": 1002,
            "Name": "Surf Europe 4GB 100%",
            "Message": "TH_100_1",
            "CounterType": 2,
            "Level": 1.0,
            "Required": true,
            "Type": "0",
            "Address": "127.0.0.1"
        },  
    ]
}

Retrieving a specific Notification UDR in area TEST as JSON

GET
http://localhost:9090/PCC/Products/TEST/Notification/1001 HTTP/1.0 
Accept: application/json


Example output:

{
    "ID": 1001,
    "Name": "Surf Europe 4GB 80%",
    "Message": "TH_80",
    "CounterType": 2,
    "Level": 0.8,
    "Required": true,
    "Type": "0",
    "Address": "127.0.0.1"
}

Retrieving all Product UDRs in area TEST as JSON

GET http://localhost:9090/PCC/Products/TEST/Product HTTP/1.0 
Accept: application/json


Example output:

{
    "Products": [
        {
            "Misc": {
                "entry": []
            },
            "ID": 1001,
            "Name": "Surf Europe",
            "StartTime": "2010-05-08 00:00",
            "StopTime": "2020-12-12 00:00",
            "StopFallthrough": false,
            "Currency": "SEK",
            "Capacities": [
                3
            ],
            "Duration": 24,
            "DurationUnit": 2,
            "ResetType": 1,
            "ResetInterval": 1,
            "ResetIntervalUnit": 1,
            "Price": 0,
            "Enforcements": [1],
            "Notifications": [1,2],
            "RetainedCounters": 0,
            "StopAtCapacity": false
        },
        {
            "Misc": {
                "entry": []
            },
            "ID": 1002,
            "Name": "Surf Europe",
            "StartTime": "2010-05-08 00:00",
            "StopTime": "2020-12-12 00:00",
            "StopFallthrough": false,
            "Currency": "SEK",
            "Capacities": [4],
            "Duration": 24,
            "DurationUnit": 2,
            "ResetType": 1,
            "ResetInterval": 1,
            "ResetIntervalUnit": 1,
            "Price": 0,
            "Enforcements": [1],
            "Notifications": [3,4],
            "RetainedCounters": 0,
            "StopAtCapacity": false
        }
    ]
}



Retrieving a specific Product UDR in area TEST as JSON

GET http://localhost:9090/PCC/Products/TEST/Product/1001 HTTP/1.0 
Accept: application/json


Example output:

{
    "Misc": {
        "entry": []
    },
    "ID": 1001,
    "Name": "Surf Europe",
    "StartTime": "2015-05-08 00:00",
    "StopTime": "2020-12-12 00:00",
    "StopFallthrough": false,
    "Currency": "SEK",
    "Capacities": [3],
    "Duration": 24,
    "DurationUnit": 2,
    "ResetType": 1,
    "ResetInterval": 1,
    "ResetIntervalUnit": 1,
    "Price": 0,
    "Enforcements": [1],
    "Notifications": [1,2],
    "RetainedCounters": 0,
    "StopAtCapacity": false
}



Retrieving all ProductMapping UDRs in area TEST as JSON

GET http://localhost:9090/PCC/Products/TEST/ProductMapping HTTP/1.0 
Accept: application/json


Example output:

{
    "ProductMappings": [
        {
            "ID": 1001,
            "Priority": 1,
            "Arguments": [".*"],
            "Targets": [1001,1002]
        },
        {
            "ID": 1002,
            "Priority": 2,
            "Arguments": [".*"],
            "Targets": [1003,1004]
        }
    ]
}

Retrieving a specific ProductMapping UDR in area TEST as JSON

GET http://localhost:9090/PCC/Products/TEST/ProductMapping/1001  HTTP/1.0
Accept: application/json


Example Output:

{
    "ID": 1001,
    "Priority": 1,
    "Arguments": ["Arg 1","Arg 2"],
    "Targets": [1001,1002]
}



Updating a UDR

Updates are made using PUT.

Example Updating a ProductMapping UDR in area TEST using XML

PUT http://localhost:9090/PCC/Products/TEST/ProductMapping/<id> HTTP/1.0
Content-Type: application/xml
Content-Length: 185

The format of the xml-data should be structured as follows:

<ProductMapping>
    <Priority>1</Priority>
    <Arguments>Arg 1</Arguments>
    <Arguments>Arg 2</Arguments>
    <Targets>1000</Targets>
    <Targets>1001</Targets>
</ProductMapping>
      

Deleting a UDR

Deleting a UDR is done by using the DELETE method.

Example Deleting a ProductMapping UDR with a specific key in area TEST

DELETE http://localhost:9090/PCC/Products/TEST/ProductMapping/<id> HTTP/1.0

Clearing an Area

Clearing an area is done with a HTTP DELETE call to /PCC/Products/<source area>/admin/clear. 

Example Clearing area TEST.

DELETE http://localhost:9090/PCC/Products/TEST/admin/clear HTTP/1.0

Copy One Area to Another

Copying one area to another is done with a HTTP PUT call to /PCC/Products/<source area>/admin/copyArea?dest=<destination area>. 

Example Copying data from TEST to PROD.

PUT http://localhost:9090/PCC/Products/TEST/admin/copyArea?dest=PROD HTTP/1.0
Content-Length: 0

Error Codes

There are several different codes that can be returned for the different operations.

For admin commands:

http://<host>:<port>/PCC/Products/<area>/admin/clear
http://<host>:<port>/PCC/Products/<area>/admin/copyArea
http://<host>:<port>/PCC/Products/<area>/admin/refresh

Error code

Description

200

Will be returned if the last operation was successful.

500

Will be returned if there was an error.

When creating a UDR:

http://<host>:<port>/PCRF/Rules/<area>/<udr-type>

Error code

Description

201

Will be returned if the UDR was created.

409

Will be returned if a UDR with the stated key already exists, or if there are dependencies missing.

415

Will be returned if the UDR key is of type string and the key is missing, or if the key type is incorrect.

500

Will be returned if the UDR requires references that are missing, or if there was an error.

When retrieving one UDR:

http://<host>:<port>/PCRF/Rules/<area>/<udr-type>/<id>

Error code

Description

200

Will be returned if the requested UDR was found.

204

Will be returned if there is no UDR with the stated ID.

500

If there was an error.

When retrieving all UDRs:

http://<host>:<port>/PCRF/Rules/<area>/<udr-type>

Error code

Description

200

Will be returned with an empty list or with a list containing the UDRs.

When updating a UDR:

http://<host>:<port>/PCRF/Rules/<area>/<udr-type>/<id>

Error code

Description

200

Will be returned if the UDR was updated successfully.

408

Will be returned if the keys in the URL and the XML are different, or the key in the URL is set to "0".

409

Will be returned if the UDR requires references that are missing, or if there is not UDR with the stated key.

500

Will be returned if there was an error.

When deleting a UDR:

http://<host>:<port>/PCRF/Rules/<area>/<udr-type>/<id>

Error code

Description

200

Will be returned if the UDR was deleted successfully.

204

Will be returned if there is no UDR with the stated key.

409

Will be returned if the UDR is referenced by another UDR.

500

Will be returned if there was an error.