Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
TiaXu
Product and Topic Expert
Product and Topic Expert

Series – TMS:

Create a service instance of TMS with Standard plan, then create a service key:

 

image-20240604140818338.png

Use service key details to obtain OAuth token to access TMS APIs:

Access Token URL: <url>/oauth/token
Client ID: <clientid>
Client Secret: <clientsecret>

Let's take some examples for your reference, for other APIs, please see: SAP Business Accelerate Hub - Cloud Transport Management API.

 

Example - Get versions

Method: GET

URL: <uri>/versions

Header: 'Authorization': 'Bearer <xxxxxx>'

Response:

{
    "supportedVersions": [
        {
            "version": "1",
            "path": "v1"
        },
        {
            "version": "2",
            "path": "v2"
        }
    ]
}

Example - Get nodes

Method: GET

URL: <uri>/v2/nodes

Header: 'Authorization': 'Bearer <xxxxxx>'

Response:

{
    "nodes": [
        {
            "id": 3,
            "name": "DEV_NODE",
            "uploadAllowed": true,
            "notificationEnabled": false,
            "forwardMode": "AUTO",
            "importDisabled": false,
            "importDisabledReason": "",
            "targets": [],
            "virtual": false
        },
        {
            "id": 6,
            "name": "PROD_NODE",
            "uploadAllowed": false,
            "notificationEnabled": false,
            "forwardMode": "AUTO",
            "importDisabled": false,
            "importDisabledReason": "",
            "targets": [
                {
                    "id": 7,
                    "contentType": "MTA",
                    "destinationName": "TMSTarget_CPICN40",
                    "importOptions": {
                        "strategy": "default"
                    }
                }
            ],
            "virtual": false
        }
    ]
}

Example - Get destinations

Method: GET

URL: <uri>/v2/destinations

Header: 'Authorization': 'Bearer <xxxxxx>'

Example - Get transport request

Method: GET

URL: <uri>/v2/nodes/<nodeId>/transportRequests?status=<status>

nodeId: Get from API <uri>/v2/nodes

status:

  • in - Initial
  • ru - Running
  • re - Repeatable
  • su - Succeeded
  • sk - Skipped
  • wa - Warning
  • er - Error
  • fa - Fatal
  • de - Deleted

Header: 'Authorization': 'Bearer <xxxxxx>'

Response:

{
    "transportRequests": [
        {
            "id": 305,
            "status": "initial",
            "archived": false,
            "position": 9,
            "createdBy": "c7cab313-bfcb-4eac-9386-08a841ee9d57",
            "createdByNamedUser": "377275f0-acbc-445e-8bff-1514da41db9f",
            "createdAt": "2024-06-04T06:24:14.707Z",
            "queuedAt": "2024-06-04T06:24:15.099Z",
            "description": "TiaTesttoTransportPackage - sample",
            "origin": "DEV_NODE",
            "entries": [
                {
                    "id": 308,
                    "storageType": "FILE",
                    "contentType": "MTA",
                    "uri": "299"
                }
            ]
        }
    ]
}

Example - Import

Method: POST

URL: <uri>/v2/nodes/<nodeId>/transportRequests/import

Header: 'Authorization': 'Bearer <xxxxxx>'

Body:

{
  "namedUser": "Tia",
  "transportRequests": [
    305
  ]
}

Get transport request ID from the APIs like <uri>/v2/nodes/<nodeId>/transportRequests?status=<status>

Response:

{
    "actionId": 280,
    "monitoringURL": "/v2/actions/280"
}

Example - Upload file from local to TMS

Method: POST

URL: <uri>/v2/files/upload

Header:

  • 'Authorization': 'Bearer <xxxxxx>'
  • 'file': file.zip
  • 'namedUser': 'Tia'

Useful Links

Help Portal - Integration of SAP Cloud Transport Management Using APIs

SAP Business Accelerate Hub - Cloud Transport Management API

SAP Business Accelerate Hub - Cloud Transport Management Version Endpoint API