REST HTTP Interface - Products

Provisioning of Products is supported via a REST HTTP Interface which is implemented using the standard HTTP methods  GET ,  PUT ,  POST  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.





















Updating a UDR

Updates are made using PUT.

Deleting a UDR

Deleting a UDR is done by using the DELETE method.

Clearing an Area

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

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>. 

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

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:



Error code

Description

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:



Error code

Description

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:



Error code

Description

Error code

Description

200

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

When updating a UDR:



Error code

Description

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:



Error code

Description

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.