Call a Linx process from a web service
It is possible to call a process that has been published on the Linx server from an external source by making use of the REST web service exposed by the server.
The service URL has the following format: https://<machine name or IP address>:<port>/Service/ExecuteProcess?<parameters>
When accessing the service on a default local installation of Linx, the URL would be: https://localhost:8022/Service/ExecuteProcess?<parameters>.
When making a GET request to the service (POST requests are also supported), input parameters must be specified in the form "argument=value", where both the argument and value values are URL encoded. The following table lists the standard input parameters:
||The name of the solution containing the process to execute.|
||The name of the project containing the process to execute.|
||The name of the process to execute.|
||Whether to wait for the process to finish or not. If set to false, the service will return immediately after starting the process. In this scenario, it is not possible to retrieve any return values from the executing process. If return values are required, this value has to be set to true. The default value for this field is false.|
||The name of the user to execute the process as.|
||The password for the specified user.|
Any additional parameters required by the process (Data In) can be specified in addition to the parameters listed above. If a process-specific parameter is not specified, the default value for that parameter will be used. Where possible, parameters will be converted to the expected type. If this is not possible, an error will be returned in the response.
When specifying a date/time value, please make sure that the supplied value conforms to the following format: "yyyy/MM/dd HH:mm:ss.fff".
Linx record values have to be specified as an object (converted to a JSON string) where the object properties represent the record fields.
Linx table values have to be specified as an array of objects (converted to a JSON string) where the object properties represent the columns in the table.
If a process-specific input parameter has the same name as one of the standard parameters, e.g. "solution", you have to prefix the process parameter with "Process_". In this example, "solution" becomes "Process_solution".
Assume you have a solution with the following structure and want to call process "GetEmployeeAge". Since the process has an output parameter "Age", you want to wait for the return result.
In this case, the required URL would be:
Note that the parameters have not been encoded to enhance readability.
Response values from the service will be supplied in JSON format. The following table lists the standard output values:
||Indicates the status of the process execution.|
||When "Success" is false, this field will contain the relevant error message that caused the process to fail. If "Success" is true, this field may contain additional information regarding the process execution.|
||An object containing a name-value array of the output parameters (Data Out) of the process. |
A blank object will be returned under the following conditions:
- The "waittofinish" input parameter is set to false
- There are no output parameters
- An error has occurred while executing the process
Linx record types will be returned as an object where the record fields are object properties, while table types will be returned as an array of objects.
Date/time values will be returned as a string with the following format: "yyyy/MM/dd HH:mm:ss.fff".
When the example outlined above is executed with a date value of "1960/01/02" and "waittofinish" is equal to true, the following result is returned:
A date value of "NotADate", yields the following result:
"Message":"Cannot convert [DateOfBirth] value [NotADate] to a datetime using format [yyyy/MM/dd HH:mm:ss.fff]",