Differences
This shows you the differences between two versions of the page.
chapi_url_endpoint_listener [2019/01/30 09:22] 127.0.0.1 external edit |
chapi_url_endpoint_listener [2020/05/21 01:32] (current) shendrix |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Description ====== | ====== Description ====== | ||
+ | This page describes functionality in CHAPI that provides a TCP endpoint that a website can hit to trigger a stored procedure in the StoreData database. This functionality may be used in the following scenarios: | ||
- | |||
- | This page describes functionality in CHAPI that provides a TCP endpoint that a website can hit to trigger a stored procedure in the StoreData database. This functionality may be used in the following scenarios: | ||
* Allow a website to initiate an SQL import into Control | * Allow a website to initiate an SQL import into Control | ||
* Allow an external program to initiate a SQL command in Control. | * Allow an external program to initiate a SQL command in Control. | ||
- | |||
- | |||
====== Usage ====== | ====== Usage ====== | ||
- | |||
- | |||
The endpoint on CHAPI is preconfigured. To use it, you need only create a stored procedure in SQL for the StoreData database. | The endpoint on CHAPI is preconfigured. To use it, you need only create a stored procedure in SQL for the StoreData database. | ||
- | |||
- | |||
< | < | ||
- | |||
- | |||
Any parameters on the stored procedure are set as URL parameters. The general format is: | Any parameters on the stored procedure are set as URL parameters. The general format is: | ||
- | |||
- | |||
< | < | ||
Line 29: | Line 18: | ||
</ | </ | ||
+ | where: | ||
- | |||
- | where: | ||
* {serverurl} is the DNS name or IP address of the server. | * {serverurl} is the DNS name or IP address of the server. | ||
* {StoredProcName} is the name of the SQL Stored Procedure to be invoked. | * {StoredProcName} is the name of the SQL Stored Procedure to be invoked. | ||
Line 37: | Line 25: | ||
* {paramName1=value1} sets the value of @param1=" | * {paramName1=value1} sets the value of @param1=" | ||
* {paramNameN=valueN} indicates that an arbitratry number of parameters can be supported. | * {paramNameN=valueN} indicates that an arbitratry number of parameters can be supported. | ||
- | |||
- | |||
The routine works by running a SQL command as such: | The routine works by running a SQL command as such: | ||
- | |||
- | |||
< | < | ||
EXEC StoredProcName @paramName1=" | EXEC StoredProcName @paramName1=" | ||
</ | </ | ||
- | |||
- | |||
====== Example ====== | ====== Example ====== | ||
- | |||
- | |||
For this example, create the following stored procedure in the StoreData SQL database used by Control. | For this example, create the following stored procedure in the StoreData SQL database used by Control. | ||
- | |||
- | |||
< | < | ||
Line 71: | Line 49: | ||
END | END | ||
</ | </ | ||
- | |||
- | |||
Now, to call this port open a web browser and paste these links in the address bar and hit enter.This example assumes CHAPI is running at the standard port. If a customer port was configured, replace the port number accordingly. Each one will run the stored procedure above with the relevant parameters: | Now, to call this port open a web browser and paste these links in the address bar and hit enter.This example assumes CHAPI is running at the standard port. If a customer port was configured, replace the port number accordingly. Each one will run the stored procedure above with the relevant parameters: | ||
- | |||
- | |||
< | < | ||
Line 87: | Line 61: | ||
http:// | http:// | ||
</ | </ | ||
- | |||
- | |||
The output you get should be similar to the this: | The output you get should be similar to the this: | ||
- | |||
- | |||
< | < | ||
Line 102: | Line 72: | ||
[{" | [{" | ||
</ | </ | ||
- | |||
- | |||