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
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!
Observe how the request area is changing while new elements of test case appears
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.
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
The json request is validated according to syntax. In case error the message appears bellow request text area.
By indentation toggle button user can display request in raw or indented form.
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.
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 name | Type | Description |
---|---|---|
freeTextSearch | String (max 200 chars) | Works only if supported by API method. Words, space divided, used to search trough database, used by Live search functionality |
limit | Positive int | Works only if supported by API method. Maximum number of records in one response, used for pageing in table rendering. |
offset | Positive int | Works only if supported by API method. Start offset used for paging in table rendering. |
statistics | boolean | Indicate if statistics should be measured during call. Statistics are send back in response JSON body. |
fields | String (max 200 chars) | Subset of response fields. Provide field names coma divided. The response body will be limited only to these fields. |
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
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 value | Description |
---|---|
conversionTime | Time required to convert incoming JSON from UTF-8/UTF-16 to DBCS coding |
ParsingTime | Time required for parsing JSON |
prepareToCallProgram | Time required to do necesarry preparation before RPG API program can be called. Like Open files by crossref, security check ,etc…) |
callProgram | Actual API program time |
JSONbuilderTime | Time required to gather generated program bata and build response json in memory |
If the API method handles paging then some values can appear in response body in “control” node:
Response control value | Type | Description |
---|---|---|
total | Integer | Total number of records in database (table) regardless how many was returned. |
more | boolean | True, 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
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.
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:
Option | Description |
---|---|
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. |
Encoding | Boolean value. If false then UTF-8 is used. If true then UTF-16 is used. The recommended value is UTF-8 |
Bulk | Specify 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 request | Boolean 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. |