How to Custom Call Stored Procedures with REST that have Customizable XML Parameters
Many of Catalina Technology’s stored procedures accept a field called @parms that is an XML field for configurable parameters to be passed. An example of this is below.
You can see that there is a parameter getting passed called “@parms”. In that is a XML string that contains one or more parameter. In this case, there is a single parameter called “ADDRID” and it is getting passed the value of “C%” so that it can return all addresses that start with a “C”
exec xct_spDSLGetAddresses @currentPageNumber=N'0',@pageSize=N'500',
@parms=N'<nameValuePairs>
<key name="ADDRID" value="C%"/>
</nameValuePairs>'
To call this RESTfully, you need to HTML escape the XML string so that things like double quotes (“) will not cause the JSON to break.
Below is an example of how we would call the custom stored procedure above, but call it through the Catalina RESTful API.
curl --location --request POST 'http://YOURSERVER/ctDynamicsSL/api/customSQL/xct_spDSLGetAddresses' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic YOURAUTH' \
--header 'SiteID: YOURSITEID' \
--header 'CpnyID: YOURCPNYID' \
--data-raw '{
"parameters":
[
{
"name": "currentPageNumber", "value": "0"
},
{
"name": "pageSize", "value": "0"
},
{
"name": "parms", "value": "<nameValuePairs><key name=\"ADDRID\" value=\"C%\"/></nameValuePairs>"
}
]
}'