Template API REST Specification
Template API REST Specification
This document and translations of it may be copied and furnished to others, and derivative works that
comment on or otherwise explain it or assist in its implementation may be prepared, copied, published,
and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice
and this section are included on all such copies and derivative works. However, this document itself may
not be modified in any way, including by removing the copyright notice or references to TM FORUM,
except as needed for the purpose of developing any document or deliverable produced by a TM FORUM
Collaboration Project Team (in which case the rules applicable to copyrights, as set forth in the TM
FORUM IPR Policy, must be followed) or as required to translate it into languages other than English.
The limited permissions granted above are perpetual and will not be revoked by TM FORUM or its
successors or assigns.
This document and the information contained herein is provided on an "AS IS" basis and TM FORUM
DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY
OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE.
4 Century Drive
Suite 100
Parsippany, NJ 07054, USA
Tel No. +1 973 944 5100
Fax No. +1 973 944 5110
TM Forum Web Page: www.tmforum.org
Introduction ...................................................................................................................................................... 5
Provide Sample Example from Profile Template. From the Profile when we have it.
For every single resource managed by the API provide a JSON based representation of the
managed entities and tasks.
Also remember that you representation must be based on the SID at least from a conceptual
view point.
For example the SMAPI 2.0 use the following Management Report representation:
“id”: « 42 »,
"health_state": "operational",
"metrics": [
"code": "123",
"category_id": "45",
"reference": "4321",
"source_id": "8f27ce50-4b00-11e2-bcfd-0800200c9a66",
"value": 50,
"metric_id": "b0dbbc50-4b00-11e2-bcfd-0800200c9a66"
},
"code": "321",
"category_id": "48",
"source_id": "8f27ce50-4b00-11e2-bcfd-0800200c9a66",
"value": 50,
"metric_id": "c50f3e90-4b00-11e2-bcfd-0800200c9a66"
],
"failures": [
"failure_id": "0bec4420-4b01-11e2-bcfd-0800200c9a66",
"source_id": "24b2bc00-4b01-11e2-bcfd-0800200c9a66"
},
"failure_id": "3b687c50-4b01-11e2-bcfd-0800200c9a66",
"source_id": "462f1f40-4b01-11e2-bcfd-0800200c9a66"
},
Field Description
CustomerAccountRelationship
«SystemEnt» «SystemEnt»
PaymentMeans Balance
CustomerAccount
«SystemAtt» «SystemAtt»
- id :String - id :String + creditLimit
- name :String - name :String + pin :String
«Rose_Property»
+ ID :String
CustomerBillSpecBalance + name :String
CustomerBillSpecPaymentMeans
«SystemAss» 1 + accountType :String
«SystemAss» + accountStatus :String
{bag}
«SystemEnt»
relatedParty BillSpecifiedBy
CustomerBillSpec *
{bag}
«SystemAtt»
CustomerBillSpecRelatedParty + name :String
- role :String
+ validFor :TimePeriod CustomerBillSpecCurrency «SystemEnt»
- partyRole :String «SystemAss»
«SystemAtt» «SystemAss» Currency
- id :String
- ratingType :String «SystemAtt»
* - state :String - currencyCode :String
{bag}
CustomerBillSpecMediaBasedUpon
CycleSpecSchedulesCreationOfBillDescribedBy «SystemAss»
1
{bag}
* CustomerBillSpecAppearanceBasedUpon
{bag} *
CustomerBillPresentationMedia
{bag}
CustomerBillingCycleSpecification CustBillFormatAppearsBasedUpon + name :String
«SystemAtt»
+ name :String CustomerBillFormat - id :String
+ billingDateShift :Integer * 1..*
+ name :String
«SystemAtt» + description :String {bag} {bag}
- id :String
- frequency :String
For every single event supported by the API provide a JSON based representation of the
managed event.
You can start with an XML representation but remember that the default representation will be
JSON.
Remember that the Pub/Sub models are common and described in the TMF REST Design
Guidelines.
For example the SMAPI 2.0 use the following Management Report Event representation:
{
"event": {
"dateTime": null,
"id": "42",
"state": {
"healthState": "UNKNOWN",
"executionState": "ACTIVE"
},
"metrics": [
{
"code": "76e27e2b-644e-11e2-8ea1-5c260a86d1e4",
"categoryID": null,
"dateTime": 1367266835571,
"reference": null,
"sourceID": null,
"value": "20",
"metricID": null
},
{
"code": "7987c7bc-644e-11e2-8ea1-5c260a86d1e4",
"categoryID": null,
"dateTime": 1367266835573,
"reference": null,
"sourceID": null,
"value": "60000",
"metricID": null
},
{
},
"eventType": "ManagementReport"
}
Field Description
For every single of operation on the entities use the following templates and provide sample
REST requests and responses.
Other Request Methods POST on TASK Resource GET and POST must not
be used to tunnel other
request methods.
Filtering and attribute selection rules are described in the TMF REST Design Guidelines.
This Uniform Contract operation is used to retrieve the representation of a managed entity or a
task.
Note that collections can be retrieved via GET /API/<RESOURCE> with no {ID}
Description :
Behavior :
REQUEST
RESPONSE
200
Content-Type: application/json
{
JSON Resource Representation
}
PUT API/{RESOURCE}/{ID}
Description :
Behavior :
REQUEST
PUT API/{RESOURCE}/{ID}
Content-type: application/json
{
JSON Resource Representation with every attributes
}
RESPONSE
201
Content-Type: application/json
PATCH API/{RESOURCE}/{ID}
This Uniform Contract operation is used to partially update the representation of a managed
entity or a task.
Description :
Specify which attributes are patchable using the following table (to capture RO attributes)
ratingType No
Name Y
CustomerBillingCycleSpecification.id Y
CustomerBillFormat Y
CustomerBillPresentationMedia Y
Currency code Y
PaymentMeans Y
Further document any rules that must be implemented when patching attributes.
"isBilled": "False",
"ratingAmountType": "Total",
"isTaxExempt": "false",
"offerTariffType": "Normal"
PATCH API/{RESOURCE}/{ID}
Content-type: application/json
{
JSON Resource Representation with every attributes
}
RESPONSE
201
Content-Type: application/json
POST API/{RESOURCE}/{ID}
Description :
Behavior :
ID Management :
Specify the attributes required when an entity is created (and their default values if not):
ratingType N Postpaid
Name N Customer
name
CustomerBillFormat N Standard
invoice
CustomerBillPresentationMedia N Electronic
invoice
PaymentMeans N Customer
choice
POST Conditional Mandatory When a usage record is created with a status of rated
Values or billed, the following attributes are mandatory:
"ratingDate", "taxIncludedRatingAmount",
"taxExcludedRatingAmount, "taxRate", "currencyCode ",
"productRef",
POST API/{RESOURCE}
Content-type: application/json
{
JSON Resource Representation with every mandatory attributes
}
RESPONSE
201
Content-Type: application/json
DELETE API/{RESOURCE}/{ID}
Description :
Behavior :
REQUEST
DELETE API/{RESOURCE}/{ID}
RESPONSE
200
For every single of operation on the entities use the following templates and provide sample
REST notification POST calls.
It is assumed that the Pub/Sub uses the Register and UnRegister mechanisms described in the
REST Guidelines reproduced below.
Description :
Sets the communication endpoint address the service instance must use to deliver
information about its health state, execution state, failures and metrics. Subsequent
POST calls will be rejected by the service if it does not support multiple listeners. In
this case DELETE /api/hub/{id} must be called before an endpoint can be created
again.
Behavior :
REQUEST
POST /api/hub
Accept: application/json
{"callback": "http://in.listener.com"}
RESPONSE
201
Content-Type: application/json
Location: /api/hub/42
{"id":"42","callback":"http://in.listener.com","query":null}
Description :
Clears the communication endpoint address that was set by creating the Hub.
Behavior :
REQUEST
DELETE /api/hub/{id}
Accept: application/json
RESPONSE
204
Description :
Behavior :
Returns HTTP/1.1 status code 201 if the service is able to set the configuration.
REQUEST
POST /client/listener
Accept: application/json
"event": {
EVENT BODY
},
"eventType": "eventType"
}
201
Content-Type: application/json
Release 1.0 04/15/2013 Pierre Gauthier First Release of Draft Version of the
Document.
TM Forum
pgauthier@tmforum.org