Node Example Application
Revision 09-FEB-2023
Download or clone a copy of our Example Tire Protection Application to get an understanding of how to integrate with the Automotive Business Solutions Tire Protection API.
Prerequisite
You will need OpenSSH
, and nodejs
installed.
OpenSSH
comes pre-intalled on most linux distributions, and MacOS. To use OpenSSH
on Windows refer to
Micorsoft's ssh feature installation instructions to install it.
yarn
can be used as an optional nodejs
package manager.
Either run:
npm run generateKeys
-- or --
yarn generateKeys
-- or --
Manually create your keys with the following commands
Generate a private and public key using the following commands:
Generate private and public key:
ssh-keygen -t ecdsa -b 256 -m pem -f tire-protection-key
Convert public key to PEM format:
ssh-keygen -f tire-protection-key.pub -e -m pem > tire-protection-key.pub.pem
Send ABS your private key in the tire-proection-key.pub.pem
file to link to your partner account, and receive your partner_id
and program_id
.
For more information see getting started.
Installation
node install
-- or --
yarn install
Post Installation
Copy the .env.example
to .env
Add the partner_id
provided to you from Automotive Business Solutions to the .env
PARTNER_ID=***
Add the program_id
provided to you from Automotive Business Solutions to the .env
PROGRAM_ID=***
Using the Application
npm run {command}
-- or --
yarn {command}
Replace {command} with an available command below.
After executing each command the console will output an example CURL request of the http request the application is making.
Available commands
createRegistration
Create a registration using the partner_id
, product_id
you have in your .env file.
cancelRegistration
Get a registration. Pass in the registration_id to get as the first argument e.g. npm run getRegistration {registration_id}
listRegistrations
List all registrations associated with the partner_id
cancelRegistration
Cancel a registration. Pass in the registration_id to cancel as the first argument e.g. npm run cancelRegistration {registration_id}