LinkarWS allows to create custom EndPoints to execute any of the operations defined in the sendcommand function of Linkar Server.
They can be used to run CRUD requests, TCL/ECL commands, subroutines, and to format data.
More information at https://kosday.com/Manuals/en_WEB_LINKAR_Clients/lk_sendcommand.html
XML and JSON templates are available at https://github.com/kosday/Resources, to copy into the code and modify.
In this section we will include the necessary parameters to document the EndPoint in the Swagger and to execute the sendcommand function.
Field |
Type |
Description |
New |
Button |
Create an EndPoint. |
Delete Selected |
Button |
Deletes the selected EndPoints from the Database. |
Export Selected |
Button |
Exports the selected EndPoints to a JSON file. |
Import from file |
Button |
Import EndPoints from a JSON file. |
Pencil Icon |
Button |
Edit the EndPoint. |
Trash Can Icon |
Button |
Delete the EndPoint. |
Copy Icon |
Button |
Create an EndPoint by copying data from an existing EndPoint. |
Create/Edit/Copy EndPoint
We must choose the template or templates of the sendcommand to be executed in this EndPoint. To do this we first define the type of command JSON or XML, and choose one of the templates available in the combo box. Click the Add Template button and the command structure will be painted in the Commands box. The possible labels to be used within the command are as follows: o%LKARGn% and %ESCAPED.LKARGn% n is a number from 1 to x. There are as many labels as you have parameters in endpoint. . ./api/v1/apidemo/custom/subroutine.demo?arg1=2&arg2=aa. %LKARG1% will be replaced by the value of arg1, and so on. The "ESCAPED" tag is used to replace escaped values. o%LKBODY% and %ESCAPED.LKBODY% If the endpoint is of the POST type where the input data must be in the Body of the request, we will use this tag to substitute it for the value contained in the Body o%LK.OUT:<expression>% This tag when you want to execute chained commands. LinkarWS allows us to execute a sequence of sendcommand type commands within the same custom endpoint. And this tag allows us to pass values from one response to the input of the next command. With an example it will be better understood: ../api/v1/apidemo/custom/demo.in.cascade?arg1=2&arg2=11 { "NAME" : "READ", "COMMAND" : { "CALCULATED" : "False" , "CONVERSION" : "False" , "FORMAT_SPEC" : "False" , "ORIGINAL_RECORDS" : "False" , "CUSTOM_VARS" : "" , "OUTPUT_FORMAT" : "JSON" , "FILE_NAME" : "LK.CUSTOMERS" , "DICT_CLAUSE" : "", "RECORDS" : [ { "LKITEMID" : "%LKARG1%" } ] } }, { "NAME" : "SUBROUTINE", "COMMAND" : { "SUBROUTINE_NAME" : "SUB.DEMOLINKAR" , "NUMBER_OF_ARGUMENTS" : "3" , "ARGUMENTS" : [ { "ARGUMENT" : "0" } , { "ARGUMENT" : "%LKOUT:COMMAND.RECORDS[0].NAME% - %LKARG2%" } , { "ARGUMENT" : "" } ] , "CUSTOM_VARS" : "" , "OUTPUT_FORMAT" : "JSON" } } The first command executes a READ of Register 2 of File LK.CUSTOMERS. The second command executes a SUBROUTINE, and one of its input arguments is the expression COMMAND.RECORDS[0].NAME which is extracted from the result of the first command.
|
Expression for the Output Argument