The Work With API Mathods (WRKPAPIMTH) command is used to maintani API metadata. In API matadata panel You can describe API program interface. Attributes can be defined either on general or method level.
NOTE: The (DSPAPIMTH) Display API Methods command shows the same data as WRKAPIMTH command but only with ability to display data. No possobility to maintain data.
NOTE: There is one parameter to this command: Subset selection (SUBSET). Following values are suported:
SUBSET | Description |
---|---|
*TOP | (default) Each method is dieplayed only once regardless how many version of the same method are defined across subsets. Only methods defined for the highest (top) subsed are displayed. |
*ALL | All methods defined for all subsed are displayed. |
On the main panel the API method, sequence and program are displayed. The sequence is the numeric equivalent of subset. Following subsets are by default preloaded to Aperio:
Subset | Sequence | Description |
---|---|---|
*CUSTLOCAL | 1 | Customer dev, single sites |
*CUSTCORP | 2 | Customer dev, multiple sites |
*IBSLOCAL | 3 | Iptor dev, signle site (Reserved for Iptor development) |
*IBSCORP | 4 | Iptor dev, multiple sites (Reserved for Iptor development) |
*COUNDELTA | 5 | Country dev, delta release (Reserved for Iptor development) |
*COUNTRY | 6 | Country dev, base release (Reserved for Iptor development) |
*INTDEV | 7 | International development (Reserved for Iptor development) |
*STDDELTA | 8 | Iptor standard, delta release (Reserved for Iptor development) |
*STANDARD | 9 | Iptor standard, base release (Reserved for Iptor development) |
*APIBASE | 99 | Base API level (Reserved only for internal Aperio API methods) |
Note: Only *CUSTLOCAL and *CUSTCORP can be used by customers to define their own methods.
Form the main panel You can maintain the API method definition. Api method (program) parameters. It actualy describes the program interface. There is also possibility to maintain atributes defined on header level of method. Function keys leads You to the additional panels.
Funstion key | Description of panel |
---|---|
F7=General Config | General configuration of Aperio. See WRKAPICFG command |
F8=Info | Main information about current installation of Aperio backend. You can see there list of all elements of Aperio backend with their current location and version. Additionally there are statistics (Number of requests issud last day, month and year) |
F9=General Attributes | List of general attributes supported by all methods by default. Support of these attributes are incorporated inside Aperio backend and is not depend on program |
F10=Common Parameters | Definition of common parameters which can be supported API program. Programer of RPG program can decide which of these parameters will be supported by RPG program. Each of common parameter is supported in Aperio frontend (mobile application generator). See common parameters description. |
The Work with API Methods commands shows the datail description of RPG program interface. The program interface is retrieven on the fly dirrectly from RPG source code of program. There is general rule of showing data on WRKAPIMTH panels. The values can be displayed normaly or highlithed. If the value is highlited it means is retrieven from metadata files. Then it can be deleted or manualy changed. If the value is not highlited then it comes dirrctly from RPG source…. It still can be overwritten but can not be deleted. The main reccomendation is to not overwrite data which comes form RPG source. The best way is to change RPG source if needed. There are sometimes some cases where You have to overwite ptogram definition manually in metadata. It is allowed but not reccomended. Following options are available:
Option | Description |
---|---|
1=Add | Add new API method |
2=Change | Change API Method |
4=Delete | Delete API method. Note: Delete option will also delete all security set up connected to this method |
5=Display | Display API method |
6=Parameters | Work with parameters |
7=Attributes | Work with method attributes |
8=Generate meta pseudo source | Generate meta pseudo source |
9=Export methods | Exports marked methods as objects to library or as save file. See Export chosen methods. See also EXPAPIDTA and IMPAPIDTA commands description |
The attributes defined on method level are used in runtime. For this reason all attributes on method header level are kept in metadata in files even it hey orginates from RPG source. Note, all attributes on method header level are highlited. Following attributes are supported:
Attribute | Type of value | Description |
---|---|---|
control | text | List of supported control parameters coma divided. For example if program supports paging it should support following control parameters: offset, limit, total |
httpMethod | text (DELETE, GET, PATCH, POST, PUT) | One http method can be chosen. This method is used to generate openApi definition |
openCrossRef | Boolean (true, false) | This attribute is strivtly connected to DC1 application. Inside DC1 we use crossref functionality to open files prior call program. This opening files process is also acompanied with security check. Most of DC1 programs require to open crossref befre they are caled. By default all programs which are existing in DC1 has this attribute set to true. If YOu use Aperio without DC1 set this attribute to false. There is exit program which opens files using crossref. (exit program id = S0001001). If in your environment You have any program which opens files prior call your program You can build Your own exit program. Then the openCrossRef can be set to true. |
openFiles | text | This attribute can be used instead of openCrossRef. You can define list of files coma divided which must be open prior your RPG program is called. NOTE: All files listed here wil be open for maximum access (Read and Write and Add) |
structure | text (array, object) | Defines the response structure. |
tags | text | Informational field only. Not connected to any functionality. It can contain list of tags (words) which describes Your API. fr example describe the module DIS, GEN, etc… |
This functionality allows You to generate pseudo source of your RPG program. The pseudo source will contain only metadata information (no any source code). This option is helpfull if You want to deliver Your API to the customer installation without source of program. Then you can generate pseudo source and deliver it. The other option is to speed up the metadata retcrievel process. It may happen that RPG program is long and fetch all information about interface of program dirrectly from source code will take long time. To speed up this process You can generate pseudo source and then use it one as reference to retrieve metadata informaton. The third case is, when You keep sources in format which can’t be for some reason analysed by Aperio metadata retrieval program. You can generate pseudo source and manually store there all description (parameters/attriutes) which are required.
NOTE: The generation of pseudo source will first clear current pseudo source then write information based on original program source. If You can’t access to original source, then do not use this option because it may clear your current pseudo source.
There is Exit program (id = R0034001) which is used to locate RPG program source. The following search order in included in this exit program:
NOTE: The first source file searched is QMETASRC. It means if there is pseudo source generated, then it wil be taken into consideration instead of original source.
You can write Your own exit program which will follow your rules of finding RPG program source.
The pseudo source can be generated to any destination location. Before generation the panel is shown where user can choose destination location. The pseudo source can be generated only for documentaton reason.
By this opion You can export chosen methods. On the first panel You must confirm Your choice of method list to export. Then window will apear to provide the destination place for exported objects. The methods can be exported in two ways:
Device | Export description |
---|---|
*LIB | The library need to be provided. The library must exist and must be empty. Exported methods will be placed in chosen library as set of phisical files. |
*SAVF | (Recommended) The library and save file must be provided. The library must exist. Save file will be created if not exist. The exported methods will be packed into savefile. |
NOTE: The exporting process may take some time.
On this view you can see what are the input parameters and output data suported by RPG program. The information on this panel is retrieven on the fly from RPG program source. If any field is highlited it means tha value was overwitten by user. The overwritten value is stored inside metadata files. Following informatin is presented on main panel:
Column | Descripton |
---|---|
Parent parameter | This represents the group of parameters in request or response. Usually: “params” to indicate input parameters group, “data” simple response structure, “items” array response structure. See Define structure of response |
Sequence | Sequence of appearing in RPG source code. In most cases it has no impact generate panels. There is only one ussage of this field. Whan You generate general mobile application panel without specifying the sequence of fields on form then this sequence is taken into consgeration by automatic builder. |
Parameter | Input/Output parameter name |
Attr | Indicates if parameter has any attribute defined. See Parameter attributes |
Aperio is prepared to handle all kind of structures of json response. But there is reccomendation to follow strict structure to be able to use methods to generate mobile applications. The recomended structure of response should be chosen from following proposales:
{
"data":{"warehouse":"MKO", "availableQuntity": 5, "batchControlled":true}
}
{
"data":{
"items":[
{"warehouse":"MKO", "availableQuntity": 5, "batchControlled":true},
{"warehouse":"MK1", "availableQuntity": 6, "batchControlled":true},
{"warehouse":"MK2", "availableQuntity": 7, "batchControlled":true}
]
}
}
In first case, (simple response) all simple values are represented in metadata as parameters which has parent parameter “data”
In second case all columns in array are represented as parameters with parent parameter “items”. Additionaly there is one entry in metadata parameters:
Note: If the response of method do not follow one of two reccomended structures then generator of JForm panels may produce unexpected results.
The attributes defined on parameter level are used to generate panels by jforms generator. They are retrieved dirrectly from the source. There is possibility to overwrite the values but it is not reccomended. If something must be adjusted it is better to do it inside RPG program source. Following attributes are supported:
Attribute | Type of value | Input/Output | Ability to overwritte in JForm | Decsription |
---|---|---|---|---|
active | Boolean (true, false) | I/O | Y | Indicate if field is active. If field is not active the JForms generator will generate this field as hidden. |
allowBlank | Boolean (true, false) | I | Y | Indicates if blank value is alowed for filed. If the allowBlank is set to false then empty field will not be send in request. If allowBlank is set to true then empty fields will be send in request. Generally this attribute is used for selection fields. The selsction fields are not sent to the requests if they are blank/zero. (Blank or Zero for selection field means no selection ofer this field) |
description | text | I/O | N | Description of field. Not used to generation og JForms panels |
editable | Boolean (true, false) | I | Y | Indicates if field is editable |
format | text (date, date-time, float, int, json, time, 3-state) | I/O | N | Format of field |
label | text | I/O | Y | Label of field |
length | number | I/O | N | Length of field in characters or digits |
mandatory | Boolean (true, false) | I | N | Indicates if imput parameter is mandatory |
messageLinkedField | text | I/O | N | For future use. |
referenceField | text | I/O | N | Dc1 related field which point to DC1 fref. By providing reference field most of attributes can be retrieven from DC1 fref database. |
scale | number | I/O | N | Valid for numeric fields. Defines number of decimals. |
structure | text (array, object) | O | N | Defines structure of output field. Used by JForm generator to render tables |
translationcontext | text | I/O | N | For future use. |
type | text (boolean, number, text) | I/O | N | Defines type of field |
uppercase | Boolean (true, false) | I/O | Y | Indicates if field is uppercase |
visible | Boolean (true, false) | I/O | Y | indicates if field should be visible or hidden on generated panel |
windowContext | text | I/O | N | For future use. |
windowFromKey | text | I/O | N | For future use. |
windowId | text | I/O | N | For future use. |
windowToKey | text | I/O | N | For future use. |
Note: All attributes can be overwtritten in JForm definiton. The attributes provided in metadata describe the default value/behavior of field. Off course some attributes are strictly connected to field type coded in RPG program. It is pointless to change them. For example, manipulating attributes “type” or “lenght” in JForms is useless as this change do not have corresponding change in RPG source code.
Following common parameters are supported by mobile application generator:
Parent parameter | Parameter | I/O | Type | Description |
---|---|---|---|---|
control | freeTextSearch | Input | Text (200 chars) | Words, space divided, used to search trough database, used by Live search functionality |
control | limit | Input | Number (9,0) | Maximum number of records in one response, used for pageing in table rendering. |
control | offset | Input | Number (9,0) | Start offset used for paging in table rendering. |
control | statistics | Input/Output | Input Boolean (true/false), Output Json (text) | Indicate if statistics should be measured during call. Statistics are send back together with response. |
control | fields | Input | Text (200 chars) | Words, space or coma divided, used to subset (limit) the response fields. To save on network bandwidth client can use this control parameter to receive smaller response. |
control | more | Output | Boolean (true/false) | Indicates if there are more records in file, used for pageing in table rendering. If there is no possiblity to count total number of records programmer has possiblity to use this output parameter. |
control | total | Output | Number (9,0) | Total number of records in file (array), use for pageing in table rendering. |
control | orderBy | Input | Text (200 chars) | Database fields space divided, which describes order of rows in response. There is possibility to use the response fields names. If the field name provided in this parameter is not supported by program to sort the response, then the apropriate message shoudl be generated by RPG program. |