REST API

Representational State Transfer (REST) is an architectural design standard for creating web services.
Since version 2.5.4, Int4 IFTT provides REST API for accessing test scenarios, test cases, and test runs data.
Before using the API, activate the SICF /sap/bc/int4/iftt/v1. This setting can be done in /INT4/IFTT_CUST transaction or directly in SICF.

Data format

IFTT REST API returns data in JSON or XML format. Default format is JSON. To retrieve data in XML format use HTTP request header: key= Accept, value= application/xml

CSRF Protection

All changing requests (PUT, POST, and DELETE) require a CSRF (Cross-Site Request Forgery) token to be included in the request header.
The token can be obtained by sending a GET request with HTTP request header: key= X-CSRF-Token, value= fetch.
The CSRF token is then returned in the same header and can be used for subsequent calls. If a valid token is not present in X-CSRF-Token header on a changing call, the server will respond with an HTTP 403 ("Forbidden") return code.

Int4 IFTT REST API endpoints:

Scenarios (folders) API

Entry point: /sap/bc/int4/iftt/v1/scenarios

  1. Read single scenario by id

GET /sap/bc/int4/iftt/v1/scenarios/{id}

Example request: /sap/bc/int4/iftt/v1/scenarios/825

Example response:

{ "DATA": [ { "SCNRID": "0000000825", "PARENTID": "0000000000", "ATTR1": "", "ATTR2": "", "ATTR3": "", "ATTR4": "", "ATTR5": "", "DESCR": "Cloud Platform Integration Tests", "CREATED_ON": "2020-03-19", "CREATED_TIME": "12:25:37", "CREATED_BY": "TEST_USER", "LANDSCAPE_ID": "DEV" } ] }

2. Read list of scenarios

GET /sap/bc/int4/iftt/v1/scenarios

Query options:

Parameter

Description

Parameter

Description

SCNRID

Filter based on folder ID

PARENTID

Filter based on parent folder ID

ATTR1 - ATTR5

Filter based on attributes (1-5)

DESCR

Filter based on Description

q

Filter based on Description (text search)

$children

true/false (default false)

Include subfolders in the result list

$expandLevels

[1..9999]

number of levels to expand the hierarchy ( used if $children=true ) ( default 1)

Example requests:
GET /sap/bc/int4/iftt/v1/scenarios
return all scenarios

GET /sap/bc/int4/iftt/v1/scenarios?PARENTID=0
return all top-level scenarios

GET /sap/bc/int4/iftt/v1/scenarios?DESCR=Test
return all scenarios with name Test

GET /sap/bc/int4/iftt/v1/scenarios?q=SD
return all scenarios with ‘SD’ in description

GET /sap/bc/int4/iftt/v1/scenarios/825?$children=true&$expandLevels=2
return scenario with ID 825 and all scenarios up to 2 levels below

Example response:

{ "DATA": [ { "SCNRID": "0000000670", "PARENTID": "0000000000", "ATTR1": "", "ATTR2": "", "ATTR3": "", "ATTR4": "", "ATTR5": "", "DESCR": "__REGRESSION", "CREATED_ON": "2020-01-12", "CREATED_TIME": "11:49:53", "CREATED_BY": "USER1", "LANDSCAPE_ID": "DEV" }, { "SCNRID": "0000000676", "PARENTID": "0000000670", "ATTR1": "", "ATTR2": "", "ATTR3": "", "ATTR4": "", "ATTR5": "", "DESCR": "Unit Tests", "CREATED_ON": "2020-01-29", "CREATED_TIME": "09:23:47", "CREATED_BY": "USER2", "LANDSCAPE_ID": "TEST" } ] }

Test case API

Entry point: /sap/bc/int4/iftt/v1/testcases

  1. Read single test case by id

GET /sap/bc/int4/iftt/v1/testcases/{id}

Example request: /sap/bc/int4/iftt/v1/testcases/23019

Example response:

{ "DATA": [ { "CASEID": "0000023019", "SCNRID": "0000000712", "DESCR": "Purchase Order TC#1", "DOCNUM": "127a8e11-af73-1ed9-afda-c812044c6280", "OBJDEFID": "IF0101_EDI_SPLIT", "CREATED_ON": "2020-02-28", "CREATED_TIME": "17:33:25", "CREATED_BY": "TEST_USER1", "IFTYPE": 1, "PARENT_CASEID": "", "ORIG_SYSTEM": "SD1CLNT001", "ORIG_CASEID": "0000003874", "LANDSCAPE_ID": "TEST", "ORIG_LANDSCAPE_ID": "TEST", "LAST_RUN_ID": "12C695B4CC1C1EDB9FBA6EDB6B02258E", "LAST_STARTED_BY": "TEST_USER2", "LAST_STARTED_DATE": "2020-03-05", "LAST_STARTED_TIME": "16:54:36", "LAST_STATUS": "E", "LAST_STATUS_TXT": "Failed" } ] }

