TMF630_REST_API_Design_Guidelines_Part_4_v4.0.0
TMF630_REST_API_Design_Guidelines_Part_4_v4.0.0
TMF630
Team Approved Date: Nov. 25th, 2020
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.
Executive Summary
This document, “REST API Design Guidelines Part 4” provides information for the development of TM
Forum APIs using REST.
It provides recommendations and guidelines for the implementation of the Common Export and Import
Tasks and the Entity Lifecycle Management related patterns.
Conventions
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
"RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC
2119 [RFC2119].
Two common task resources are defined: * ImportJob used to import resources from a File * ExportJob
used to export resources to a File
“query”: ”type=productOffering&version=2.0”
../catalogManagement/catalog/42
file://host/path
../catalogManagement/catalog/42
file://host/path
An ExportJob can be attached to a specific Catalog in a Catalog application or may be attached to the
Product Offerings within a Catalog.
• ../catalogManagement/catalog/42/exportJob
• ../catalogManagement/catalog/42/productOffering/exportJob
For example:
REQUEST
POST catalogManagement/catalog/\{10}/exportJob
Content-type: application/json
{
}
RESPONSE
201
Content-Type: application/json
Location: /api/catalogManagement/exportJob/54
{
id": "54",
"href": "/catalogManagement/exportJob/54",
"status": "running",
“path”: “catalogManagement/catalog/10" ,
“content-type”: “application/json”,
"errorLog": "",
“creationDate” : “2013-04-19T16:42:23-04:00",
“completionDate” : “",
"url": "ftp://ftp.myCatalog.com/productCatalog/54"
}
For example, to apply the content of the import file to the catalog 10:
REQUEST
POST catalogManagement/catalog/\{10}/importJob
Content-type: application/json
{
}
RESPONSE
201
Content-Type: application/json
Location: /api/catalogManagement/importJob/554
{
"id": "554",
"href": "/catalogManagement/importJob/554",
"status": "running",
“path”: “catalogManagement/catalog/10" ,
“content-type”: “application/json”,
"errorLog": "",
“creationDate” : “2013-04-19T16:42:23-04:00",
“completionDate” : “",
"url": "ftp://ftp.myCatalog.com/productCatalog/partner54"
}
For example:
REQUEST
GET API/catalogManagement/exportJob/\{10}
Accept: application/json
RESPONSE
REQUEST
GET /catalogManagement/importJob/\{25}
Accept: application/json
RESPONSE
{ +
"id": "25", +
"status": "Succeeded"
}
For example:
REQUEST
POST /client/listener
Accept: application/json
{
"event": {
"id": "54",
"href": "/catalogManagement/exportJob/54",
"status": "running",
“path”: “catalogManagement/catalog/{10}" ,
“content-type”: “application/json”,
"errorLog": "",
“creationDate” : “2013-04-19T16:42:23-04:00",
“completionDate” : “", +
"url": "ftp://ftp.myCatalog.com/productCatalog/54"
},
"eventType": "exportJobCompleted"
}
REQUEST
POST /client/listener
Accept: application/json
{
"event": {
"id": "554",
"href": "/catalogManagement/importJob/554",
"status": "running",
“path”: “catalogManagement/catalog/10" ,
“content-type”: “application/json”,
"errorLog": "",
“creationDate” : “2013-04-19T16:42:23-04:00",
“completionDate” : “2013-04-19T16:42:23-04:15",
"url": "ftp://ftp.myCatalog.com/productCatalog/partner54"
},
"eventType": "importJobCompleted"
}
For example, the same Product Offerings may exist in a Catalog but with different version numbers.
It may be possible for an administrator to see all the existing versions or for a partner to see only a
subset of all the existing versions.
The entity version number is not dependent on the version number of the API. For example, in PLM the
same API (running at a specific version number) may be used to retrieve entities with different PLM
version numbers.
In order to distinguish resources representing entities running with different version numbers and
accessible though the same API version the following directive can be used /id:(version=x) and the
version attribute is added to each entity.
{
"id": "42",
"href": "/catalogManagement/productOffering/42",
"version": "1.0",
"lastUpdate": "2013-04-19T16:42:23-04:00",
"name": "Virtual Storage Medium",
"description": "Virtual Storage Medium",
"isBundle": "true",
"lifecycleStatus": "Active"
}
Note that the resources in this case may have the same ID but may be distinguished by the inclusion of
the version number in their ID i.e /42:(version=1.0), /42:(version=2.0).
In the following examples we will assume that two versions of the VirtualStorage Product Offer exist in
the Product Catalog an Inactive and Active version respectively version 1.0 and version 2.0.
Users with different roles may have access to different versions of the entities in the catalog. For
example, user A may have access to only the version 1.0 of the entities while user B may have access to
version 1.0 and version 2.0.
For example, the following request on the admin endpoint will return all the versioned resources
matching a specific ID.
REQUEST
GET api/admin/catalogManagement/productOffering/?id=VirtualStorage
Accept: application/json
RESPONSE
200
Content-Type: application/json
[{
"id": " VirtualStorage ",
"href": "/catalogManagement/productOffering/VirtualStorage",
"version": "1.0",
"lastUpdate": "2013-04-19T16:42:23-04:00",
"name": "Virtual Storage Medium",
"description": "Virtual Storage Medium",
"isBundle": "true",
"lifecycleStatus": "InActive",
},
{
"id": " VirtualStorage ",
"href": "/catalogManagement/productOffering/ VirtualStorage ",
"version": "2.0",
"lastUpdate": "2013-04-19T16:42:23-04:00",
"name": "Virtual Storage Medium",
"description": "Virtual Storage Medium",
"isBundle": "true",
"lifecycleStatus": "Active",
}]
It may be possible for an admin API user to retrieve a resource with a specific version number by using
an ID and versioning filtering criteria.
REQUEST
GET api/admin/catalogManagement/productOffering/?id=VirtualStorage&version=1.0
Accept: application/json
RESPONSE
200
Content-Type: application/json
[{
"id": "42",
"href": "/catalogManagement/productOffering/42",
"version": "1.0",
"lastUpdate": "2013-04-19T16:42:23-04:00",
"name": "Virtual Storage Medium",
"description": "Virtual Storage Medium",
"isBundle": "true",
"lifecycleStatus": "Active"
}]
REQUEST
GET api/admin/catalogManagement/productOffering/VirtualStorage
Accept: application/json
RESPONSE
200
Content-Type: application/json
{
"id": "42",
"href": "/catalogManagement/productOffering/42",
"version": "2.0",
"lastUpdate": "2013-04-19T16:42:23-04:00",
"name": "Virtual Storage Medium",
"description": "Virtual Storage Medium",
"isBundle": "true",
"lifecycleStatus": "Active"
}
The constraint is that the version numbers for the resource having the same ID must differ.
REQUEST
POST catalogManagement/productOffering
Content-type: application/json
{
“id”: “VirtualStorage”,
"version": "3.0",
"name": "Virtual Storage Medium",
"description": "Virtual Storage Medium",
"isBundle": "true",
"lifecycleStatus": "Active",
"validFor": {
"startDateTime": "2013-04-19T16:42:23-04:00",
"endDateTime": "2013-06-19T00:00:00-04:00"
}
}
RESPONSE
201
Content-Type: application/json
{
"id": "VirtualStorage",
"href": "/catalogManagement/productOffering/42",
"version": "3.0",
"lastUpdate": "2013-04-19T16:42:23-04:00",
"name": "Virtual Storage Medium",
"description": "Virtual Storage Medium",
"isBundle": "true",
"lifecycleStatus": "Active",
"validFor": {
"startDateTime": "2013-04-19T16:42:23-04:00",
"endDateTime": "2013-06-19T00:00:00-04:00"
},
}
To update a specific version of an entity the (Version=X) directive is added to the ID (i.e /id:(version=x).
Note that this capability is only available to API users having the proper authorizations to change the
catalog entities with specific version numbers.
REQUEST
PATCH /catalogManagement/productOffering/VirtualStorage(Version=1.0)
Content-type: application/json-patch+json
{
"lifecycleStatus": "Active"
...
}
RESPONSE
201
Content-Type: application/json
{
"id": "VirtualStorage",
"href": "/catalogManagement/productOffering/VirtualStorage",
"version": "1.0",
"lifecycleStatus": "Active",
...
}
For example, if they issue a get on a catalog that a party has no access they get an error response
Or if they try to modify an area of the catalog but do not have Write Access they get an error response
We anticipate that the OAUTH2 or Open ID Connect will be used as the authorization APIs and that ACL
are established between authorized parties with regards to the content of the Catalog (i.e., GET but also
enable of update operations on specific entities).
This section records the changes between this and the previous document version as it is edited by the
team concerned. Note: this is an incremental number which does not have to match the release number
and used for change control purposes only.
3.3. Acknowledgments
This document was prepared by the members of the TM Forum [team name] team: