All SendCommand operations are executed with EndPoints of type POST. In the body of the request, a template must be placed where the options for each type of operation are specified.
These EndPoints only support the “mediatype” “application/json” and “application/xml”.
The general structure of an operation with “mediatype” “application/json” is as follows:
{
"APIKEY": "",
"DATA": {
},
"LANGUAGE": "",
"FREETEXT": ""
}
The general structure of an operation with “mediatype” “application/xml” is as follows:
<operation_name>
<APIKEY></APIKEY>
<DATA>
</DATA>
<LANGUAGE></LANGUAGE>
<FREETEXT></FREETEXT>
</ operation_name>
The “APIKEY” node will only appear when Linkar Web Services is configured in “ApiKey” authentication mode. And it's in this node where the value of the “apikey” must be specified in order to access the service. When Linkar Web Services is configured in “OAuth 2.0” authentication mode, authentication takes place using credentials that, if correct, assign an access “TOKEN” that is automatically sent with the request. So in this case, there will be no “APIKEY” node.
The “FREETEXT” node is the text that displays in Linkar MANAGER, in the Client Sessions monitor. This can help to identify the source of the request. Examples: "ERP1", "Android v1.3", "Client245".
The “LANGUAGE” node is used by database routines to choose the correct language for returning responses. Error messages from the database server are in English by default, but they can be customized.
Within the “DATA” node, the content that defines each operation must be specified. This content can be extracted from the following links:
https://github.com/kosday/Resources/tree/main/SendCommand_Templates/JSON
https://github.com/kosday/Resources/tree/main/SendCommand_Templates/XML
As an example, the template below shows a read operation of the record with code 1 of the LK.CUSTOMERS file.
Json Template
{
"APIKEY": "apikeyvalue",
"DATA": {
"FILE_NAME": "LK.CUSTOMERS",
"RECORDS": [
{
"LKITEMID": "1"
}
],
"DICT_CLAUSE": "",
"CALCULATED": "",
"CONVERSION": "",
"FORMAT_SPEC": "",
"ORIGINAL_RECORDS": "",
"CUSTOM_VARS": "",
"OUTPUT_FORMAT": ""
},
"LANGUAGE": "",
"FREETEXT": ""
}
XML Template
<?xml version="1.0" encoding="UTF-8"?>
<LKREADCOMMAND>
<APIKEY>apikeyvalue</APIKEY>
<DATA>
<FILE_NAME>LK.CUSTOMERS</FILE_NAME>
<RECORDS>
<LKITEMID>1</LKITEMID>
</RECORDS>
<DICT_CLAUSE></DICT_CLAUSE>
<CALCULATED></CALCULATED>
<CONVERSION></CONVERSION>
<FORMAT_SPEC></FORMAT_SPEC>
<ORIGINAL_RECORDS></ORIGINAL_RECORDS>
<CUSTOM_VARS></CUSTOM_VARS>
<OUTPUT_FORMAT></OUTPUT_FORMAT>
</DATA>
<LANGUAGE></LANGUAGE>
<FREETEXT></FREETEXT>
</LKREADCOMMAND>