Requests

API requests testing panel

On this panel you can test API Requests. Picture bellow shows al the features you can find on API tool request panel.

Request panel overview

Creating new test case

On the left side of request tab there are groupped fields connected to test case. User can create its own test cases and save them. Click on add button then provide Your own test case name:

Crating new test case

Provide API method name, then click on add parameter button to enter API method parameters. The APi method parmeters are String by default. To enter numeric or boolean value just delete quotes. The parameter name should be provided without quotes. If the parameter is highlited then delete button appears. You can delete highlited parameter

NOTE: API method name is case sensitive!

Crating new test case - adding parameters

Example of parameters

Observe how the request area is changing while new elements of test case appears

Test case vales generates request payload

Click save test case button to save your test case. The test case is saved on dispatcher. It will appear on drop down list every time you log in to the same dispatcher.

Browse though test cases

Sending request and view response

On right side of panel there are request and response areas. The request area is open for editing. User can enter any payload he wants into request text area. Then the json is analysed and mapped to the right side of panel (parameters). Complex structure of request is always mapped to simple parameters, see picture bellow

Complex request mapped to simple parameters

The json request is validated according to syntax. In case error the message appears bellow request text area.

Syntax error in request json

By indentation toggle button user can display request in raw or indented form.

Raw or indented view

Click send button to send request to BIMi. In response area, You can see response from server. You can choose one of three views: Raw or expandable tree or table.

Raw response view

Tree response view

Table response view

The statistics displayed above response represents: Total time for service resopnse including latency between browser client and bridge. Second statistic is program time, means only time for call IBMi program from bridge.

Use garbage icon to clean response text area.

Statistics

Controls

In the left botom corner there is expandable controls area. This section represents control section of request. List of parameters in control section is predefined.

Parameter nameTypeDescription
freeTextSearchString (max 200 chars)Works only if supported by API method. Words, space divided, used to search trough database, used by Live search functionality
limitPositive intWorks only if supported by API method. Maximum number of records in one response, used for pageing in table rendering.
offsetPositive intWorks only if supported by API method. Start offset used for paging in table rendering.
statisticsbooleanIndicate if statistics should be measured during call. Statistics are send back in response JSON body.
fieldsString (max 200 chars)Subset of response fields. Provide field names coma divided. The response body will be limited only to these fields.

Control section

All what is entered in control section has reflection in request body. Al teh parameter valeues are placed in “control” node of request

Control section reflects to request

The control section influence on response

Statistics

If the control parameter “statistics” is set to true, then response JSON has additional node “control”. This node contains measured time for specific elements of RPG program.

NOTE: All figures are in microseconds.

Response control valueDescription
conversionTimeTime required to convert incoming JSON from UTF-8/UTF-16 to DBCS coding
ParsingTimeTime required for parsing JSON
prepareToCallProgramTime required to do necesarry preparation before RPG API program can be called. Like Open files by crossref, security check ,etc…)
callProgramActual API program time
JSONbuilderTimeTime required to gather generated program bata and build response json in memory

The control section in response incliding statistics figures

Paging

If the API method handles paging then some values can appear in response body in “control” node:

Response control valueTypeDescription
totalIntegerTotal number of records in database (table) regardless how many was returned.
morebooleanTrue, if there are more records in database than was returned. False if all records were returned. Or last record was returned in case of using offset.

NOTE: Either “total” or “more” are returned. Total number of records is returned if calculation of total records are accessible. for example count numbe rof records in table. wore vaue is returned in case it is impossible to count toal records or calculation will slow dond process.

There is 9609 records in items table

Response was limited to 10 rows. more = true because there are more orders in database

Settings

To open settings panel You can click on little “settings” button on the right upper corner of request area or choose this option from hamburger menu.

Setings button or menu option

The settings are used to configure various elements of communication between API tool and IBMi backend programs.

Settings panel

Following options are possible to configure:

OptionDescription
Buffer (bytes)Set size of buffer which is used to exchange data between aperio Middle layer (bridge) and Backen layer (IBMi). The default value is “auto”, means communication engine will automatically calculate most suitable buffer size. Other otions are 4096, 8192, 16384, 32766 bytes.
EncodingBoolean value. If false then UTF-8 is used. If true then UTF-16 is used. The recommended value is UTF-8
BulkSpecify how many requests will be send after “Send” button is pressed. The default value is 1. To check performance programmer can change it to any number and measure time of call API one after another. This test can be performed to check memory leaks and other issues connected to massive attacks to the system.
Verify requestBoolean value. Frue means The rtest case request devinition is veryfied with API metadata. If there are parameters which are mandatory in call, then API Tool will not allow run request until all mandatory parameters are not provided.

Mandatory parameter 'item' was not provided