Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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.
- 
- 
  
 <html><div style="margin-left: 20px;"> *Note:* Creation or work with SQL Stored Procedures requires development expertise in T-SQL and is not included in Cyrious Technical Support. </div></html> <html><div style="margin-left: 20px;"> *Note:* Creation or work with SQL Stored Procedures requires development expertise in T-SQL and is not included in Cyrious Technical Support. </div></html>
- 
- 
  
 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:
- 
- 
  
 <code> <code>
Line 29: Line 18:
 </code> </code>
  
 +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="value1" after converting HTML to plain text. Quotes may be used in the URL to separate parameters, but are usually not required.   * {paramName1=value1} sets the value of @param1="value1" after converting HTML to plain text. Quotes may be used in the URL to separate parameters, but are usually not required.
   * {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:
- 
- 
  
 <code> <code>
    EXEC StoredProcName @paramName1="value1", @paramName2="value2", ...    EXEC StoredProcName @paramName1="value1", @paramName2="value2", ...
 </code> </code>
- 
- 
  
 ====== 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.
- 
- 
  
 <code> <code>
Line 71: Line 49:
 END END
 </code> </code>
- 
- 
  
 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:
- 
- 
  
 <code> <code>
Line 87: Line 61:
 http://localhost:12556/chapi/sqlmacro?name=TestProcedureCall&IntValue=3&StringValue="Red Blue" http://localhost:12556/chapi/sqlmacro?name=TestProcedureCall&IntValue=3&StringValue="Red Blue"
 </code> </code>
- 
- 
  
 The output you get should be similar to the this: The output you get should be similar to the this:
- 
- 
  
 <code> <code>
Line 102: Line 72:
 [{"IntValue":"3","StringValue":"Red Blue"}] [{"IntValue":"3","StringValue":"Red Blue"}]
 </code> </code>
- 
-