2. Read list of test cases

GET /sap/bc/int4/iftt/v1/testcases

Query options:

Parameter

Description

Parameter

Description

CASEID

Filter based on test case ID

SCNRID

Filter based on folder ID

DESCR

Filter based on test case description

DOCNUM

Filter based on document number (e.g. PI message ID)

OBJDEFID

Filter based on automation object

IFTYPE

Filter based on test type

PARENT_CASEID

Filter based on parent test case ID

q

Filter based on Description (text search)

$includeSubfolders

true/false (default false)

Include testcases from subfolders in the result list (used if SCNRID is provided)

Example requests:
GET /sap/bc/int4/iftt/v1/testcases
return all test cases

GET /sap/bc/int4/iftt/v1/testcases?descr=UAT TC#1
return test case with description ‘UAT TC#1’

GET /sap/bc/int4/iftt/v1/testcases?scnrid=1015&$includeSubfolders=true
return all test cases from folder 1015 and subfolders

GET /sap/bc/int4/iftt/v1/testcases?iftype=20
return all PI Unit Tests ( test type 20)

GET /sap/bc/int4/iftt/v1/testcases?q=sync
return all test cases with ‘sync’ in description

 

3. Read test case results

GET /sap/bc/int4/iftt/v1/testcases/{id}/results

Example request: /sap/bc/int4/iftt/v1/testcases/23019/results

 

4. Read test case content (payloads)

GET /sap/bc/int4/iftt/v1/testcases/{id}/contenttypes

Example request: /sap/bc/int4/iftt/v1/testcases/23019/contenttypes

 

5. Download test case payload

GET /sap/bc/int4/iftt/v1/testcases/{id}/contenttypes/{contentId}

Example request: /sap/bc/int4/iftt/v1/testcases/23019/contenttypes/p00
contentId can be obtained by calling /testcases/{id}/contenttypes endpoint

 

6. Read test case variables ( user defined values from Cockpit )

GET /sap/bc/int4/iftt/v1/testcases/{id}/variables

Example request: /sap/bc/int4/iftt/v1/testcases/23019/variables

Test results API

Entry point: /sap/bc/int4/iftt/v1/testruns

  1. Read single test run results by id

GET /sap/bc/int4/iftt/v1/testruns/{id}

Example request: /sap/bc/int4/iftt/v1/testruns/127A8E11AF731EDB8FD86C2C365C63CE

Example response:

2. Read list of test results

GET /sap/bc/int4/iftt/v1/testruns

Query options:

Parameter

Description

Parameter

Description

RUN_ID

Filter based on test run ID

NAME

Filter based on test run name

TYPE

Filter based on test run type

STARTED_BY

Filter based on user ID starting the run

STARTED_DATE

Filter based on test run date

STARTED_FROM

Filter based on test run date

STARTED_TO

Filter based on test run date

q

Filter based on test run name (text search)

$includeDetails

true/false (default false)

Include detailed test results ( test case level)

Example requests:

GET /sap/bc/int4/iftt/v1/testruns/12C695B4CC1C1EDB8CDCDE287F4C2547?$includeDetails=true
return test run detailed results

GET /sap/bc/int4/iftt/v1/testruns?q=UAT
return all test runs with ‘UAT’ in description

GET /sap/bc/int4/iftt/v1/testruns?STARTED_DATE=2020-12-01
return all test runs started on 2020-12-01

GET /sap/bc/int4/iftt/v1/testruns?STARTED_FROM=2020-11-25&STARTED_TO=2020-11-30
return all test runs started between 2020-11-25 and 2020-11-30

Test execution API

Entry point: /sap/bc/int4/iftt/v1/testruns

POST /sap/bc/int4/iftt/v1/testruns
( requires valid CSRF token )

Request body (payload) - JSON representation of structure /INT4/IFTT_ST_REST_TEST_RUN_CR:

The use of parameters is the same as for RFC API.

Response: test run result in the same format as returned by Test results API

Example request payloads:

Execute a single test case:

Execute a single test case on a specific landscape:

Execute single test case with parameters

Execute all test cases from a specific folder and all sub-folders:

Execute all test cases from a specific folder and all sub-folders asynchronously. In this case, API returns the Test Run ID immediately. Status and results can be checked using
GET /sap/bc/int4/iftt/v1/testruns/{TestRunID}

 

© 2017 - 2022 Int4 AG All rights reserved