Click or drag to resize

LinkarClientSendJsonCommand Method

Linkar Framework for .NET and Core


Allows a variety of persistent operations using standard JSON templates, synchronously only.

Namespace: Linkar.Commands.Persistent
Assembly: Linkar.Commands (in Linkar.Commands.dll) Version: 2.3.1
Syntax
public string SendJsonCommand(
	string command,
	int receiveTimeout = 0
)

Parameters

command  String
Content of the operation you want to send.
receiveTimeout  Int32  (Optional)
Maximum time in seconds that the client will wait for a response from the server. Default = 0 to wait indefinitely.

Return Value

String
The results of the operation.
Example
using Linkar;
using Linkar.Commands.Persistent;

class Test
    {
        public string MySendCommand()
        {
            string result = "";
            try
            {
                CredentialOptions credentials = new CredentialOptions("127.0.0.1", "EPNAME", 11300, "admin", "admin");
                LinkarClient client = new LinkarClient();
                client.Login(credentials);
                string command =
                    "{" +
                    "    \"NAME\" : \"READ\"," +
                    "    \"COMMAND\" :" + 
                    "    {" +
                    "        \"CALCULATED\" : \"True\" ," +
                    "        \"OUTPUT_FORMAT\" : \"JSON_DICT\" ," +
                    "        \"FILE_NAME\" : \"LK.CUSTOMERS\" ," +
                    "        \"RECORDS\" : [" +
                    "            { \"LKITEMID\" : \"2\" }" +
                    "        ]" +
                    "    }" +
                    "}";
                result = client.SendJsonCommand(command);
                client.Logout();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                // Do something
            }
            return result;
        }
    }
See Also