Website API Example
This article describes how to connect your CAS to your website via API.
BEFORE YOU BEGIN: carefully review the entire process.
Hire a professional if you’re uncomfortable with any aspect of the process.
Sloppy work can result in the loss of funds. Don’t take chances with your money; do it right.
WEBSITES: Creating any website (even the sample provided) is your responsibility and beyond the scope of this article and General Bytes’ support.
At this point, you should already have an existing (and operating) CAS installation.
1. Prepare CAS to load the OSW extension:
OSW extension is part of the CAS distribution but it is not loaded on master service start by default. You need to enable it before starting master service. SSH into your CAS host, and modify the extensions file to enable the OSW extension.
Create /batm/config/extensions
file and adjust it's permissions:
sudo mkdir -p /batm/app/master/extensions
sudo touch /batm/config/extensions
sudo chown batm:batm /batm/config/extensions
Use nano (or another editor) to edit the “extensions” file:
sudo nano /batm/config/extensions
set autoload=true for the OSW’s jar extension.
com.generalbytes.batm.server.extensions.website.SellExtension.autoload=true
Save the file and exit nano (Ctrl+X and Enter).
2. Test it.
Create a security key(API ACCESS) to enable the new API to communicate with your secure website.
Log into CAS.
Create a Terminal Tag.
At least one tag is required to create the API key. Assign that tag to at least one machine.
Create a new API key:
Navigate to: Third-party
Select: Operators sample website API
Click the green [ +ADD API ACCESS ]
Save the key.
Hit the submit button after saving the API Key.
Test the connection using curl:
Replace
your_api_key
with the key provided in the step immediately preceding this one.Replace
your_IP_address
with your PUBLIC IP address (for CAS), or if you use a domain name, use it instead and omit the port (“:7743”).
curl -k -i -H "X-Api-Key: your_api_key" https://your_IP_address:7743/extensions/website/terminals
(Optional) Inspect the connection using Postman:
API access is ready to use.
Now create your own GUI Website or install our sample one using Gradle to build the website.
3. (Do only if needed) Build from source
Test to see if the extension already exists:
If the extension already exists, building it from source is optional.
Overview:
Clone the GB repository.
Compile the CAS extension (JAR).
Copy that JAR to the right destination in your CAS host.
Test it.
1. Clone the GB repository:
Install Git:
Clone the GB repository.
These instructions assume you’ll use your home directory. If you choose to clone into another, different directory, then adjust this next command to change to it instead:
Now clone batm_public
and enter the OSW subdirectory:
2. Compile the CAS extension (JAR).
Build the operators_sample_website.jar extension with:
3. Copy that JAR to the right destination in your CAS host.
You’ve prepared CAS (in step 1) to look for an extension in a specific place. Put it in it’s place.
The default location of the JAR is:
$HOME/batm_public/operators_sample_website/build/libs/operators_sample_website.jar
We want to copy it to:
/batm/app/master/extensions/operators_sample_website.jar
Use this command to copy it:
Modify file ownership:
Restart CAS to implement the new extension.
Copyright © 2020-2024 General Bytes USA LLC