Manage API Keys for Catalina’s RESTful API for Dynamics SL

You may want multiple users access Catalina’s API for Dynamics SL. When using the RESTful version of Catalina’s API, you can do this by managing the APIKEYSCONFIGFILE.xml (usually located on the web server at c:\inetpub\xctFiles\config — But could be somewhere else depending on the installation. Check with your installer)

NOTE: before doing any changes to Catalina configuration, make sure you backup the files you are updating first.

The APIKEYSCONFIGFILE.xml can be managed by a Catalina management tool called ctConfigEditor. (Normally located in C:\inetpub\xctFiles\ctConfigEditor — but could be in a different location based on installation). Once the ctConfigEditor is loaded, you will see a screen similar to this:

You will need to get your License Key and Site Key (found in the web.config file of the Catalina API for SL. — usually located c:\inetpub\xctFiles\web\ctDynamicsSL or c:\inetpub\wwwroot\ctDynamicsSL but could be located somewhere else based on installation). You will also need to point to the proper Config File.

Once you have loaded the APIKEYSCONFIGFILE.xml with the proper license key and site key, you will see a screen similar to this:

Here you can manage Authentication logins for the RESTful API. In the above example, there are 4 different keys. You can add new ones by just adding a line. and you can delete keys by clicking on the line item and hitting the delete key.

The columns of these API Keys are defined:

  • APIKey: the username of the authentication
  • SECRETKEY: The password of the authentication
  • SITES: a comma delimited list of sites the user has access to

(NOTE: A site is a configuration pointer. If you look at your DSLCONFIGFILE.XML file — usually in the same location as the APIKEYSCONFIGFILE.xml — you will see different Sites and SiteID’s. It is that SITE ID that you would put in the SITES column. If you want to give a user access to more than one site, you would then list all the sites comma delimited. Below is an example of what a DSLCONFIGFILE.XML looks like. You can see that there are two sites: LIVE and TEST.

Once you have finished editing your API Keys in the ctConfigEditor tool, you can then finish it and save by clicking on the “Finish” tab. You can click the Preview button to see what your APIKeys file will look like. You can also Save your file by clicking on the Save button.

Clicking on the save button will allow you to save to a file. You will need to save it on top of the existing APIKEYSCONFIGFILE.XML (NOTE: make sure you have this file backed up before overwriting it).

After you save the file, you will also need to reload your Application Pool in IIS to make the change stick.


SL Quick Pay tips and tricks

Tips & Tricks for Catalina API for SL: Error Retrieving the COM class factory …

When you have an installation of Catalina’s API for Dynamics SL and you are receiving this error in your log files:

Err:Retrieving the COM class factory for component with CLSID {A440BD76-CFE1-4D46-AB1F-15F238437A3D}

This error is limited to SL7 installations and sometimes occurs during checkout or placing and order upon intial install of Catalina products; but usually after SL client updates or changes.

The problem is related to missing registry entry for: capicom.dll. This file is required by the the Microsoft Solomon components and used for database access. Capicom.dll is included in a variety of MS products and should already be located on the computer.

Common installation paths:
c:\program files\common files\microsoft shared\capicom.dll
C:\Program Files (x86)\Common Files\Microsoft Shared\CAPICOM\CapiCom.dll

If the file is not located there, we suggest doing a file system search for “capicom.dll”.

Once you have located the file on your server, you need to register it.

  • Pull up a command prompt and change to the directory where the capicom.dll file is located.
  • Enter: regsvr32 capicom.dll
  • Test your catalina install


Create a Contact Free Payment Solution for Dynamics SL (Mobile App)

This is a demo that shows you how to create a mobile app to interact with Dynamics SL to provide a “Contact Free” payment solution to help protect your employees and customers during COVID 19. The intended user of this example app would be a customer service rep, sales person, or field service rep who needs to collect payment from a customer (handy for collecting a deposit or down payment before delivery, installation, or service work to be done).

This demo uses Catalina’s API to search customers in SL and then lets the user to request a payment from a customer by generating a link and emailing it to the chosen customer. That customer then can click on the link and pay the amount which automatically creates a payment in SL’s AR.

NOTE: Source code for the mobile app can be found on Github here: https://github.com/CatalinaTechnology/SL-Mobile/tree/main/ctPayment

Check out the video of the demo on our Youtube channel here:

Below is a screenshot of the Android app from the above demo. First you can search for a customer by a keyword. That search will then bring back a list of results. You can then click on the customer you want to request funds for. The app will automatically fill in the email address of the customer (from the Customer record in Dynamics SL). You can change the email address if you want. You then enter a requested payment amount and hit submit. Once you do this, Catalina’s SLQuickCollect will send off an email to the customer with a link which will then allow them to make a PCI compliant secure payment. Once authorization occurs, SLQuickCollect will then create a payment in Dynamics SL automatically.

As mentioned below, if you want to have starter code on creating an Android App (with Visual Studio and Xamarin), you can check out an example on our Github here (NOTE: I would only consider this a starter. This is in no means something finished but enough to get you started)

https://github.com/CatalinaTechnology/SL-Mobile/tree/main/ctPayment


EDI Integration with Dynamics SL Using Catalina

If you need EDI integration between your trading partners and Dynamics SL, you can use Catalina’s API for SL to get data in and out of Dynamics SL. One of the simplest of transactions is order management. If you have a trading partner that needs to send you PO’s so that you can then fulfill, the most common documents used are:

  • Inbound Documents
    • 850: This is a purchase order to fulfill
  • Outbound Documents
    • 855: An immediate response sent back to your trading partner acknowledging that you received the transaction
    • 997: An acknowledgement that you have received the transaction and often when you will pass back a reference number for your internal order number
    • 856: A shipper notification that notes what has shipped on the PO when a shipper is generated

The key to this is a data mapping layer that allows you to translate the inbound EDI documents and transform it into something that the Catalina API can understand. The reverse is true when data needs to be sent from SL out to your trading partner. The Catalina API will retrieve the data and then the translation will transform that data into an EDI document to send back to your customer.

If you have questions or need assistance with EDI integration with DynamicsSL, you can contact Catalina at [email protected]


SL Quick Pay tips and tricks

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>"
        } 
    ]
}'

SL Quick Pay tips and tricks

Catalina XML Configuration File Editor: ctConfigEditor

ctConfigEditor is the stand-alone executable used to create and edit the custom XML documents used to configure our full line of web services. Our xml structure supports storing sql connection data and a range of name/value pairs. All data is easily encryptable for added security.

Step 1:

Choose whether you are editing an existing file or creating a new config file from scratch. If loading an existing config file, you will need to fill in your catalina software license key as well as your sitekey.

Step 2:

Either load an existing Site ID or create a new Site ID.
You can identify which Site ID you are editing on all screens at the top of the screen where it says, “Currently Editing: SiteID“. If this value is blank, it means you are creating a new SiteID entry.
Note: TO DEFAULT ALL KEYS: Load an existing Site ID, then enter a New Site ID and hit the “Create Site” button.

Step 3:

Set your Database connection strings. Both the .NET format and OLE String format.
.NET Format:  user id=USERNAMEHERE;password=PASSWORDHERE;database=DATABASENAMEHERE;server=SERVERNAMEHERE
OLE Format:  Provider=SQLOLEDB;User Id=USERNAMEHERE;Password=PASSWORDHERE;Initial Catalog=DATABASENAMEHERE;Data Source=SERVERNAMEHERE
For more information on sql connection strings and other options available, we recommend reading at: http://www.connectionstrings.com/

Step 4:

Edit the config options available or create custom entries. Note: you can optionally encrypt any field by just checking the “encrypt” checkbox next to a key. We recommend only encrypting sensitive data.

Step 5:

On the “Finish” tab you will see the option to Preview the XML file or Save it to a file. Click the appropriate button.
You can optionally change your siteKey/encryptKey by filling in the new key in the SiteKey text field. Note: You will need to remember to update any client applications to use the new siteKey.


Access Catalina’s API for Dynamics SL using .NET Core

If you are looking to build a cross platform application in .NET Core that can access Dynamics SL, you can use Catalina’s API for Dynamics SL. This is a demo on how you can do it using Visual Studio and deploy the client to Windows, Mac, and/or Linux (or any OS that supports .NET Core).

Demo on Connecting to Dynamics SL through .NET Core

You can get the source code for this demo on our GitHub site: https://github.com/CatalinaTechnology/dotNETCore/MyConsoleApp


Retrieve Catalina Queue FIFO

If you use the Catalina Queue Engine for queuing records, you might want to retrieve data in a FIFO (First In First Out) method. This means you want to grab the oldest records first. This is easily accomplished by calling the Catalina Queue API with the parameter sortBy in the query string.

Example, if you are retrieving the queue ORDERS, you would format your URL, for the Queue API, like this:

http://YOURSERVER/ctDynamicsSL/api/queue/ORDER?sortBy=createdDate

This will then sort the queue in Ascending order by createdDate. Which means it will retrieve oldest items first.

Below is a curl example that does the same thing.

curl -X GET \
'http://YourServer/ctDynamicsSL/api/queue/QUEUETYPE?sortBy=createdDate' \
-H 'Accept: application/json' \
-H 'Authorization: Basic YOURAUTHHERE' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-H 'CpnyID: YOURCPNYID' \
-H 'SiteID: YOURSITEID' \
-H 'cache-control: no-cache'

Minimum SQL Security Requirements for Catalina API

Minimum:
db_datawriter
db_datareader
db_ddladmin

If you are going to use our userMaintenance web service, to manage SL user logins, it will also need:
db_securityadmin
db_accessadmin

Also note that by default, we normally install our scripts under the dbo schema. So, you also have to give the user, we are connecting as, execute on that schema.

eg. grant  execute on schema :: [dbo] to usernamehere