0% found this document useful (0 votes)
585 views229 pages

Cash Device Rest API

The Cash Device REST API documentation provides guidelines for establishing communication between ITL cash devices and software applications across various operating systems and programming languages. It details multiple API endpoints for authentication, device management, and status updates, including code examples in C#, NodeJS, Python, and Java. The document emphasizes the need for a Bearer Token for secure API requests and outlines the structure of request and response bodies for various operations.

Uploaded by

fdisla1608
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
585 views229 pages

Cash Device Rest API

The Cash Device REST API documentation provides guidelines for establishing communication between ITL cash devices and software applications across various operating systems and programming languages. It details multiple API endpoints for authentication, device management, and status updates, including code examples in C#, NodeJS, Python, and Java. The document emphasizes the need for a Bearer Token for secure API requests and outlines the structure of request and response bodies for various operations.

Uploaded by

fdisla1608
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 229

Cash Device REST API

Document Revision - v.2

Exported on 29/04/2025

Copyright © Innovative Technology Ltd 2025


Overview
This documentation explains how to use the REST API server to establish communication between the ITL cash
devices and software applications. These applications can run on various operating systems, such as Linux, and use
different programming languages, such as C++, Java, etc.

Document Revision - v.2 Cash Device REST API - 1


API Endpoints
• REST API - Authenticate
• Android REST API - GetConnectedUSBDevices
• REST API - UpdateCredentials
• REST API - OpenConnection
• REST API - DisconnectDevice
• REST API - StartDevice
• REST API - StopDevice
• REST API - LogRawPackets
• REST API - GetCompleteCashDevice
• REST API - GetDeviceStatus
• REST API - GetCounters
• REST API - GetAllLevels
• REST API - GetCurrencyAssignment
• REST API - SetDenominationLevel
• REST API - EnablePayout
• REST API - EnablePayoutDevice
• REST API - EnablePayoutDeviceWithByte
• REST API - DisablePayout
• REST API - EnableAcceptor
• REST API - DisableAcceptor
• REST API - SetAutoAccept
• REST API - AcceptFromEscrow
• REST API - ReturnFromEscrow
• REST API - SetDenominationInhibits
• REST API - SetDenominationInhibitByIndex
• REST API - SetDenominationInhibit
• REST API - SetDenominationRoute
• REST API - GetBarcodeReaderConfiguration
• REST API - SetBarcodeReaderConfiguration
• REST API - GetBarcodeInhibit
• REST API - SetBarcodeInhibit
• REST API - GetBarcodeData
• REST API - DispenseValue
• REST API - PayoutByDenomination
• REST API - PayoutMultipleDenominations
• REST API - Float
• REST API - SetCashboxPayoutLimit
• REST API - SmartEmpty
• REST API - SendCustomCommand
• REST API - EnableCoinMechOrFeeder
• REST API - ResetDevice
• REST API - HaltPayout
• REST API - GetRCMode
• REST API - Replenish
• REST API - RefillMode
• REST API - KeyExchangeLimit32bit
• REST API - GetHopperOptions
• REST API - SetHopperOptions
• REST API - GetGlobalErrorCode
• REST API - GetServiceInformation
• REST API - GetServiceInformationForModule
• REST API - SetServiceInformationMaintenanceReset
• REST API - SetNoPayinCount
• REST API - Purge
• REST API - PurgeDevice
• REST API - PurgeDeviceHopper
• REST API - CoinStir
• REST API - CoinStirWithMode
• REST API - GetCoinAcceptance
Document Revision - v.2 Cash Device REST API - 2
• REST API - GetCoinsExit
• REST API - SetRealTimeClock
• REST API - GetRealTimeClock
• REST API - SetCashboxLevels
• REST API - ClearCashboxLevels
• REST API - GetCashboxLevels
• REST API - SetSorterRoute
• REST API - GetSorterRouteAssignment
• REST API - SetPayoutLimit
• REST API - GetPayoutCount
• REST API - SetTwInMode
• REST API - ExtendedGetDatasetVersion
• REST API - ExtendedGetFirmwareVersion
• REST API - comPortReadError
• REST API - DeviceState_StartupReady
• REST API - GetLifterStatus
• REST API - GetLastRejectCode
• REST API - DeviceErrorLimpMode
• REST API - DeviceStateLimpMode
• REST API - StartDownload
• REST API - GetDownloadStatus

Document Revision - v.2 Cash Device REST API - 3


REST API - Authenticate
Description
Creates a Bearer Token to be used as Authorisation on all subsequent Requests for security.

This must be sent first to create the Bearer Token between the software and the REST Server. Only
subsequent requests using the correct Bearer Token will be accepted.

Default Credentials
Username: admin
Password: password

Endpoint Authenticate

Method POST

URL {server_url}/api/Users/Authenticate

Parameters None

Authorisatio N/A
n

Body

{
"Username": "admin",
"Password": "password"
}

Responses
Status Body Notes

200 OK: Provides the Bearer Token to be used


for the Authorisation of subsequent
{ requests.
"token": "eyJhb....."
}

400 Bad Request: Incorrect Credentials.

{
"message": "Username or password
is incorrect"
}

N/A Error: connect ECONNREFUSED {server_url} Unable to connect to REST Server.

Document Revision - v.2 Cash Device REST API - 4


Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/Users/Authenticate", Method.Post);
request.AddHeader("Content-Type", "application/json");
var body = @"{
" + "\n" +
@" ""Username"": ""admin"",
" + "\n" +
@" ""Password"": ""password""
" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/Users/Authenticate',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"Username": "admin",
"Password": "password"
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import http.client
import json

conn = http.client.HTTPSConnection("localhost", 5000)


payload = json.dumps({
"Username": "admin",
"Password": "password"
})
headers = {

Document Revision - v.2 Cash Device REST API - 5


'Content-Type': 'application/json'
}
conn.request("POST", "/api/Users/Authenticate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"Username\": \"admin\",
\r\n \"Password\": \"password\"\r\n}");
Request request = new Request.Builder()
.url("http://localhost:5000/api/Users/Authenticate")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 6


Android REST API - GetConnectedUSBDevices
Description
Returns the port address for the connected device.

This request is used for Android only.

Endpoint GetConnectedUSBDevices

Method Get

URL {server_url}/api/CashDevice/GetConnectedUSBDevices

Parameters None

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: Provides the port details

[
{
"Port": 0,
"DeviceName": "NV200 Spectral",
"VendorId": 6428,
"ProductId": 16644
}
]

Code Examples

C#

var options = new RestClientOptions("http://127.0.0.1:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetConnectedUSBDevices", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 7


NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://127.0.0.1:5000/api/CashDevice/GetConnectedUSBDevices',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://127.0.0.1:5000/api/CashDevice/GetConnectedUSBDevices"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://127.0.0.1:5000/api/CashDevice/GetConnectedUSBDevices")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 8


REST API - UpdateCredentials
Description
Used to change the Username and Password for the Authenticate request.

You must have Authenticated using the current credentials before updating to the new credentials.

Default Credentials
Username: admin
Password: password

Endpoint Authenticate

Method POST

URL {server_url}/api/Users/UpdateCredentials

Parameters None

Authorisatio Bearer Token


n

Body

{
"CurrentUsername": "admin",
"CurrentPassword": "password",
"NewUsername": "<new username>",
"NewPassword": "<new password>"
}

Responses
Status Body Notes

200 OK: Confirms the credentials have been


updated.
{
"message": "Credentials updated
successfully!"
}

401 Old username or password is incorrect Unauthorised: Incorrect Credentials.

Document Revision - v.2 Cash Device REST API - 9


Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/Users/UpdateCredentials", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""CurrentUsername"": ""admin""," + "\n" +
@" ""CurrentPassword"": ""password""," + "\n" +
@" ""NewUsername"": ""<new username>""," + "\n" +
@" ""NewPassword"": ""<new password>""" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/Users/UpdateCredentials',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"CurrentUsername": "admin",
"CurrentPassword": "password",
"NewUsername": "<new username>",
"NewPassword": "<new password>"
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/Users/UpdateCredentials"

payload = json.dumps({

Document Revision - v.2 Cash Device REST API - 10


"CurrentUsername": "admin",
"CurrentPassword": "password",
"NewUsername": "<new username>",
"NewPassword": "<new password>"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"CurrentUsername\":
\"admin\",\r\n \"CurrentPassword\": \"password\",\r\n \"NewUsername\": \"<new
username>\",\r\n \"NewPassword\": \"<new password>\"\r\n}");
Request request = new Request.Builder()
.url("http://localhost:5000/api/Users/UpdateCredentials")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 11


REST API - OpenConnection
Description
• The /OpenConnection endpoint streamlines the process of initiating communication with cash-handling
devices by configuring essential connection and device-specific settings. This endpoint simplifies the
previous multi-step process for establishing a connection to an SSP device. Previously, the steps included:
InitialiseDevice -> OpenDevice -> ConnectDevice -> StartDevice. With /OpenConnection, these
operations are automated, enabling the device to be ready for cash operations such as payout and note
acceptance.
• The structure of the request body and the JSON response varies based on the device model in use. For
example, NV4000 requires a distinct request format and includes a different set of fields in its JSON response
compared to Smart Coin System.

The deviceID provided in the response should be used as a request parameter in subsequent
requests. This deviceID targets the specific device to receive SSP commands. For example, if your
computer is connected to an NV4000 via port COM17 and a Smart Coin System on COM4, the device IDs
would be NV4000-COM17 and SMART_COIN_SYSTEM-COM4 , respectively. To disable the acceptor
on NV4000, send a request to {{server_url}}/DisableAcceptor?deviceID=NV4000-COM17

Endpoint OpenConnection

Method POST

URL {server_url}/api/CashDevice/OpenConnection

Parameters None

Authorisatio Bearer Token


n

Body Please see the example below for Spectral Payout:

{
"ComPort": "{{ComPort}}",
"SspAddress": {{SspAddress}},
"LogFilePath": "C:\\Temp\\Cash_Device_Log.log",
"SetInhibits": [
{ "Denomination": "2000 {{Currency}}", "Inhibit": true },
{ "Denomination": "5000 {{Currency}}", "Inhibit": true }
],
"SetRoutes": [
{ "Denomination": "500 {{Currency}}", "Route": 7 },
{ "Denomination": "1000 {{Currency}}", "Route": 7 }
],
"EnableAcceptor": true,
"EnableAutoAcceptEscrow": true,
"EnablePayout": true
}

Please refer to the Request Body Structure below for details of the request body requirements.

Document Revision - v.2 Cash Device REST API - 12


Request Body Structure
Field Device Example Comments
Type

ComPort Any “ComPort”: “COM5”

SspAddress Any “SspAddress”: 0

EncKey Any “EncKey”: Custom eSSP Key


81985526925837671

LogFilePath Any "LogFilePath": "C:\\Temp\


\Cash_Device_Log.log"

SetInhibits Any "SetInhibits":


[
{ "Denomination": "2000
GBP", "Inhibit": true },
{ "Denomination": "5000
GBP", "Inhibit": false }
]

SetRoutes Any "SetRoutes": • Cashbox = 0


[ • Recycler = 1
{ "Denomination": "500 GBP", • Recycler 1 (NV4000) = 2
"Route": 7 }, • Recycler 2 (NV4000) = 3
{ "Denomination": "1000 • Recycler 3 (NV4000) = 4
GBP", "Route": 0 } • Recycler 4 (NV4000) = 5
] • Replenishment Cassette
(NV4000) = 6
• Payout = 7

SetCoinMechInhibits Coin "SetCoinMechInhibits": See Command 0x40 - Set Coin Mech


Validator { Inhibits
"ValueCountryCodes": ["1
USD","5 USD"],
"Inhibit": true
}

SetHopperOptions Coin "SetHopperOptions": See Command 0x50 - Set Options


Hopper { (Coin)
"Reg0": 4,
"Reg1": 0
}

SetCashBoxPayoutLimit Any "SetCashBoxPayoutLimit": See Command 0x4E - Set Cashbox


[100,0,50,30,20,5,0] Payout Limit (Coin) or Command
Not Available on 0x4E - Set Cashbox Payout Limit
NV4000 (Note)

SetTwinMode TSCS "SetTwinMode":0 See Sub Command 0x05 0x87 - Set


Twin Mode

Document Revision - v.2 Cash Device REST API - 13


Field Device Example Comments
Type

SetFeederRoutes TSCS "SetFeederRoutes": See Sub Command 0x05 0x85 -


[ Sorter Channel Set Route
{ "Denomination": "1 USD",
"Route": 0 },
{ "Denomination": "25 USD",
"Route": 0 },
{ "Denomination": "100 USD",
"Route": 0 }
]

EnableAcceptor Any "EnableAcceptor": true

EnableAutoAcceptEscrow Note "EnableAutoAcceptEscrow": Automatically accept a note held in


Validator true Escrow.

EnablePayout Note "EnablePayout": true


Validator

Document Revision - v.2 Cash Device REST API - 14


Responses
Status Body Notes

200 OK: Successfully retrieved device


information and configured essential
{ connection and device-specific settings.
"deviceID": "SPECTRAL_DEVICE-
COM18",
"isOpen": true,
"deviceModel": "SPECTRAL_DEVICE",
"sspProtocolVersion": 7,
"deviceError": "NONE",
"firmware": "NVS2004301038000",
"dataset": "GBP01056",
"validatorSerialNumber":
"4891655",
"payoutModuleSerialNumber":
"5175198",
"validatorRevision": "7.10",
"payoutModuleRevision": "1.00",
"realTimeClock": "Successfully
set real time clock to 28/10/2024
16:24:38.",
"allLevels": [
{
"countryCode": "GBP",
"value": 500,
"stored": 0
},
{
"countryCode": "GBP",
"value": 1000,
"stored": 0
},
{
"countryCode": "GBP",
"value": 2000,
"stored": 0
},
{
"countryCode": "GBP",
"value": 5000,
"stored": 0
}
],
"counters": "Number of counters
in set: 5\nStacked: 999\nStored:
2\nDispensed: 0\nTransferred to
stack: 2\nRejected: 258\n",
"inhibits": "SUCCESS: 2000 GBP
INHIBITED.\nSUCCESS: 5000 GBP
INHIBITED.\n",
"routes": "SUCCESS: Set route for
500 GBP to PAYOUT.\nSUCCESS: Set
route for 1000 GBP to PAYOUT.\n",
"acceptorEnabled": true,
"autoAcceptEscrowEnabled": true,
"payoutEnabled": true

Document Revision - v.2 Cash Device REST API - 15


Status Body Notes

400 Bad Request: Port Error

{
"deviceID": "",
"openResult": "PORT_ERROR",
"error": "Failed to open device."
}

500 Internal Server Error: An error occurred


while attempting connection.
{
"DeviceID": "deviceID_value",
"Error": "Error opening cash
device: error_message"
}

N/A Error: connect ECONNREFUSED {server_url} Unable to connect to REST Server.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/OpenConnection", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{
" + "\n" +
@" ""ComPort"": ""COM5"",
" + "\n" +
@" ""SspAddress"": 0,
" + "\n" +
@" ""LogFilePath"": ""C:\\Temp\\Cash_Device_Log.log"",
" + "\n" +
@" ""EncKey"": 81985526925837671, " + "\n" +
@" ""SetInhibits"": [
" + "\n" +
@" { ""Denomination"": ""2000 GBP"", ""Inhibit"": true },
" + "\n" +
@" { ""Denomination"": ""5000 GBP"", ""Inhibit"": true }
" + "\n" +
@" ],
" + "\n" +
@" ""SetRoutes"": [
" + "\n" +
@" { ""Denomination"": ""500 GBP"", ""Route"": 7 },

Document Revision - v.2 Cash Device REST API - 16


" + "\n" +
@" { ""Denomination"": ""1000 GBP"", ""Route"": 7 }
" + "\n" +
@" ],
" + "\n" +
@" ""EnableAcceptor"": true,
" + "\n" +
@" ""EnableAutoAcceptEscrow"": true,
" + "\n" +
@" ""EnablePayout"": true
" + "\n" +
@"}
" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/OpenConnection',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"ComPort": "COM5",
"SspAddress": 0,
"LogFilePath": "C:\\Temp\\Cash_Device_Log.log",
"EncKey": 81985526925837660,
"SetInhibits": [
{
"Denomination": "2000 GBP",
"Inhibit": true
},
{
"Denomination": "5000 GBP",
"Inhibit": true
}
],
"SetRoutes": [
{
"Denomination": "500 GBP",
"Route": 7
},
{
"Denomination": "1000 GBP",
"Route": 7
}
],
"EnableAcceptor": true,
"EnableAutoAcceptEscrow": true,
"EnablePayout": true
})

Document Revision - v.2 Cash Device REST API - 17


};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/OpenConnection"

payload = json.dumps({
"ComPort": "COM5",
"SspAddress": 0,
"LogFilePath": "C:\\Temp\\Cash_Device_Log.log",
"EncKey": 81985526925837660,
"SetInhibits": [
{
"Denomination": "2000 GBP",
"Inhibit": True
},
{
"Denomination": "5000 GBP",
"Inhibit": True
}
],
"SetRoutes": [
{
"Denomination": "500 GBP",
"Route": 7
},
{
"Denomination": "1000 GBP",
"Route": 7
}
],
"EnableAcceptor": True,
"EnableAutoAcceptEscrow": True,
"EnablePayout": True
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();

Document Revision - v.2 Cash Device REST API - 18


MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"ComPort\": \"COM5\",\r\n
\"SspAddress\": 0,\r\n \"LogFilePath\": \"C:\\\\Temp\\\\Cash_Device_Log.log\",\r\n
\"EncKey\": 81985526925837671, \n \"SetInhibits\": [\r\n { \"Denomination\":
\"2000 GBP\", \"Inhibit\": true },\r\n { \"Denomination\": \"5000 GBP\",
\"Inhibit\": true }\r\n ],\r\n \"SetRoutes\": [\r\n { \"Denomination\": \"500
GBP\", \"Route\": 7 },\r\n { \"Denomination\": \"1000 GBP\", \"Route\": 7 }
\r\n ],\r\n \"EnableAcceptor\": true,\r\n \"EnableAutoAcceptEscrow\": true,\r\n
\"EnablePayout\": true\r\n}\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/OpenConnection")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 19


REST API - DisconnectDevice
Description
Sets the device state to not connected and closes the communication port and threads.

Endpoint DisconnectDevice

Method POST

URL {server_url}/api/CashDevice/DisconnectDevice

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the device disconnected successfully.

NV200S: Device disconnected and


cleaned up successfully.

404 Not Found: Device ID Incorrect.

Device with ID NV200 not found.

500 Internal Server Error: If there is an error


disconnecting the device.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/DisconnectDevice?deviceID=NV200S",
Method.Post);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 20


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/DisconnectDevice?deviceID=NV200S',
'headers': {
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import http.client

conn = http.client.HTTPSConnection("localhost", 5000)


payload = ''
headers = {}
conn.request("POST", "/api/CashDevice/DisconnectDevice?deviceID=NV200S", payload,
headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/DisconnectDevice?deviceID=NV200S")
.method("POST", body)
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 21


REST API - StartDevice
Description
Creates a new thread to ‘run’ with an SSP device. The thread is essentially a state machine which runs through the
some initial setup of the device and retrieving information from it and then enters a normal ‘run’ routine, polling
the device for any new events.

Need to send “ConnectDevice” request before sending “StartDevice”.

Endpoint StartDevice

Method POST

URL {server_url}/api/CashDevice/StartDevice

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the device started successfully.

NV200S: Device started successfully.

500 Internal Server Error: If there is an error


starting the device.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/StartDevice?deviceID=NV200S",
Method.Post);

Document Revision - v.2 Cash Device REST API - 22


request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/StartDevice?deviceID=NV200S',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import http.client

conn = http.client.HTTPSConnection("localhost", 5000)


payload = ''
headers = {
'Authorization': 'Bearer eyJhb.....'
}
conn.request("POST", "/api/CashDevice/StartDevice?deviceID=NV200S", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/StartDevice?deviceID=NV200S")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 23


REST API - StopDevice
Description
Stops any running cash device threads, but does not close the COM port

Endpoint StopDevice

Method POST

URL {server_url}/api/CashDevice/StopDevice

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the device stopped successfully.

NV200S: Device stopped successfully.

500 Internal Server Error: If there is an error


stopping the device.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/StopDevice?deviceID=NV200S",
Method.Post);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 24


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/StopDevice?deviceID=NV200S',
'headers': {
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import http.client

conn = http.client.HTTPSConnection("localhost", 5000)


payload = ''
headers = {}
conn.request("POST", "/api/CashDevice/StopDevice?deviceID=NV200S", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/StopDevice?deviceID=NV200S")
.method("POST", body)
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 25


REST API - LogRawPackets
Description
Takes rawPacketsOptionSelected by default as true and flags the SSP to log the raw packet data.

Endpoint LogRawPackets

Method POST

URL {server_url}/api/CashDevice/LogRawPackets

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body bool rawPacketsOptionSelected

true

Responses
Status Body Notes

200 OK: If the raw packet logging was set


successfully.
NV200S: Raw packet logging has been
enabled.

400 Bad Request: If there is an error setting raw


packet logging.

404 Not Found: The cashDevice has not been


created.
NV200S: Cash device not found.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);

Document Revision - v.2 Cash Device REST API - 26


var request = new RestRequest("/api/CashDevice/LogRawPackets?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"true";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/LogRawPackets?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(true)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/LogRawPackets?deviceID=SPECTRAL_PAYOUT-
COM5"

payload = json.dumps(True)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "true");
Request request = new Request.Builder()

Document Revision - v.2 Cash Device REST API - 27


.url("http://localhost:5000/api/CashDevice/LogRawPackets?deviceID=SPECTRAL_PAYOUT-
COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 28


REST API - GetCompleteCashDevice
Description
• Returns all public read-only variables of the CashDevice object with their corresponding values.
• Refer to the following table for all available Public Read-Only Variables of CashDevice class

Endpoint GetCompleteCashDevice

Method GET

URL {server_url}/api/CashDevice/GetCompleteCashDevice

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Public Read-Only Variables of CashDevice class Table


Variable Name Description

comPort The communication port name used by the device.

deviceModel The model of the device.

deviceError The current error status of the device.

isOpen Indicates whether the device is open.

isDownloading Indicates whether a download operation is in progress.

firmware The firmware version of the device.

extendedFirmware The extended firmware version of the device.

dataset The dataset version of the device.

extendedDataset The extended dataset version of the device.

mainSerialNumber The main serial number of the device.

recycler1SerialNumber The serial number of the first recycler.

recycler2SerialNumber The serial number of the second recycler.

Document Revision - v.2 Cash Device REST API - 29


Variable Name Description

recycler3SerialNumber The serial number of the third recycler.

recycler4SerialNumber The serial number of the fourth recycler.

interfaceSerialNumber The serial number of the interface module.

dockSerialNumber The serial number of the docking station.

replenishmentCassetteSerialNumber The serial number of the replenishment cassette.

conveyorSerialNumber The serial number of the conveyor module.

coinFeederSerialNumber The serial number of the coin feeder module.

secondaryHopperSerialNumber The serial number of the secondary hopper.

payoutModuleSerialNumber The serial number of the payout module.

coinLifterSerialNumber The serial number of the coin lifter module.

mainSerialNumberValid Indicates whether the main serial number is valid.

recycler1SerialNumberValid Indicates whether the serial number of the first recycler is


valid.

recycler2SerialNumberValid Indicates whether the serial number of the second recycler


is valid.

recycler3SerialNumberValid Indicates whether the serial number of the third recycler is


valid.

recycler4SerialNumberValid Indicates whether the serial number of the fourth recycler


is valid.

interfaceSerialNumberValid Indicates whether the serial number of the interface


module is valid.

dockSerialNumberValid Indicates whether the serial number of the docking station


is valid.

replenishmentCassetteSerialNumberValid Indicates whether the serial number of the replenishment


cassette is valid.

conveyorSerialNumberValid Indicates whether the serial number of the conveyor


module is valid.

Document Revision - v.2 Cash Device REST API - 30


Variable Name Description

coinFeederSerialNumberValid Indicates whether the serial number of the coin feeder


module is valid.

secondaryHopperSerialNumberValid Indicates whether the serial number of the secondary


hopper is valid.

payoutModuleSerialNumberValid Indicates whether the serial number of the payout module


is valid.

coinLifterSerialNumberValid Indicates whether the serial number of the coin lifter


module is valid.

buildRevisionString The build revision string of the device.

initialMainBuildRevision The initial main build revision of the device.

mainBuildRevisionString The main build revision string of the device.

coinFeederBuildRevisionString The build revision string of the coin feeder.

seondaryHopperBuildRevisionString The build revision string of the secondary hopper.

coinLifterBuildRevisionString The build revision string of the coin lifter.

payoutModuleRevisionString The build revision string of the payout module.

primaryHopperAsciiTypeString The ASCII type string of the primary hopper.

coinFeederAsciiTypeString The ASCII type string of the coin feeder.

majorBuildRevision The major build revision number.

minorBuildRevision The minor build revision number.

reg_0 The value of register 0.

reg_1 The value of register 1.

reg_0_hex_string The hexadecimal string representation of register 0.

reg_1_hex_string The hexadecimal string representation of register 1.

globalErrorCode_0 The global error code 0.

globalErrorCode_1 The global error code 1.

Document Revision - v.2 Cash Device REST API - 31


Variable Name Description

unit_info_retrieved Indicates whether the unit information was retrieved.

lifterConnected Indicates whether the lifter is connected.

lifterOptoClear Indicates whether the lifter opto is clear.

lifterJammed Indicates whether the lifter is jammed.

lastGetLevelsSuccessful Indicates whether the last get levels operation was


successful.

service_information_string The service information string.

noPayinCount The number of no payin counts.

coinAcceptance_string The coin acceptance string.

counters_string The counters string.

coins_payout_request The number of coins requested for payout.

coins_seen_at_exit_sensor The number of coins seen at the exit sensor.

real_time_clock_string The real-time clock string.

cashbox_levels_string The cashbox levels string.

payout_count The payout count.

commandFailedDetailsString The details string for command failures.

maintenanceRequiredDetailsString The details string for maintenance required.

lifterEventString The lifter event string.

rejectCategory The reject category.

error_during_payout_details_string The details string for errors during payout.

ticketStatus The status of the barcode ticket.

barcode_ascii_data The ASCII data of the barcode.

barCodeHardwareStatus The hardware status of the barcode reader.

Document Revision - v.2 Cash Device REST API - 32


Variable Name Description

readersEnabled The enabled status of the barcode readers.

barCodeFormat The format of the barcode.

numberOfCharacters The number of characters in the barcode.

barCodeInhibit The inhibit status of the barcode reader.

RC_CurrentMode The current mode of the replenishment cassette.

currentRC_PayoutValue The current payout value of the replenishment cassette.

RC_DenominationForPayout The denomination for payout in the replenishment


cassette.

unknown_stored_in_cashbox The number of unknown items stored in the cashbox.

sspProtocolVersion The SSP protocol version.

downloadStatus The download status.

cashDeviceModules An array of cash device modules.

dispenseState The dispense transaction state.

noteInEscrow Indicates whether there is a note in escrow.

isMultiCurrency Indicates whether the device supports multiple currencies.

Document Revision - v.2 Cash Device REST API - 33


Responses
Status Body Notes

200 OK: Returns the complete information


of the cash device.
SPECTRAL_PAYOUT-COM5: {
"comPort": "COM5",
"deviceModel":
"SPECTRAL_DEVICE",
"deviceError": "NONE",
"isOpen": true,
"isDownloading": false,
"firmware": "NVS2004301038000",
"extendedFirmware": null,
"dataset": "GBP07056",
"extendedDataset": null,
"mainSerialNumber": 6331574,
"recycler1SerialNumber": 0,
"recycler2SerialNumber": 0,
"recycler3SerialNumber": 0,
"recycler4SerialNumber": 0,
"interfaceSerialNumber": 0,
"dockSerialNumber": 0,

"replenishmentCassetteSerialNumb
er": 0,
"conveyorSerialNumber": 0,
"coinFeederSerialNumber": 0,
"secondaryHopperSerialNumber":
0,
"payoutModuleSerialNumber":
5785286,
"coinLifterSerialNumber": 0,
"mainSerialNumberValid": false,
"recycler1SerialNumberValid":
false,
"recycler2SerialNumberValid":
false,
"recycler3SerialNumberValid":
false,
"recycler4SerialNumberValid":
false,
"interfaceSerialNumberValid":
false,
"dockSerialNumberValid": false,

"replenishmentCassetteSerialNumb
erValid": false,
"conveyorSerialNumberValid":
false,
"coinFeederSerialNumberValid":
false,

"secondaryHopperSerialNumberVali
d": false,

"payoutModuleSerialNumberValid":
true,

Document Revision - v.2 Cash Device REST API - 34


Status Body Notes

"coinLifterSerialNumberValid":
false,
"buildRevisionString": "1.01",
"initialMainBuildRevision": 0,
"mainBuildRevisionString":
"9.10",

"coinFeederBuildRevisionString":
null,

"seondaryHopperBuildRevisionStri
ng": null,

"coinLifterBuildRevisionString":
null,
"payoutModuleRevisionString":
"1.01",
"primaryHopperAsciiTypeString":
null,
"coinFeederAsciiTypeString":
null,
"majorBuildRevision": 1,
"minorBuildRevision": 1,
"reg_0": 0,
"reg_1": 0,
"reg_0_hex_string": null,
"reg_1_hex_string": null,
"globalErrorCode_0": 0,
"globalErrorCode_1": 0,
"unit_info_retrieved": true,
"lifterConnected": false,
"lifterOptoClear": false,
"lifterJammed": false,
"lastGetLevelsSuccessful":
true,
"service_information_string":
null,
"noPayinCount": 0,
"coinAcceptance_string": null,
"counters_string": "Number of
counters in set: 5\nStacked:
261\nStored: 42\nDispensed:
30\nTransferred to stack:
11\nRejected: 26\n",
"coins_payout_request": 0,
"coins_seen_at_exit_sensor": 0,
"real_time_clock_string": null,
"cashbox_levels_string": null,
"payout_count": 0,
"commandFailedDetailsString":
null,

"maintenanceRequiredDetailsStrin
g": null,
"lifterEventString": null,
"rejectCategory": null,

Document Revision - v.2 Cash Device REST API - 35


Status Body Notes

"error_during_payout_details_str
ing": null,
"ticketStatus": null,
"barcode_ascii_data": null,
"barCodeHardwareStatus": null,
"readersEnabled": null,
"barCodeFormat": null,
"numberOfCharacters": null,
"barCodeInhibit": null,
"nv22SpectralDevice": false,
"enablePayoutDeviceError":
null,
"recyclerCountersString": null,
"RC_CurrentMode":
"RC_MODE_REPLENISH",
"currentRC_PayoutValue": null,
"RC_DenominationForPayout":
null,
"unknown_stored_in_cashbox": 0,
"sspProtocolVersion": 7,
"downloadStatus": {
"State": "IDLE",
"CurrentRamBlock": 0,
"TotalRamBlocks": 0,
"CurrentDownloadBlock": 0,
"TotalDownloadBlocks": 0
},
"cashDeviceModules": null,
"dispenseState": "COMPLETED",
"isMultiCurrency": false,
"noteInEscrow": false,
"currencyAssignment": [
{
"Type": "BANKNOTE",
"ValueCountryCode": {
"Value": 500,
"CountryCode": "GBP",
"Fraud_Attempt_Value": -1,

"Calibration_Failed_Value": -1
},
"Value": 500,
"CountryCode": "GBP",
"IsInhibited": false,
"IsRecyclable": true,
"AcceptRoute": "PAYOUT",
"Stored": 0,
"StoredInCashbox": 0,
"Channel": 1
},
{
"Type": "BANKNOTE",
"ValueCountryCode": {
"Value": 1000,
"CountryCode": "GBP",
"Fraud_Attempt_Value": -1,

Document Revision - v.2 Cash Device REST API - 36


Status Body Notes

"Calibration_Failed_Value": -1
},
"Value": 1000,
"CountryCode": "GBP",
"IsInhibited": false,
"IsRecyclable": true,
"AcceptRoute": "PAYOUT",
"Stored": 0,
"StoredInCashbox": 0,
"Channel": 2
},
{
"Type": "BANKNOTE",
"ValueCountryCode": {
"Value": 2000,
"CountryCode": "GBP",
"Fraud_Attempt_Value": -1,

"Calibration_Failed_Value": -1
},
"Value": 2000,
"CountryCode": "GBP",
"IsInhibited": true,
"IsRecyclable": true,
"AcceptRoute": "CASHBOX",
"Stored": 0,
"StoredInCashbox": 0,
"Channel": 3
},
{
"Type": "BANKNOTE",
"ValueCountryCode": {
"Value": 5000,
"CountryCode": "GBP",
"Fraud_Attempt_Value": -1,

"Calibration_Failed_Value": -1
},
"Value": 5000,
"CountryCode": "GBP",
"IsInhibited": true,
"IsRecyclable": true,
"AcceptRoute": "CASHBOX",
"Stored": 0,
"StoredInCashbox": 0,
"Channel": 4
}
],
"sorterRouteAssignment": [],
"deviceState": "IDLE"
}

404 Not Found: If the device is not found.

Document Revision - v.2 Cash Device REST API - 37


Status Body Notes

500 Internal Server Error: If there is an


error retrieving the device details.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetCompleteCashDevice?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetCompleteCashDevice?deviceID=NV200S',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import http.client

conn = http.client.HTTPSConnection("localhost", 5000)


payload = ''
headers = {
'Authorization': 'Bearer eyJhb.....'
}
conn.request("GET", "/api/CashDevice/GetCompleteCashDevice?deviceID=NV200S", payload,
headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Document Revision - v.2 Cash Device REST API - 38


Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetCompleteCashDevice?deviceID=NV200S")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 39


REST API - GetDeviceStatus
Description
Retrieve the state changes of the device when different types of events are triggered.

The client should implement a mechanism to continuously poll the device status from the server at a
specified interval. E.g. 200 milliseconds.

Endpoint GetDeviceStatus

Method GET

URL {server_url}/api/CashDevice/GetDeviceStatus

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Document Revision - v.2 Cash Device REST API - 40


Response Types and Strings
type stateAsString

DeviceStatusRespone NOT_CONNECTED,
CONNECTING,
STARTING,
STARTED,
DISABLED,
IDLE,
ACCEPTING,
DISPENSING,
FLOATING,
EMPTYING,
REPLENISHING,
JAM_RECOVERY,
ERROR,
DEVICE_FULL,
RESET,
CONNECTED,
STOPPED,
PURGING,
PURGED,
INITIALISING,
CASHBOX_REMOVED,
CASHBOX_REPLACED,
STOPPING,
PAY_IN_ACTIVE,
COIN_MECH_ENABLED,
COIN_MECH_DISABLED,
MAINTENANCE_REQUIRED,
CHANNEL_DISABLE,
CALIBRATION_FAILED,
FRAUD_ATTEMPT,
LIFTER_EVENT,
REJECTING,
REJECTED,
COIN_MECH_JAMMED,
NOTE_HELD_IN_BEZEL,
BAR_CODE_TICKET_VALIDATED,
BAR_CODE_TICKET_ACKNOWLEDGE,

Document Revision - v.2 Cash Device REST API - 41


type stateAsString

NOTE_FLOAT_REMOVED,
NOTE_FLOAT_ATTACHED,
NOTE_PATH_OPEN

DispenserTransactionEventResponse IN_PROGRESS,
COMPLETED,
ERROR

CashEventResponse ESCROW,
STACKED,
STACKED_FRAUD_ATTEMPT,
STORED,
STORED_FRAUD_ATTEMPT,
DISPENSING,
DISPENSED,
REJECTED,
RETRIEVED,
MOVED_TO_CASHBOX,
NOTE_IN_BEZEL_HOLD,
VALUE_ADDED,
TIME_OUT,
INCOMPLETE_PAYOUT,
INCOMPLETE_FLOAT,
FRAUD_ATTEMPT,
HALTED,
CALIBRATION_FAILED,
JAMMED,
COIN_CREDIT,
ERROR_DURING_PAYOUT,
NOTE_CLEARED_TO_CASHBOX,
NOTE_CLEARED_FROM_FRONT

ReplenishEventResponse REPLENISH_STORED,
REPLENISH_SENT_TO_RC_TRAY,
REPLENISH_CASSETTE_REMOVED,
REPLENISH_CASSETTE_REPLACED,
REPLENISH_CASSETTE_FULL

Document Revision - v.2 Cash Device REST API - 42


type result

SetDenominationRouteFinishedEventResponse True
False

transactionType
• 0 = PAYOUT
• 1 = FLOAT
• 2 = REPLENISH
• 3 = EMPTY
• 4 = PAYOUT_BY_DENOMINATION

Response Examples
Status Body Notes

200 OK: Returns the list of states of the device.

[ E.g. Returning a queue of states


{ [CONNECTING, CONNECTED}
"type":
"DeviceStatusResponse",
"state": 1,
"stateAsString": "CONNECTING",
"isRunning": true,
"message": "Device state
changed: CONNECTING"
},
{
"type":
"DeviceStatusResponse",
"state": 15,
"stateAsString": "CONNECTED",
"isRunning": true,
"message": "Device state
changed: CONNECTED"
}
]

Document Revision - v.2 Cash Device REST API - 43


Status Body Notes

200 OK: Returns the list of states of the device.

[ E.g. Returning a queue of states


{ [ACCEPTING, ESCROW VALUE 500 GBP,
"type":"DeviceStatusResponse", STORED VALUE 500 GBP, IDLE}
"stateAsString":"ACCEPTING",
"message":"Device state changed:
ACCEPTING"
},
{
"type":"CashEventResponse",
"eventTypeAsString":"ESCROW",
"value":500,
"value2":0,
"countryCode":"GBP",
"message":"Cash event: ESCROW -
Value: 500 Value2: 0 - CountryCode:
GBP"
},
{
"type":"CashEventResponse",
"eventTypeAsString":"STORED",
"value":500,
"value2":0,
"countryCode":"GBP",
"message":"Cash event: STORED -
Value: 500 Value2: 0 - CountryCode:
GBP"
},
{
"type":"DeviceStatusResponse",
"stateAsString":"IDLE",
"message":"Device state changed:
IDLE"
}
]

500 Internal Server Error: If there is an error


retrieving the device states.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetDeviceStatus?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);

Document Revision - v.2 Cash Device REST API - 44


Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetDeviceStatus?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetDeviceStatus?deviceID=SPECTRAL_PAYOUT-
COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetDeviceStatus?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 45


REST API - GetCounters
Description
Retrieves the counter information from the device and formats the data into a readable string:
• SMART_COIN_SYSTEM, TWIN_SMART_COIN_SYSTEM, SMART_HOPPER_4: Retrieves and formats the number
of counters, coins paid out, coins paid in, feeder rejects, hopper jams, feeder jams, fraud attempts,
calibration fails, resets, and coins sent to cashbox.
• NV4000, SPECTRAL_DEVICE: Retrieves and formats the number of counters, stacked, stored, dispensed,
transferred to stack, and rejected counts.

Endpoint GetCounters

Method GET

URL {server_url}/api/CashDevice/GetCounters

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the counters data was retrieved


successfully.
SPECTRAL_PAYOUT-COM5: { CountersData
= Number of counters in set: 5
Stacked: 261
Stored: 42
Dispensed: 30
Transferred to stack: 11
Rejected: 26
}

400 Bad Request: If there is an error retrieving


the counters data.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{

Document Revision - v.2 Cash Device REST API - 46


MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetCounters?deviceID=SPECTRAL_PAYOUT-
COM5", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetCounters?deviceID=SPECTRAL_PAYOUT-
COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetCounters?deviceID=SPECTRAL_PAYOUT-
COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetCounters?deviceID=SPECTRAL_PAYOUT-
COM5")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();

Document Revision - v.2 Cash Device REST API - 47


Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 48


REST API - GetAllLevels
Description
• Retrieves the current levels of all denominations from the device and updates the internal state with this
information.
• For each level entry, it calculates the index using the denomination value and currency code.
• If the index is valid, it updates the stored level for that denomination.

Endpoint GetAllLevels

Method GET

URL {server_url}/api/CashDevice/GetAllLevels

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Document Revision - v.2 Cash Device REST API - 49


Responses
Status Body Notes

200 OK: Returns the levels information.

{
"levels": [
{
"countryCode": "GBP",
"value": 500,
"stored": 0
},
{
"countryCode": "GBP",
"value": 1000,
"stored": 0
},
{
"countryCode": "GBP",
"value": 2000,
"stored": 0
},
{
"countryCode": "GBP",
"value": 5000,
"stored": 0
}
],
"success": true,
"message": "Successfully
retrieved all levels."
}

400 If there is an error retrieving levels


information.

Response with 200. The response body contains a LevelsResult object. The structure of the LevelsResult is
described below:

Field Type Description

Levels List<LevelInfo> A list of LevelInfo objects representing the levels of


different denominations.

Success bool Indicates whether the operation was successful.

Message string A message providing additional information about the


operation.

Each LevelInfo object in the Levels list has the following structure:

Field Type Description

Country string The country code of the denomination.


Code

Document Revision - v.2 Cash Device REST API - 50


Field Type Description

Value uint The value of the denomination.

Stored uint The number of stored units of this denomination.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetAllLevels?deviceID=SPECTRAL_PAYOUT-
COM5", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetAllLevels?deviceID=SPECTRAL_PAYOUT-
COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetAllLevels?deviceID=SPECTRAL_PAYOUT-
COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

Document Revision - v.2 Cash Device REST API - 51


print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetAllLevels?deviceID=SPECTRAL_PAYOUT-
COM5")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 52


REST API - GetCurrencyAssignment
Description
Get the levels of cash currently stored for each channel in the devices dataset.

Endpoint GetCurrencyAssignment

Method GET

URL {server_url}/api/CashDevice/GetCurrencyAssignment

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Document Revision - v.2 Cash Device REST API - 53


Responses
Status Body Notes

200 Ok: If the currency assignments were


retrieved successfully.
[
{
"type": 1,
"valueCountryCode": {
"value": 500,
"countryCode": "GBP",
"fraud_Attempt_Value": -1,

"calibration_Failed_Value": -1
},
"value": 500,
"countryCode": "GBP",
"isInhibited": false,
"isRecyclable": true,
"acceptRoute": 7,
"stored": 0,
"storedInCashbox": 0,
"channel": 1
},
{
"type": 1,
"valueCountryCode": {
"value": 1000,
"countryCode": "GBP",
"fraud_Attempt_Value": -1,

"calibration_Failed_Value": -1
},
"value": 1000,
"countryCode": "GBP",
"isInhibited": false,
"isRecyclable": true,
"acceptRoute": 7,
"stored": 0,
"storedInCashbox": 0,
"channel": 2
},
{
"type": 1,
"valueCountryCode": {
"value": 2000,
"countryCode": "GBP",
"fraud_Attempt_Value": -1,

"calibration_Failed_Value": -1
},
"value": 2000,
"countryCode": "GBP",
"isInhibited": true,
"isRecyclable": true,
"acceptRoute": 0,
"stored": 0,
"storedInCashbox": 0,

Document Revision - v.2 Cash Device REST API - 54


Status Body Notes

"channel": 3
},
{
"type": 1,
"valueCountryCode": {
"value": 5000,
"countryCode": "GBP",
"fraud_Attempt_Value": -1,

"calibration_Failed_Value": -1
},
"value": 5000,
"countryCode": "GBP",
"isInhibited": true,
"isRecyclable": true,
"acceptRoute": 0,
"stored": 0,
"storedInCashbox": 0,
"channel": 4
}
]

404 Not Found: If no currency assignments


were found.

400 Bad Request: If there is an error retrieving


the currency assignments.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetCurrencyAssignment?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetCurrencyAssignment?
deviceID=SPECTRAL_PAYOUT-COM5',

Document Revision - v.2 Cash Device REST API - 55


'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetCurrencyAssignment?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetCurrencyAssignment?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 56


REST API - SetDenominationLevel
Description
A command to increment the level of coins of the specified denomination stored in the hopper.

Endpoint SetDenominationLevel

Method POST

URL {server_url}/api/CashDevice/SetDenominationLevel

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Body SetDenominationLevelRequest: The request body containing Value, CountryCode and


NumCoinsToAdd.
• UInt32 Value: Value of denomination to set e.g 500, 1000 etc
• string CountryCode: ASCII country code of denomination e.g. “GBP”, “EUR”, “USD” etc
• uint numCoinsToAdd: the amount of coins to add to level (0 will clear the level)

{
"Value": 100,
"CountryCode": "{{Currency}}",
"NumCoinsToAdd": 1
}

Responses
Status Body Notes

200 OK: If the denomination level was set


successfully.
SMART_COIN_SYSTEM-COM10: Denomination
level set successfully.

400 Bad Request: Failed to set denomination


level.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);

Document Revision - v.2 Cash Device REST API - 57


var request = new RestRequest("/api/CashDevice/SetDenominationLevel?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""Value"": 100, " + "\n" +
@" ""CountryCode"": ""GBP""," + "\n" +
@" ""NumCoinsToAdd"": 1" + "\n" +
@"}" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetDenominationLevel?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"Value": 100,
"CountryCode": "GBP",
"NumCoinsToAdd": 1
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetDenominationLevel?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = json.dumps({
"Value": 100,
"CountryCode": "GBP",
"NumCoinsToAdd": 1
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

Document Revision - v.2 Cash Device REST API - 58


response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"Value\": 100, \r\n
\"CountryCode\": \"GBP\",\r\n \"NumCoinsToAdd\": 1\r\n}\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetDenominationLevel?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 59


REST API - EnablePayout
Description
Enables a connected pay-out module for storing and payout cash.

Endpoint EnablePayout

Method POST

URL {server_url}/api/CashDevice/EnablePayout

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the payout was enabled successfully.

Payout enabled successfully.

400 Bad Request: If there is an error enabling


the payout.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/EnablePayout?deviceID=SPECTRAL_PAYOUT-
COM5", Method.Post);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 60


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/EnablePayout?deviceID=SPECTRAL_PAYOUT-
COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/EnablePayout?deviceID=SPECTRAL_PAYOUT-
COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/EnablePayout?deviceID=SPECTRAL_PAYOUT-
COM5")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 61


REST API - EnablePayoutDevice
Description
Enables a connected pay-out module for storing and payout cash.

Endpoint EnablePayoutDevice

Method POST

URL {server_url}/api/CashDevice/EnablePayoutDevice

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the payout was enabled successfully.

SPECTRAL_PAYOUT-COM5: Payout device


enabled successfully.

400 Cash device not found

Cash device not found

500 Internal Server Error: An error occurred


while enabling the payout device.
Failed to enable payout device.
Error: {error_message}

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);

Document Revision - v.2 Cash Device REST API - 62


var request = new RestRequest("/api/CashDevice/EnablePayoutDevice?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"";
request.AddParameter("text/plain", body, ParameterType.RequestBody);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/EnablePayoutDevice?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/EnablePayoutDevice?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = ""
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/EnablePayoutDevice?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 63


REST API - EnablePayoutDeviceWithByte
Description
These options do not persist in memory and after a reset they will go to their default values.

Enables a connected pay-out module for storing and payout cash with an additional byte for settings.

Endpoint EnablePayoutDeviceWithByte

Method POST

URL {server_url}/api/CashDevice/EnablePayoutDeviceWithByte

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body EnablePayoutDeviceByte (byte): Specifies whether to enable the payout device with specific
settings.

{
"EnablePayoutDeviceByte": 0
}

Request Body Structure

Single Denomination Recycler


For NV11 / NV11S this request uses an addition data byte, a bit register allows some options to be set. When the
additional byte is not sent, all the bits default to 0.

Bit Function

0 GIVE_VALUE_ON_STORED. Set to 1 to enable the value of the note stored to be given with the Note
Stored event.

1 NO_HOLD_NOTE_ON_PAYOUT. Set to 1 to enable the function of fully rejecting the dispensed banknote
rather than holding it in the bezel.

2 Unused - Set to 0

3 Enable report reverse validated value on payout (NV11S only, fw >= 1.19). If set 1, unit will report reverse
validated value on dispensed event. If set 0, unit will report expected note value.

4 Unused - Set to 0

Document Revision - v.2 Cash Device REST API - 64


Bit Function

5 Unused - Set to 0

6 Unused - Set to 0

7 Unused - Set to 0

Multi Denomination Recycler


For Spectral Payout Range and NV22 this request uses an additional data byte, a bit register allows some options to
be set. When the additional byte is not sent, all the bits default to 0.

Bit Function

0 REQUIRE_FULL_STARTUP. If set to 1 the Payout will return busy until it has fully completed the startup
procedure.

1 OPTIMISE_FOR_PAYIN_SPEED. If set to 1 the device will always move towards an empty slot when idle to
try and ensure the shortest pay in speed possible.

2 HIGHEST_VALUE_SPLIT (NV22 only, Firmware versions ≥1.17).


• Set to 0: unit will split the amount to pay it quicker
• Set to 1: the unit will use the smallest number of notes to pay out the amount
The highest value only applies to payout/float by amount.

3 On Spectral Payout only (FW versions ≥ 4.29). If bit is set to 1 unit will report dispensing event with
expected note value when reverse validation fail.
Dataset with reverse validation enabled must be used (EUR11, GBP11, USD11…).

4 Unused - Set to 0

5 Unused - Set to 0

6 Unused - Set to 0

7 Unused - Set to 0

Responses
Status Body Notes

200 OK: If the payout was enabled successfully.

SPECTRAL_PAYOUT-COM5: Payout device


enabled successfully.

Document Revision - v.2 Cash Device REST API - 65


Status Body Notes

404 Not Found: The specified cash device was


not initialised
Cash device not found

500 Internal Server Error: An error occurred


while enabling the payout device.
Failed to enable payout device.
Error: {error_message}

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/EnablePayoutDeviceWithByte?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""EnablePayoutDeviceByte"": 0" + "\n" +
@"}" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/EnablePayoutDeviceWithByte?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"EnablePayoutDeviceByte": 0
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Document Revision - v.2 Cash Device REST API - 66


Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/EnablePayoutDeviceWithByte?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = json.dumps({
"EnablePayoutDeviceByte": 0
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n
\"EnablePayoutDeviceByte\": 0\r\n}\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/EnablePayoutDeviceWithByte?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 67


REST API - DisablePayout
Description
Disables a connected pay-out module.

Endpoint DisablePayout

Method POST

URL {server_url}/api/CashDevice/DisablePayout

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 Payout disabled successfully. OK: If the payout was disabled successfully.

400 Bad Request: If there is an error disabling


the payout.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/DisablePayout?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');

Document Revision - v.2 Cash Device REST API - 68


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/DisablePayout?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/DisablePayout?deviceID=SPECTRAL_PAYOUT-
COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/DisablePayout?deviceID=SPECTRAL_PAYOUT-
COM5")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 69


REST API - EnableAcceptor
Description
Enables the cash device to accept currency, does not enable any connected pay-out modules.

Endpoint EnableAcceptor

Method POST

URL {server_url}/api/CashDevice/EnableAcceptor

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the acceptor was enabled


successfully.
NV200S: Acceptor enabled
successfully.

500 Internal Server Error: If there is an error


enabling the acceptor.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/EnableAcceptor?deviceID=NV200S",
Method.Post);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 70


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/EnableAcceptor?deviceID=NV200S',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import http.client

conn = http.client.HTTPSConnection("localhost", 5000)


payload = ''
headers = {
'Authorization': 'Bearer eyJhb.....'
}
conn.request("POST", "/api/CashDevice/EnableAcceptor?deviceID=NV200S", payload,
headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/EnableAcceptor?deviceID=NV200S")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 71


REST API - DisableAcceptor
Description
Disables the acceptor to stop accepting currency, any connected and enabled pay-out modules will stay enabled
and still pay-out cash

Endpoint DisableAcceptor

Method POST

URL {server_url}/api/CashDevice/DisableAcceptor

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the acceptor was disabled


successfully.
SPECTRAL_PAYOUT-COM5: Acceptor
disabled successfully.

500 Internal Server Error: If there is an error


disabling the acceptor.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/DisableAcceptor?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 72


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/DisableAcceptor?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/DisableAcceptor?deviceID=SPECTRAL_PAYOUT-
COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/DisableAcceptor?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 73


REST API - SetAutoAccept
Description
Enable or disable auto accept from escrow.

Endpoint SetAutoAccept

Method POST

URL {server_url}/api/CashDevice/SetAutoAccept

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body (boolean) true to enable and false to disable auto accept notes held in escrow.

Responses
Status Body Notes

200 OK: If auto accept was set correctly.

SPECTRAL_PAYOUT-COM5: Auto-accept set


to True

500 Internal Server Error: If there is an error


enabling the acceptor.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetAutoAccept?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"true";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 74


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetAutoAccept?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(true)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetAutoAccept?deviceID=SPECTRAL_PAYOUT-
COM5"

payload = json.dumps(True)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "true");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetAutoAccept?deviceID=SPECTRAL_PAYOUT-
COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 75


REST API - AcceptFromEscrow
Description
Accepts a note currently being held in escrow.

Endpoint AcceptFromEscrow

Method POST

URL {server_url}/api/CashDevice/AcceptFromEscrow

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the note can be accepted from


escrow.
SPECTRAL_PAYOUT-COM5: Note can be
accepted from escrow.

400 Fail: No note in escrow.

SPECTRAL_PAYOUT-COM5: Error accepting


note from escrow

500 Internal Server Error: If there is an error


accepting the note from escrow.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/AcceptFromEscrow?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Authorization", "Bearer eyJhb.....");

Document Revision - v.2 Cash Device REST API - 76


RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/AcceptFromEscrow?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/AcceptFromEscrow?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/AcceptFromEscrow?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 77


REST API - ReturnFromEscrow
Description
Returns a note currently being held in escrow

Endpoint ReturnFromEscrow

Method POST

URL {server_url}/api/CashDevice/ReturnFromEscrow

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the note can be returned from


escrow.
SPECTRAL_PAYOUT-COM5: Note can be
returned from escrow.

400 Bad Request: No note in escrow.

SPECTRAL_PAYOUT-COM5: Error returning


note from escrow

500 Internal Server Error: If there is an error


returning the note from escrow.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/ReturnFromEscrow?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Authorization", "Bearer eyJhb.....");

Document Revision - v.2 Cash Device REST API - 78


RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/ReturnFromEscrow?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/ReturnFromEscrow?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/ReturnFromEscrow?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 79


REST API - SetDenominationInhibits
Description
Sets the inhibit status for a list of denomination and country code pairs.

Endpoint SetDenominationInhibits

Method POST

URL {server_url}/api/CashDevice/SetDenominationInhibits

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body InhibitsRequest: The request body containing ValueCountryCodes and Inhibit.


• List<string> ValueCountryCodes: A list of string representing the denominations and
their respective country codes.
• bool inhibit: Set true to inhibit the denominations, false to uninhibit

{
"ValueCountryCodes": ["2000 {{Currency}}", "5000 {{Currency}}"],
"Inhibit": true
}

Responses
Status Body Notes

200 OK: If denomination inhibits set


successfully.
SPECTRAL_PAYOUT-COM5: Denomination
inhibits set successfully.

400 Bad Request: Failed to set denomination


inhibits.
Failed to set denomination inhibits.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,

Document Revision - v.2 Cash Device REST API - 80


};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetDenominationInhibits?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""ValueCountryCodes"": [""2000 GBP"", ""5000 GBP""]," + "\n" +
@" ""Inhibit"": true" + "\n" +
@"}" + "\n" +
@"" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetDenominationInhibits?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"ValueCountryCodes": [
"2000 GBP",
"5000 GBP"
],
"Inhibit": true
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetDenominationInhibits?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = json.dumps({
"ValueCountryCodes": [
"2000 GBP",
"5000 GBP"
],
"Inhibit": True

Document Revision - v.2 Cash Device REST API - 81


})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"ValueCountryCodes\":
[\"2000 GBP\", \"5000 GBP\"],\r\n \"Inhibit\": true\r\n}\r\n\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetDenominationInhibits?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 82


REST API - SetDenominationInhibitByIndex
Description
Sets the inhibit status for a specific denomination based on its index.

As the index starts from 0, channel 1 will be “index”: 0.

Endpoint SetDenominationInhibitByIndex

Method POST

URL {server_url}/api/CashDevice/SetDenominationInhibitByIndex

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body DenominationInhibitByIndexRequest: The request body containing Index and Inhibit.


• UInt32 index: The index of the denomination to inhibit or uninhibit.
• bool inhibit: Set true to inhibit the denominations, false to uninhibit.

{
"Index": 2,
"Inhibit": false
}

Responses
Status Body Notes

200 OK: If denomination inhibit was set


successfully.
SPECTRAL_PAYOUT-COM5: Denomination at
index 2 successfully uninhibited.

500 Internal Server Error: If there is an error


setting the denomination inhibit.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{

Document Revision - v.2 Cash Device REST API - 83


MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetDenominationInhibitByIndex?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""Index"": 2," + "\n" +
@" ""Inhibit"": false" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetDenominationInhibitByIndex?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"Index": 2,
"Inhibit": false
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetDenominationInhibitByIndex?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = json.dumps({
"Index": 2,
"Inhibit": False
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

Document Revision - v.2 Cash Device REST API - 84


print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"Index\": 2,\r\n
\"Inhibit\": false\r\n}");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetDenominationInhibitByIndex?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 85


REST API - SetDenominationInhibit
Description
Sets the inhibit status for a single denomination and country code pair.

Endpoint SetDenominationInhibit

Method POST

URL {server_url}/api/CashDevice/SetDenominationInhibit

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • The request body containing Value, CountryCode and Inhibit.


• UInt32 Value: Denomination value e.g 500, 1000 etc
• string CountryCode: The country code of the currency e.g. “GBP”, “EUR”, “USD”
etc
• bool inhibit: Set true to inhibit the denomination, false to uninhibit.

{
"Value": 1000, "CountryCode": "{{Currency}}",
"Inhibit": true
}

Responses
Status Body Notes

200 OK: If denomination inhibit was set


successfully.
SPECTRAL_PAYOUT-COM5: Denomination
1000 for country GBP successfully
inhibited.

500 Internal Server Error: If there is an error


setting the denomination inhibit.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{

Document Revision - v.2 Cash Device REST API - 86


MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetDenominationInhibit?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""Value"": 1000, ""CountryCode"": ""GBP""," + "\n" +
@" ""Inhibit"": true" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetDenominationInhibit?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"Value": 1000,
"CountryCode": "GBP",
"Inhibit": true
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetDenominationInhibit?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = json.dumps({
"Value": 1000,
"CountryCode": "GBP",
"Inhibit": True
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

Document Revision - v.2 Cash Device REST API - 87


response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"Value\": 1000,
\"CountryCode\": \"GBP\",\r\n \"Inhibit\": true\r\n}");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetDenominationInhibit?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 88


REST API - SetDenominationRoute
Description
Configure the specified denomination to be either routed to cashbox or stored to be made available for later
possible payout

Endpoint SetDenominationRoute

Method POST

URL {server_url}/api/CashDevice/SetDenominationRoute

Parameters • deviceID (string): The unique identifier of the cash device.

Body SetDenomRoutesRequest: The request body containing Value, CountryCode and Route.
• ValueCountryCode valueCountryCode: is an object representing the denomination and
its respective country code:
• UInt32 Value: Denomination value e.g 500, 1000 etc
• string CountryCode: The country code of the currency e.g. “GBP”, “EUR”, “USD”
etc
• DenominationRoute route:
• "Route": 0: DenominationRoute.CASHBOX: Routes to cashbox
• "Route": 1 : DenominationRoute.RECYCLER: Routes to single recycler
(Smart Pay-out) or an available recycler (NV4000)
• "Route": 2: DenominationRoute.RECYCLER_1: Routes to the first (top)
recycler, NV4000 only
• "Route": 3: DenominationRoute.RECYCLER_2: Routes to the second
recycler, NV4000 only
• "Route": 4: DenominationRoute.RECYCLER_3: Routes to the third recycler,
NV4000 only
• "Route": 5: DenominationRoute.RECYCLER_4: Routes to the fourth
(bottom) recycler, NV4000 only

{
"Value": 500,
"CountryCode": "{{currency}}",
"Route": 1
}

Responses
Status Body Notes

200 NV200S: Set 500 EUR route to RECYCLER Ok: If the denomination route was set
successfully! successfully.

400 Bad Request: If there is an error setting the


denomination route.

Document Revision - v.2 Cash Device REST API - 89


Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetDenominationRoute?deviceID=NV200S",
Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{
" + "\n" +
@" ""Value"": 500,
" + "\n" +
@" ""CountryCode"": ""EUR"",
" + "\n" +
@" ""Route"": 1
" + "\n" +
@"}
" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetDenominationRoute?deviceID=NV200S',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"Value": 500,
"CountryCode": "EUR",
"Route": 1
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

Document Revision - v.2 Cash Device REST API - 90


import json

url = "http://localhost:5000/api/CashDevice/SetDenominationRoute?deviceID=NV200S"

payload = json.dumps({
"Value": 500,
"CountryCode": "EUR",
"Route": 1
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"Value\": 500,\r\n
\"CountryCode\": \"EUR\",\r\n \"Route\": 1\r\n}\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetDenominationRoute?deviceID=NV200S")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 91


REST API - GetBarcodeReaderConfiguration
Description
Allows the host to set-up the barcode reader(s) configuration on the device

Endpoint GetBarcodeReaderConfiguration

Method GET

URL {server_url}/api/CashDevice/GetBarcodeReaderConfiguration

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
• hardwareStatus:
• None
• Top reader fitted
• Bottom reader fitted
• Both fitted
• readerEnabled:
• None
• Top
• Bottom
• Both
• barcodeFormat:
• None
• Interleaced 2 of 5
• numCharacters:
• Min6, Max 24

Status Body Notes

200 OK: Successfully retrieved the barcode


reader configuration.
{
"hardwareStatus": "Both fitted",
"readersEnabled": "Both",
"barcodeFormat": "Interleaved 2
of 5",
"numCharacters": "18"
}

404 Not Found: The specified cash device was


not initialised
Cash device not found

Document Revision - v.2 Cash Device REST API - 92


Status Body Notes

500 Internal Server Error: Unable to retrieve


barcode reader configuration.
Unable to get barcode reader
configuration.

500 Internal Server Error: An error occurred


while retrieving the configuration.
Error during barcode reader
configuration: {error_message}

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetBarcodeReaderConfiguration?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"";
request.AddParameter("text/plain", body, ParameterType.RequestBody);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetBarcodeReaderConfiguration?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

Document Revision - v.2 Cash Device REST API - 93


url = "http://localhost:5000/api/CashDevice/GetBarcodeReaderConfiguration?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = ""
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetBarcodeReaderConfiguration?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 94


REST API - SetBarcodeReaderConfiguration
Description
Allows the host to set-up the barcode reader(s) configuration on the device

Endpoint SetBarcodeReaderConfiguration

Method POST

URL {server_url}/api/CashDevice/SetBarcodeReaderConfiguration

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • byte EnableReaders: Enable Readers


• 0x00 = Enable none
• 0x01 = Enable top
• 0x02 = Enable bottom
• 0x03 = Enable both
• byte BarCodeFormat: Bar code format
• 0x00 = None
• 0x01 = Interleaved 2 of 5
• byte NumberOfCharacters: Number of characters
• Min 6 – Max 24

{
"EnableReaders": 0,
"BarCodeFormat": 0,
"NumberOfCharacters": 6
}

Responses
Status Body Notes

200 OK: Barcode reader configuration was


successfully updated.
Barcode reader configuration updated
successfully.

404 Not Found: The specified cash device was


not initialised
Cash device not found

Document Revision - v.2 Cash Device REST API - 95


Status Body Notes

500 Internal Server Error: Unable to retrieve


Barcode Data.
Unable to update barcode reader
configuration.

500 Internal Server Error: An error occurred


while updating configuration.
Error during barcode reader
configuration: {error_message}

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetBarcodeReaderConfiguration?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""EnableReaders"": 0," + "\n" +
@" ""BarCodeFormat"": 0," + "\n" +
@" ""NumberOfCharacters"": 6" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetBarcodeReaderConfiguration?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"EnableReaders": 0,
"BarCodeFormat": 0,
"NumberOfCharacters": 6
})

};

Document Revision - v.2 Cash Device REST API - 96


request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetBarcodeReaderConfiguration?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = json.dumps({
"EnableReaders": 0,
"BarCodeFormat": 0,
"NumberOfCharacters": 6
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"EnableReaders\": 0,\r\n
\"BarCodeFormat\": 0,\r\n \"NumberOfCharacters\": 6\r\n}");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetBarcodeReaderConfiguration?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 97


REST API - GetBarcodeInhibit
Description
• Returns the current barcode/currency inhibit status.

Endpoint GetBarcodeInhibit

Method GET

URL {server_url}/api/CashDevice/GetBarcodeInhibit

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: Successfully retrieved the barcode


inhibit status.
{
"deviceID": "SPECTRAL_PAYOUT-
COM5",
"barcodeInhibitStatus": "Barcode
Disabled and Currency Enabled
(Default)"
}

404 Not Found: The specified cash device was


not initialised
Cash device not found

500 Internal Server Error: Unable to retrieve


barcode inhibit status.
Failed to get barcode inhibit status.

500 Internal Server Error: An error occurred


while retrieving the status.
Error getting barcode inhibit status:
{error_message}

Document Revision - v.2 Cash Device REST API - 98


Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetBarcodeInhibit?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetBarcodeInhibit?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetBarcodeInhibit?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();

Document Revision - v.2 Cash Device REST API - 99


MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetBarcodeInhibit?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 100


REST API - SetBarcodeInhibit
Description
• Used to set up the bar code inhibit status register.

Endpoint SetBarcodeInhibit

Method POST

URL {server_url}/api/CashDevice/SetBarcodeInhibit

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • byte inhibitByte: A byte indication to enable or disable barcode/currency inhibit:


• 255 = Both Currency and Barcode Disabled
• 254 = Barcode Disabled and Currency Enabled (Default)
• 253 = Barcode Enabled and Currency Disabled
• 252 = Both Currency and Barcode Enabled

Responses
Status Body Notes

200 OK: Barcode inhibit status was successfully


updated.
SPECTRAL_PAYOUT-COM5: Barcode inhibit
set successfully.

404 Not Found: The specified cash device was


not initialised.
Cash device not found

500 Internal Server Error: Unable to update


barcode inhibit status.
Failed to set barcode inhibit.

500 Internal Server Error: An error occurred


while updating inhibit status.
Error setting barcode inhibit:
{error_message}

Document Revision - v.2 Cash Device REST API - 101


Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetBarcodeInhibit?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"252";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetBarcodeInhibit?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(252)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetBarcodeInhibit?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = json.dumps(252)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

Document Revision - v.2 Cash Device REST API - 102


print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "252");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetBarcodeInhibit?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 103


REST API - GetBarcodeData
Description
Obtains the last valid barcode ticket data.

Endpoint GetBarcodeData

Method Get

URL {server_url}/api/CashDevice/GetBarcodeData

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: Successfully retrieved the barcode data


and ticket status
{
"ticketStatus":
"ticket_status_value"
"barcodeData":
"barcode_ascii_data_value"
}

404 Not Found: The specified cash device was


not initialised
Cash device not found

500 Internal Server Error: Unable to retrieve


Barcode Data.
Failed to get Barcode Data

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,

Document Revision - v.2 Cash Device REST API - 104


};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetBarcodeData?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"";
request.AddParameter("text/plain", body, ParameterType.RequestBody);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetBarcodeData?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetBarcodeData?deviceID=SPECTRAL_PAYOUT-
COM5"

payload = ""
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetBarcodeData?deviceID=SPECTRAL_PAYOUT-
COM5")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")

Document Revision - v.2 Cash Device REST API - 105


.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 106


REST API - DispenseValue
Description
Dispenses the specified value of a specified currency.

Endpoint DispenseValue

Method POST

URL {server_url}/api/CashDevice/DispenseValue

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • The denomination and its respective country code.


• UInt32 Value: Denomination value to pay-out e.g 500, 1000 etc
• string CountryCode: The country code of the currency that is to be paid out e.g.
“GBP”, “EUR”, “USD” etc

{
"Value": 1500,
"CountryCode": "{{Currency}}"
}

Responses
Status Body Notes

200 OK: Pay-out can be completed.

Dispense operation initiated


successfully.

400 Bad Request: If there is an error during


payout operation.
Failed to initiate dispense
operation: INVALID_INPUT

errorReason
Code Error Description

1 Not enough value in device The value requested exceeds the level stored in the payout device

Document Revision - v.2 Cash Device REST API - 107


Code Error Description

2 Cannot pay exact amount The value requested cannot be paid with the levels stored in the
payout device

3 Device busy The payout device cannot execute the payout request because it is
busy with other tasks

4 Device disabled The payout device is to its disabled state and hence refuses the
payout request

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/DispenseValue?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""Value"": 1500," + "\n" +
@" ""CountryCode"": ""GBP""" + "\n" +
@"}" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/DispenseValue?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"Value": 1500,
"CountryCode": "GBP"
})

};
request(options, function (error, response) {
if (error) throw new Error(error);

Document Revision - v.2 Cash Device REST API - 108


console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/DispenseValue?deviceID=SPECTRAL_PAYOUT-
COM5"

payload = json.dumps({
"Value": 1500,
"CountryCode": "GBP"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"Value\": 1500,\r\n
\"CountryCode\": \"GBP\"\r\n}\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/DispenseValue?deviceID=SPECTRAL_PAYOUT-
COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 109


REST API - PayoutByDenomination
Description
Performs a payout transaction by the specified denomination and the number of notes to payout.

Endpoint PayoutByDenomination

Method POST

URL {server_url}/api/CashDevice/PayoutByDenomination

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body PayoutRequest: The request body containing Value, CountryCode and NumNotes.
• ValueCountryCode denomination_to_payout: representing the denomination and its
respective country code:
• UInt32 Value: Denomination value to pay-out e.g. 500, 1000 etc
• string CountryCode: The country code of the currency that is to be paid out e.g.
“GBP”, “EUR”, “USD” etc
• UInt32 numNotes: The number of notes to payout. If set to 0, all notes of the specified
denomination will be dispensed.

{
"Value": 500,
"CountryCode": "{{Currency}}",
"NumNotes": 1
}

Responses
Status Body Notes

200 Ok: If the payout by denomination was


initiated successfully.
{
"success": true,
"message": "Payout operation
status: OK"
}

400 Bad Request: If there is an error during


payout by denomination.

Document Revision - v.2 Cash Device REST API - 110


errorReason
Code Error Description

1 Not enough value in device The value requested exceeds the level stored in the payout device

2 Cannot pay exact amount The value requested cannot be paid with the levels stored in the
payout device

3 Device busy The payout device cannot execute the payout request because it is
busy with other tasks

4 Device disabled The payout device is to its disabled state and hence refuses the
payout request

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/PayoutByDenomination?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""Value"": 500," + "\n" +
@" ""CountryCode"": ""GBP""," + "\n" +
@" ""NumNotes"": 1" + "\n" +
@"}" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/PayoutByDenomination?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"Value": 500,
"CountryCode": "GBP",

Document Revision - v.2 Cash Device REST API - 111


"NumNotes": 1
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/PayoutByDenomination?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = json.dumps({
"Value": 500,
"CountryCode": "GBP",
"NumNotes": 1
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"Value\": 500,\r\n
\"CountryCode\": \"GBP\",\r\n \"NumNotes\": 1\r\n}\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/PayoutByDenomination?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 112


REST API - PayoutMultipleDenominations
Description
Perform a payout transaction for multiple denominations.

Endpoint PayoutMultipleDenominations

Method POST

URL {server_url}/api/CashDevice/PayoutMultipleDenominations

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body UInt32[] noteCounts: an array of note counts to payout, where each index corresponds to a
specific denomination. E.g. if the currency assignment array of GBP is {500, 1000, 2000, 5000},
then to payout two £5 notes, one £10 note and one £20 note, the parameter noteCounts would
be [2,1,1,0].

[2,1,1,0]

Responses
Status Body Notes

200 Ok: If the payout of multiple denominations


was initiated successfully.
Payout by denomination initiated
successfully.

400 Bad Request: If there is an error during


payout of multiple denominations.

errorReason
Code Error Description

1 Not enough value in device The value requested exceeds the level stored in the payout device

2 Cannot pay exact amount The value requested cannot be paid with the levels stored in the
payout device

3 Device busy The payout device cannot execute the payout request because it is
busy with other tasks

Document Revision - v.2 Cash Device REST API - 113


Code Error Description

4 Device disabled The payout device is to its disabled state and hence refuses the
payout request

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/PayoutMultipleDenominations?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"[2,1,1,0]";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/PayoutMultipleDenominations?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify([
2,
1,
1,
0
])

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

Document Revision - v.2 Cash Device REST API - 114


url = "http://localhost:5000/api/CashDevice/PayoutMultipleDenominations?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = json.dumps([
2,
1,
1,
0
])
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "[2,1,1,0]");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/PayoutMultipleDenominations?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 115


REST API - Float
Description
Leaves the specified number of notes in the pay-out and moves the excess to the cashbox to maintain a stored pay-
out amount for the purpose of being able to collect excess notes whilst leaving some for pay-out purposes.

Endpoint Float

Method POST

URL {server_url}/api/CashDevice/Float

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • UInt32[] noteCounts:


• An array of UInt32 of size equal to the number of channels in the dataset. Each
UInt32 is the number of notes to be left for payout, its index is the channel to
float
• E.g. For a GBP dataset containing £5, £10, £20 and £50
• If noteCounts = [2, 2, 2, 0]
• 2 x £5, 2 x £10, 2 x £20 and 0 x £50 notes would be left in the payout.

[2, 2, 2, 0]

Responses
Status Body Notes

200 OK: If the float operation was initiated


successfully.
SPECTRAL_PAYOUT-COM5: Float operation
completed successfully.

400 Bad Request: If there is an error initiating


the float operation.
Not enough value to perform float.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{

Document Revision - v.2 Cash Device REST API - 116


MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/Float?deviceID=SPECTRAL_PAYOUT-COM5",
Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @" [2, 2, 2, 0]" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/Float?deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify([
2,
2,
2,
0
])

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/Float?deviceID=SPECTRAL_PAYOUT-COM5"

payload = json.dumps([
2,
2,
2,
0
])
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

Document Revision - v.2 Cash Device REST API - 117


print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, " [2, 2, 2, 0]\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/Float?deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 118


REST API - SetCashboxPayoutLimit
Description
Sets the cashbox payout limit by specifying the maximum number of notes for each denomination.

Not available for NV4000

Endpoint SetCashboxPayoutLimit

Method POST

URL {server_url}/api/CashDevice/SetCashboxPayoutLimit

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • uint[] noteCounts: An array of note counts representing the maximum number of notes
that can be paid out for each denomination. Each index corresponds to a specific
denomination in the currency assignment array.
• E.g. For the dataset containing £5, £10, £20, £50.
• To set the payout limit to 5 for £5, 5 for £10, 5 for £20, the parameter noteCounts
would be [5,5,5,0].

[5,5,5,0]

Responses
Status Body Notes

200 OK: If the cashbox payout limit was set


successfully.
SPECTRAL_PAYOUT-COM5: Cashbox payout
limit set successfully.

400 Bad Request: If there is an error setting the


cashbox payout limit.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{

Document Revision - v.2 Cash Device REST API - 119


MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetCashboxPayoutLimit?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"[5,5,5,0]";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetCashboxPayoutLimit?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify([
5,
5,
5,
0
])

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetCashboxPayoutLimit?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = json.dumps([
5,
5,
5,
0
])
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

Document Revision - v.2 Cash Device REST API - 120


response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "[5,5,5,0]");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetCashboxPayoutLimit?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 121


REST API - SmartEmpty
Description
Initiates a smart empty operation on the specified module number of the dispenser.

Endpoint SmartEmpty

Method POST

URL {server_url}/api/CashDevice/SmartEmpty

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • byte moduleNumber: the module number to empty. If NV4000 is true and
moduleNumber is 0, all modules will be emptied.
• bool NV4000: indicating whether the operation is for NV4000 model. Default is false.

{
"ModuleNumber": 0,
"IsNV4000": false
}

Responses
Status Body Notes

200 OK: If the smart empty operation was


completed successfully.
Smart empty operation completed
successfully.

400 Bad Request: If there is an error performing


the smart empty operation.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);

Document Revision - v.2 Cash Device REST API - 122


var request = new RestRequest("/api/CashDevice/SmartEmpty?deviceID=SPECTRAL_PAYOUT-
COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""ModuleNumber"": 0," + "\n" +
@" ""IsNV4000"": false" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SmartEmpty?deviceID=SPECTRAL_PAYOUT-
COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"ModuleNumber": 0,
"IsNV4000": false
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SmartEmpty?deviceID=SPECTRAL_PAYOUT-COM5"

payload = json.dumps({
"ModuleNumber": 0,
"IsNV4000": False
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Document Revision - v.2 Cash Device REST API - 123


Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"ModuleNumber\": 0,\r\n
\"IsNV4000\": false\r\n}");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SmartEmpty?deviceID=SPECTRAL_PAYOUT-
COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 124


REST API - SendCustomCommand
Description
Sends a custom command to the device, constructed as an array of bytes

Endpoint SendCustomCommand

Method POST

URL {server_url}/api/CashDevice/SendCustomCommand

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body string CustomCommandDataString: A string containing the raw byte data to be sent to the
device.

{
"CustomCommandDataString": "01"
}

Responses
Status Body Notes

200 OK: If the custom command was sent


successfully and acknowledged by cash
Custom command sent successfully. device.

400 Bad Request: If there is an error sending the


custom command.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SendCustomCommand?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");

Document Revision - v.2 Cash Device REST API - 125


request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""CustomCommandDataString"": ""01""" + "\n" +
@"}" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SendCustomCommand?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"CustomCommandDataString": "01"
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SendCustomCommand?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = json.dumps({
"CustomCommandDataString": "01"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()

Document Revision - v.2 Cash Device REST API - 126


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n
\"CustomCommandDataString\": \"01\"\r\n}\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SendCustomCommand?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 127


REST API - EnableCoinMechOrFeeder
Description
Enables the coin mechanism or feeder for specific device models

Endpoint EnableCoinMechOrFeeder

Method POST

URL {server_url}/api/CashDevice/EnableCoinMechOrFeeder

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If successfully enabled.

Coin mechanism or feeder enabled


successfully.

400 Bad Request: If enable fails.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/EnableCoinMechOrFeeder?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Post);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 128


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/EnableCoinMechOrFeeder?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/EnableCoinMechOrFeeder?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/EnableCoinMechOrFeeder?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 129


REST API - ResetDevice
Description
Resets the device to its initial state.

Endpoint ResetDevice

Method POST

URL {server_url}/api/CashDevice/ResetDevice

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the device was reset successfully.

Device reset successfully.

400 Bad Request: If there is an error resetting


the device.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/ResetDevice?deviceID=SPECTRAL_PAYOUT-
COM5", Method.Post);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 130


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/ResetDevice?deviceID=SPECTRAL_PAYOUT-
COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/ResetDevice?deviceID=SPECTRAL_PAYOUT-
COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/ResetDevice?deviceID=SPECTRAL_PAYOUT-
COM5")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 131


REST API - HaltPayout
Description
Halts the payout operation of the device.

Endpoint HaltPayout

Method POST

URL {server_url}/api/CashDevice/HaltPayout

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the device was halted successfully.

Payout halted successfully.

400 Bad Request: If there is an error halting the


payout.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/HaltPayout?deviceID=SPECTRAL_PAYOUT-
COM5", Method.Post);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 132


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/HaltPayout?deviceID=SPECTRAL_PAYOUT-
COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/HaltPayout?deviceID=SPECTRAL_PAYOUT-COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/HaltPayout?deviceID=SPECTRAL_PAYOUT-
COM5")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 133


REST API - GetRCMode
Description
Retrieve the current mode of replenishment cassette.
• Replenishment Mode
• Payout Mode

Can only be used with the NV4000 with RC device model.

Endpoint GetRCMode

Method Get

URL {server_url}/api/CashDevice/GetRCMode

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: Successfully retrieved the RC mode

RC_MODE_PAYOUT

404 Not Found: The specified cash device was


not initialised
Cash device not found

500 Internal Server Error: Unable to retrieve RC


Mode.
Failed to get RC Mode.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,

Document Revision - v.2 Cash Device REST API - 134


};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetRCMode?deviceID=SPECTRAL_PAYOUT-
COM5", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetRCMode?deviceID=SPECTRAL_PAYOUT-
COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetRCMode?deviceID=SPECTRAL_PAYOUT-COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetRCMode?deviceID=SPECTRAL_PAYOUT-
COM5")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 135


REST API - Replenish
Description
Replenishes the specified number of notes from the replenishment cassette to the recyclers.

Can only be used with the NV4000 with RC device model.

Endpoint Replenish

Method POST

URL {server_url}/api/CashDevice/Replenish

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • uint NumberToReplenish: The number of notes to replenish from the RC to the pay-out
modules e.g. to replenish 5 notes to recyclers, set NumberToReplenish to 5.

Responses
Status Body Notes

200 OK: Notes replenished successfully.

Replenishment completed successfully.

400 Bad Request: If there is an error during


replenishment.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/Replenish?deviceID=NV4000-COM5",
Method.Post);

Document Revision - v.2 Cash Device REST API - 136


request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"4";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/Replenish?deviceID=NV4000-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(4)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/Replenish?deviceID=NV4000-COM5"

payload = json.dumps(4)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "4");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/Replenish?deviceID=NV4000-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")

Document Revision - v.2 Cash Device REST API - 137


.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 138


REST API - RefillMode
Description
Enables or disables the refill mode of the device

Endpoint RefillMode

Method POST

URL {server_url}/api/CashDevice/RefillMode

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • True to enable, or false to disable.

Responses
Status Body Notes

200 OK: If the refill mode was set successfully.

NV4000-COM5: Refill mode disabled


successfully.

400 Bad Request: If there is an error setting the


refill mode.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/RefillMode?deviceID=NV4000-COM5",
Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"false";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 139


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/RefillMode?deviceID=NV4000-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(false)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/RefillMode?deviceID=NV4000-COM5"

payload = json.dumps(False)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "false");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/RefillMode?deviceID=NV4000-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 140


REST API - KeyExchangeLimit32bit
Description
Performs a key exchange with a 32-bit limit and enables encryption if successful

Endpoint KeyExchangeLimit32bit

Method POST

URL {server_url}/api/CashDevice/KeyExchangeLimit32bit

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the key exchange limit was set


successfully.
Key exchange limit set to 32-bit
successfully.

400 Bad Request: If there is an error sending the


request.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/KeyExchangeLimit32bit?deviceID=NV4000-
COM5", Method.Post);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 141


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/KeyExchangeLimit32bit?deviceID=NV4000-
COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/KeyExchangeLimit32bit?deviceID=NV4000-
COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/KeyExchangeLimit32bit?deviceID=NV4000-
COM5")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 142


REST API - GetHopperOptions
Description
Retrieves the current hopper options from the device and updates internal registers with this information.

Endpoint GetHopperOptions

Method GET

URL {server_url}/api/CashDevice/GetHopperOptions

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Reg_0 bits and their meaning

Bit Parameter Function

0 Pay Mode 0x00 = Split by highest value (Default). The device will attempt to payout a
requested value by starting from the highest to the lowest coins available. This mode
will payout the minimum number of coins possible.
0x01 = Free pay. The device will payout a coin as it passes its discriminator system if
it fits into the current payout value and will leave enough of other coins to payout
the rest of the value. This may give a faster payout but could result in a large number
of coins of small denominations paid out.

1 Level Check 0x00 = Disabled. The device will not refer to the level counters when calculating if a
payout value can be made.
0x01 = Enabled (Default). The device will check the level counters and accept or
refuse a payout request based on levels and/or split of available levels.

2 Motor Speed 0x00 = Low speed. Payouts run at a lower motor speed.
0x01 = High Speed (default always after reset). The motors run at max speed for
payouts.

Document Revision - v.2 Cash Device REST API - 143


Reg_0 bits and their meaning

3 Cashbox Pay This bit is used in conjunction with Bit 0. If bit 3 is zero, then the Pay modes will be as
Active described in bit 0. If Bit 3 is set then coins routed to the cashbox will be used in coins
paid out of the front if they can fit into the current payout request. This is shown
below.
Pay Mode Type Bit 0 Bit 3
Free Play 1 0
Highest Split 0 1
All Route Free Pay 1 1
All Route Highest Split 0 1

4 Route 0 level Set to 0x01 means that any coins detected with a level setting of 0 will be paid to the
coins to cashbox cashbox, even if it is routed to the payout.

5 High Efficiency Default set to 0x01 to enable a more efficient, smarter coin payout algorithm which
Split will tend to use coins which have higher level counts - thus speeding up the payout
process.

6 Unknown to Set to 0x01 means any unknown coins will be paid out during Smart Empty
Payout (otherwise they will be routed to cashbox).

7 Value Added 0x00 = Coin added event


0x01 = Value added event

Reg_1 bits and their meaning

Bit Parameter Function

0 Reject Events Set to 1 gives reject event 0xBA Coin Rejected.

1 Reject Events Set to 1 gives reject event 0xBA with coin value if known.
Full

2 Empty Route Set to 1 will route coins to payout when a Empty or Smart Empty command is
received.

3 Full to Cashbox Set to 1 will start moving coins to cashbox during payouts when full.

4 Value Coin Set to 1 gives individual coin payout events.

5 N/A Set to 0.

6 N/A Set to 0.

7 N/A Set to 0.

Document Revision - v.2 Cash Device REST API - 144


Example Response
Status Body Notes

200 OK: If the hopper options were retrieved


successfully.
SMART_COIN_SYSTEM-COM10: { Reg0 = 04,
Reg1 = 00 }

400 Bad Request: If there is an error retrieving


the hopper options.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetHopperOptions?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhbimport requests

url = "http://localhost:5000/api/CashDevice/GetHopperOptions?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = {}
headers = {
'Authorization': 'Bearer
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImFkbWluIiwibmJmIjoxNzM4MDU1
NjEzLCJleHAiOjE3Mzg2NjA0MTMsImlhdCI6MTczODA1NTYxMywiaXNzIjoiSU5OT1ZBVElWRVRFQ0hOT0xPR
1kiLCJhdWQiOiJJTk5PVkFUSVZFVEVDSE5PTE9HWSJ9.zi55PwWV2dwGkzqXEI7Jk4R3SQnXbphnZyyif72QC
Ws'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetHopperOptions?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Authorization': 'Bearer eyJhb.....'

Document Revision - v.2 Cash Device REST API - 145


}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetHopperOptions?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetHopperOptions?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 146


REST API - SetHopperOptions
Description
Sets the hopper options on the device using the provided register values.

Endpoint SetHopperOptions

Method POST

URL {server_url}/api/CashDevice/SetHopperOptions

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body HopperOptionsRequest: The request body containing the hopper options Reg0 and Reg1.
• byte reg_0: The value to set for the first hopper register.
• byte reg_1: The value to set for the second hopper register.

Reg_0 bits and their meaning

Bit Parameter Function

0 Pay Mode 0x00 = Split by highest value (Default). The device will attempt to payout a
requested value by starting from the highest to the lowest coins available. This mode
will payout the minimum number of coins possible.
0x01 = Free pay. The device will payout a coin as it passes its discriminator system if
it fits into the current payout value and will leave enough of other coins to payout
the rest of the value. This may give a faster payout but could result in a large number
of coins of small denominations paid out.

1 Level Check 0x00 = Disabled. The device will not refer to the level counters when calculating if a
payout value can be made.
0x01 = Enabled (Default). The device will check the level counters and accept or
refuse a payout request based on levels and/or split of available levels.

2 Motor Speed 0x00 = Low speed. Payouts run at a lower motor speed.
0x01 = High Speed (default). The motors run at max speed for payouts.

Document Revision - v.2 Cash Device REST API - 147


Reg_0 bits and their meaning

3 Cashbox Pay This bit is used in conjunction with Bit 0. If bit 3 is zero, then the Pay modes will be as
Active described in bit 0. If Bit 3 is set then coins routed to the cashbox will be used in coins
paid out of the front if they can fit into the current payout request. This is shown
below.
Pay Mode Type Bit 0 Bit 3
Free Play 1 0
Highest Split 0 1
All Route Free Pay 1 1
All Route Highest Split 0 1

4 Route 0 level Set to 0x01 means that any coins detected with a level setting of 0 will be paid to the
coins to cashbox cashbox, even if it is routed to the payout.

5 High Efficiency Default set to 0x01 to enable a more efficient, smarter coin payout algorithm which
Split will tend to use coins which have higher level counts - thus speeding up the payout
process.

6 Unknown to Set to 0x01 means any unknown coins will be paid out during Smart Empty
Payout (otherwise they will be routed to cashbox).

7 Value Added 0x00 = Coin added event


0x01 = Value added event

Reg_1 bits and their meaning

Bit Parameter Function

0 Reject Events Set to 1 gives reject event 0xBA Coin Rejected.

1 Reject Events Set to 1 gives reject event 0xBA with coin value if known.
Full

2 Empty Route Set to 1 will route coins to payout when a Empty or Smart Empty command is
received.

3 Full to Cashbox Set to 1 will start moving coins to cashbox during payouts when full.

4 Value Coin Set to 1 gives individual coin payout events.

5 N/A Set to 0.

6 N/A Set to 0.

7 N/A Set to 0.

Document Revision - v.2 Cash Device REST API - 148


Responses
Status Body Notes

200 OK: If the hopper options were set


successfully.
Hopper options set successfully.

400 Bad Request: If there is an error setting the


hopper options.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetHopperOptions?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""Reg0"": 4," + "\n" +
@" ""Reg1"": 0" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetHopperOptions?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"Reg0": 4,
"Reg1": 0
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);

Document Revision - v.2 Cash Device REST API - 149


});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetHopperOptions?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = json.dumps({
"Reg0": 4,
"Reg1": 0
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"Reg0\": 4,\r\n \"Reg1\":
0\r\n}");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetHopperOptions?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 150


REST API - GetGlobalErrorCode
Description
Sets the globalErrorCode_0 and globalErrorCode_1 to the error code in the cash device

Endpoint GetGlobalErrorCode

Method GET

URL {server_url}/api/CashDevice/GetGlobalErrorCode

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Please refer to Global Error State for detailed information on responses.

Status Body Notes

200 OK: If the global error code was retrieved


successfully.
SMART_COIN_SYSTEM-COM10: { ErrorCode0
= 00, ErrorCode1 = 00 }

400 Bad Request: If there is an error retrieving


the global error code.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetGlobalErrorCode?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 151


NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetGlobalErrorCode?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetGlobalErrorCode?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetGlobalErrorCode?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 152


REST API - GetServiceInformation
Description
• Retrieves service information from the device based on the provided sub-command and formats the
information into a readable string.
• The extracted information is formatted into a readable string and stored in the variable
service_information_string

Endpoint GetServiceInformation

Method GET

URL {server_url}/api/CashDevice/GetServiceInformation

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • byte subCommand: The sub-command to specify the type of service information to
retrieve. Possible values:
• Byte: 0x00 - Service Type: Date Information - Description: Returns the current
raw byte date
• Byte: 0x01 - Service Type: Note Information - Description: Extracts the number of
notes since various events such as maintenance reset, last download, power on,
and last jam.
• Byte: 0x02 - Service Type: Accept Note Information - Description: Extracts the
number of accepted notes since maintenance reset, last download, and power
on.
• Byte: 0x03 - Service Type: Jam Information - Description: Extracts the number of
jams since maintenance reset, last download, and in the last 1000 notes.
• Byte: 0x04 - Service Type: Service Flags - Description: Returns current service flag
status

Responses
Status Body Notes

200 OK: If the service information is retrieved


and formatted.
NV4000-COM5: { ServiceInformation =
(Note Information)
Notes Since Maintenance Reset: 11902
Notes Since Last Download: 461
Notes Since Power On: 2
Notes Since Last Jam: 2
}

400 Bad Request: If fails to retrieve the service


information.

Document Revision - v.2 Cash Device REST API - 153


Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetServiceInformation?deviceID=NV4000-
COM5", Method.Get);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"1" + "\n" +
@"" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetServiceInformation?deviceID=NV4000-
COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(1)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/GetServiceInformation?deviceID=NV4000-
COM5"

payload = json.dumps(1)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

Document Revision - v.2 Cash Device REST API - 154


response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "1\r\n\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetServiceInformation?deviceID=NV4000-
COM5")
.method("GET", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 155


REST API - GetServiceInformationForModule
Description
• Retrieves service information from the device based on the provided module and sub-command, and
formats the information into a readable string.
• The extracted information is formatted into a readable string and stored in the variable
service_information_string

Endpoint GetServiceInformationForModule

Method GET

URL {server_url}/api/CashDevice/GetServiceInformationForModule

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • byte module: The module identifier specifying the type of module to retrieve
information from.
• 0x05: NV4000 Lifetime Counts.
• 0x00, 0x01, 0x02, 0x03: Smart Coin System modules including Primary Hopper,
Feeder, Secondary Hopper, and Lifter.
• byte subCommand: The sub-command to specify the type of service information to
retrieve. Possible values:
• Byte: 0x00 - Service Type: Service Status - Description: Returns the service status
of the device
• Byte: 0x01 - Service Type: Next Service Due - Description: Returns the next
service due. Should be sent for each module
• Byte: 0x02 - Service Type: Last Service Information - Description: Returns the last
3 services, 3 bytes per service, 9 bytes in total
• Byte: 0x03 - Service Type: Performance Since Last Service - Description: Extracts
the number of coins processed, acceptance percentage, jams, and calibration
failures since the last service
• Byte: 0x04 - Service Type: Service Flags - Description: Returns current service
flags
• Byte: 0x05 - Service Type: Lifetime Counts - Description: Get the lifetime counts
of the module

{
"Module": 5,
"SubCommand": 0
}

Document Revision - v.2 Cash Device REST API - 156


Responses
Status Body Notes

200 OK: If the service information is retrieved


and formatted.
NV4000-COM5: { ServiceInformation =
(Lifetime Counts)
Total cycles: 32717
Power on count: 157
Power on time: 20580
}

400 Bad Request: If fails to retrieve the service


information.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetServiceInformationForModule?
deviceID=NV4000-COM5", Method.Get);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""Module"": 5," + "\n" +
@" ""SubCommand"": 0" + "\n" +
@"}" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetServiceInformationForModule?
deviceID=NV4000-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"Module": 5,
"SubCommand": 0

Document Revision - v.2 Cash Device REST API - 157


})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/GetServiceInformationForModule?
deviceID=NV4000-COM5"

payload = json.dumps({
"Module": 5,
"SubCommand": 0
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"Module\": 5,\r\n
\"SubCommand\": 0\r\n}\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetServiceInformationForModule?
deviceID=NV4000-COM5")
.method("GET", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 158


REST API - SetServiceInformationMaintenanceReset
Description
Sets the maintenance reset information for the device using the provided ASCII bytes representing the week and
year of the maintenance reset.

Endpoint SetServiceInformationMaintenanceReset

Method POST

URL {server_url}/api/CashDevice/SetServiceInformationMaintenanceReset

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • ServiceInformationMaintenanceResetRequest: The request body containing


WeekNumber1AsciiByte, WeekNumber2AsciiByte, YearNumber1AsciiByte and
YearNumber2AsciiByte.
• byte weekNumber1_ascii_byte: The module identifier specifying the type of
module to set the service information for.
• byte weekNumber2_ascii_byte: The type of service being set.
• byte yearNumber1_ascii_byte: The month of the service date.
• byte yearNumber2_ascii_byte: The year of the service date.

{
"WeekNumber1AsciiByte": 0,
"WeekNumber2AsciiByte": 0,
"YearNumber1AsciiByte": 0,
"YearNumber2AsciiByte": 0
}

Responses
Status Body Notes

200 OK: If the maintenance reset information


was set successfully.
NV4000-COM5: Maintenance reset
information set successfully.

400 Bad Request: If there is an error setting the


maintenance reset information.

Document Revision - v.2 Cash Device REST API - 159


Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetServiceInformationMaintenanceReset?
deviceID=NV4000-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""WeekNumber1AsciiByte"": 0," + "\n" +
@" ""WeekNumber2AsciiByte"": 0," + "\n" +
@" ""YearNumber1AsciiByte"": 0," + "\n" +
@" ""YearNumber2AsciiByte"": 0" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetServiceInformationMaintenanceReset?
deviceID=NV4000-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"WeekNumber1AsciiByte": 0,
"WeekNumber2AsciiByte": 0,
"YearNumber1AsciiByte": 0,
"YearNumber2AsciiByte": 0
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

Document Revision - v.2 Cash Device REST API - 160


url = "http://localhost:5000/api/CashDevice/SetServiceInformationMaintenanceReset?
deviceID=NV4000-COM5"

payload = json.dumps({
"WeekNumber1AsciiByte": 0,
"WeekNumber2AsciiByte": 0,
"YearNumber1AsciiByte": 0,
"YearNumber2AsciiByte": 0
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"WeekNumber1AsciiByte\":
0,\r\n \"WeekNumber2AsciiByte\": 0,\r\n \"YearNumber1AsciiByte\": 0,\r\n
\"YearNumber2AsciiByte\": 0\r\n}");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetServiceInformationMaintenanceReset?
deviceID=NV4000-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 161


REST API - SetNoPayinCount
Description
Sets the no-payin count for the device, which specifies the number of transactions allowed without pay-ins.

Endpoint SetNoPayinCount

Method POST

URL {server_url}/api/CashDevice/SetNoPayinCount

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • byte count: The number of transactions allowed without pay-ins.

Responses
Status Body Notes

200 OK: If the no-payin count was set


successfully.
SMART_COIN_SYSTEM-COM10:
{ NoPayinCount = 0 }

400 Bad Request: If there is an error setting the


no-payin count.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetNoPayinCount?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"0";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 162


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetNoPayinCount?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(0)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetNoPayinCount?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = json.dumps(0)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "0");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetNoPayinCount?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 163


REST API - Purge
Description
Attempts to clear a coin that is stuck in a place that causes a calibration fault at start-up, typically behind the
payout flap on the hopper

Endpoint Purge

Method POST

URL {server_url}/api/CashDevice/Purge

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the purge operation was executed


successfully.
SMART_COIN_SYSTEM-COM10: Purge
executed successfully.

400 Bad Request: If there is an error executing


the purge operation.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/Purge?deviceID=SMART_COIN_SYSTEM-
COM10", Method.Post);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 164


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/Purge?deviceID=SMART_COIN_SYSTEM-
COM10',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/Purge?deviceID=SMART_COIN_SYSTEM-COM10"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/Purge?deviceID=SMART_COIN_SYSTEM-COM10")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 165


REST API - PurgeDevice
Description
Attempts to clear a coin that is stuck in a place that causes a calibration fault at startup, typically behind the payout
flap on the hopper. Send a byte to specify a device.

Endpoint PurgeDevice

Method POST

URL {server_url}/api/CashDevice/PurgeDevice

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • byte device: The byte representing the specific device component to purge.
• 0x00 for Hopper
• 0x01 for Feeder

Responses
Status Body Notes

200 OK: If the purge operation was executed


successfully.
SMART_COIN_SYSTEM-COM10: Purge
executed successfully on specified
device.

400 Bad Request: If there is an error executing


the purge operation.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/PurgeDevice?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");

Document Revision - v.2 Cash Device REST API - 166


var body = @"1";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/PurgeDevice?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(1)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/PurgeDevice?deviceID=SMART_COIN_SYSTEM-
COM10"

payload = json.dumps(1)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "1");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/PurgeDevice?deviceID=SMART_COIN_SYSTEM-
COM10")
.method("POST", body)
.addHeader("Content-Type", "application/json")

Document Revision - v.2 Cash Device REST API - 167


.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 168


REST API - PurgeDeviceHopper
Description
Attempts to clear a coin that is stuck in a place that causes a calibration fault at startup, typically behind the payout
flap on the hopper. Can be used for the Twin SMART Coin System.

Endpoint PurgeDevice

Method POST

URL {server_url}/api/CashDevice/PurgeDeviceHopper

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • PurgeDeviceHopperRequest: The request body containing Device and Hopper.


• byte device: The byte representing the specific device component to purge.
• 0x00 for Hopper
• 0x01 for Feeder
• byte hopper: The byte representing whether the purge is for the primary hopper
(0x00) or secondary hopper (0x01).

Responses
Status Body Notes

200 OK: If the purge operation was executed


successfully.
SMART_COIN_SYSTEM-COM10: Purge
executed successfully on specified
device and hopper.

400 Bad Request: If there is an error executing


the purge operation.

Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);

Document Revision - v.2 Cash Device REST API - 169


var request = new RestRequest("/api/CashDevice/PurgeDeviceHopper?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""Device"": 0," + "\n" +
@" ""Hopper"": 0" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/PurgeDeviceHopper?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"Device": 0,
"Hopper": 0
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/PurgeDeviceHopper?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = json.dumps({
"Device": 0,
"Hopper": 0
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Document Revision - v.2 Cash Device REST API - 170


Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"Device\": 0,\r\n
\"Hopper\": 0\r\n}");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/PurgeDeviceHopper?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 171


REST API - CoinStir
Description
Initiates a coin stirring operation for the specified duration in seconds

Endpoint CoinStir

Method POST

URL {server_url}/api/CashDevice/CoinStir

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • byte seconds: The duration for which to stir the coins, specified in seconds (1-255)

Responses
Status Body Notes

200 OK: If the coin stir operation is successfully


initiated.
SMART_COIN_SYSTEM-COM10: Coin stir
executed successfully.

400 Bad Request: If failed to execute coin stir


operation.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/CoinStir?deviceID=SMART_COIN_SYSTEM-
COM10", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"5" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);

Document Revision - v.2 Cash Device REST API - 172


Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/CoinStir?deviceID=SMART_COIN_SYSTEM-
COM10',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(5)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/CoinStir?deviceID=SMART_COIN_SYSTEM-
COM10"

payload = json.dumps(5)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "5\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/CoinStir?deviceID=SMART_COIN_SYSTEM-
COM10")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 173


REST API - CoinStirWithMode
Description
Initiates a coin stirring operation for the specified duration in seconds, with an additional mode parameter.

Endpoint CoinStirWithMode

Method POST

URL {server_url}/api/CashDevice/CoinStirWithMode

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • CoinStirWithModeRequest: The request body containing Seconds and ModeByte.


• byte Seconds: The duration for which to stir the coins, specified in seconds
(1-255)
• byte ModeByte: An optional mode byte to specify additional behaviour e.g. move
coins to cashbox if set

{
"Seconds": 5,
"ModeByte": 1
}

Modes
Mode Description

0 Mixes the coins by performing a rotation of the coin hopper motor for a specified time.

1 Any denominations set to cashbox will also move coins to cashbox or if the level is greater than
the auto float setting then coins will also be sent to cashbox.

Responses
Status Body Notes

200 OK: If the coin stir operation is successfully


initiated.
SMART_COIN_SYSTEM-COM10: Coin stir
with mode executed successfully.

400 Bad Request: If failed to execute coin stir


with specified mode.

Document Revision - v.2 Cash Device REST API - 174


Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/CoinStirWithMode?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""Seconds"": 5," + "\n" +
@" ""ModeByte"": 1" + "\n" +
@"}" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/CoinStirWithMode?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"Seconds": 5,
"ModeByte": 1
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/CoinStirWithMode?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = json.dumps({

Document Revision - v.2 Cash Device REST API - 175


"Seconds": 5,
"ModeByte": 1
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"Seconds\": 5,\r\n
\"ModeByte\": 1\r\n}\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/CoinStirWithMode?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 176


REST API - GetCoinAcceptance
Description
Retrieves the coin acceptance status from the specified device and formats the data into a readable string

Endpoint GetCoinAcceptance

Method GET

URL {server_url}/api/CashDevice/GetCoinAcceptance

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • byte device: The byte representing the specific device component from which to
retrieve the coin acceptance status

Device
Byte Function Size

0 Primary Hopper acceptance percentage 1

1 Feeder acceptance percentage 1

2 Secondary Hopper acceptance percentage

Responses
Status Body Notes

200 OK: If the coin acceptance data was


retrieved successfully.
SMART_COIN_SYSTEM-COM10:
{ CoinAcceptanceData = 64 }

400 Bad Request: If there is an error retrieving


the coin acceptance data.
Failed to retrieve coin acceptance
data.

Document Revision - v.2 Cash Device REST API - 177


Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetCoinAcceptance?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Get);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @" 0";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetCoinAcceptance?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(0)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/GetCoinAcceptance?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = json.dumps(0)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

Document Revision - v.2 Cash Device REST API - 178


print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, " 0");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetCoinAcceptance?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("GET", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 179


REST API - GetCoinsExit
Description
Retrieves the number of coins in the payout request and the number of coins seen at the exit sensor, to validate no
over-payment of coins.

Endpoint GetCoinsExit

Method GET

URL {server_url}/api/CashDevice/GetCoinsExit

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the coins exit information was


retrieved successfully.
SMART_COIN_SYSTEM-COM10:
{ CoinsPayoutRequest = 0,
CoinsSeenAtExitSensor = 0 }

400 Bad Request: If there is an error retrieving


the coins exit information.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetCoinsExit?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 180


NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetCoinsExit?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetCoinsExit?deviceID=SMART_COIN_SYSTEM-
COM10"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetCoinsExit?deviceID=SMART_COIN_SYSTEM-
COM10")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 181


REST API - SetRealTimeClock
Description
Sets the real-time clock on the device using the provided date and time bytes

Endpoint SetRealTimeClock

Method POST

URL {server_url}/api/CashDevice/SetRealTimeClock

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body SetRealTimeClockRequest: The request body containing Byte1, Byte2, Byte3, Byte4, Byte5 and
Byte6.
• byte byte1: Day of the month (1-31)
• byte byte2: Month of the year (1-12)
• byte byte3: Year (0-99)
• byte byte4: Hour of the day (0-23)
• byte byte5: Minute of the hour (0-59)
• byte byte6: Second of the minute (0-59)
Example Below: RealTimeClock = 27 November 2024 14:09:30

{
"Byte1": 27,
"Byte2": 11,
"Byte3": 24,
"Byte4": 14,
"Byte5": 9,
"Byte6": 30
}

Responses
Status Body Notes

200 OK: If the real-time clock was set


successfully.
NV4000-COM5: { RealTimeClock = 27
November 2024 14:09:30 }

400 Bad Request: If there is an error setting the


real-time clock.

Document Revision - v.2 Cash Device REST API - 182


Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetRealTimeClock?deviceID=NV4000-COM5",
Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""Byte1"": 27," + "\n" +
@" ""Byte2"": 11," + "\n" +
@" ""Byte3"": 24," + "\n" +
@" ""Byte4"": 14," + "\n" +
@" ""Byte5"": 9," + "\n" +
@" ""Byte6"": 30" + "\n" +
@"}" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetRealTimeClock?deviceID=NV4000-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"Byte1": 27,
"Byte2": 11,
"Byte3": 24,
"Byte4": 14,
"Byte5": 9,
"Byte6": 30
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Document Revision - v.2 Cash Device REST API - 183


Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetRealTimeClock?deviceID=NV4000-COM5"

payload = json.dumps({
"Byte1": 27,
"Byte2": 11,
"Byte3": 24,
"Byte4": 14,
"Byte5": 9,
"Byte6": 30
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"Byte1\": 27,\r\n
\"Byte2\": 11,\r\n \"Byte3\": 24,\r\n \"Byte4\": 14,\r\n \"Byte5\": 9,\r\n
\"Byte6\": 30\r\n}\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetRealTimeClock?deviceID=NV4000-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 184


REST API - GetRealTimeClock
Description
Retrieves the real-time clock from the SSP device and formats it into a human-readable string

Endpoint GetRealTimeClock

Method GET

URL {server_url}/api/CashDevice/GetRealTimeClock

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the real-time clock was retrieved


successfully.
NV4000-COM5: { RealTimeClock = 27
November 2024 14:09:30 }

400 Bad Request: If there is an error getting the


real-time clock.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetRealTimeClock?deviceID=NV4000-COM5",
Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 185


NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetRealTimeClock?deviceID=NV4000-COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetRealTimeClock?deviceID=NV4000-COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetRealTimeClock?deviceID=NV4000-COM5")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 186


REST API - SetCashboxLevels
Description
Sets the coin levels of the cashbox

Endpoint SetCashboxLevels

Method POST

URL {server_url}/api/CashDevice/SetCashboxLevels

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body SetCashboxLevelsRequest: The request body containing NumCoinsToAdd, Denomination and


CountryCode.
• ushort NumCoinsToAdd: Number of coins to add to level (0 will clear the level)
• uint Denomination: Value of denomination to set
• string CountryCode: ASCII country code of denomination

{
"NumCoinsToAdd": 10,
"Denomination": 10,
"CountryCode": "{{Currency}}"
}

Responses
Status Body Notes

200 OK: If the cashbox levels were set


successfully.
SMART_COIN_SYSTEM-COM10: Cashbox
levels set successfully.

400 Bad Request: If there is an error setting the


cashbox levels.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{

Document Revision - v.2 Cash Device REST API - 187


MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetCashboxLevels?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""numCoinsToAdd"": 10," + "\n" +
@" ""denomination"": 10," + "\n" +
@" ""countryCode"": ""ITL""" + "\n" +
@"}" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetCashboxLevels?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"numCoinsToAdd": 10,
"denomination": 10,
"countryCode": "ITL"
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetCashboxLevels?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = json.dumps({
"numCoinsToAdd": 10,
"denomination": 10,
"countryCode": "ITL"
})
headers = {
'Content-Type': 'application/json',

Document Revision - v.2 Cash Device REST API - 188


'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"numCoinsToAdd\": 10,\r\n
\"denomination\": 10,\r\n \"countryCode\": \"ITL\"\r\n}\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetCashboxLevels?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 189


REST API - ClearCashboxLevels
Description
Clears the cashbox levels on the SSP device.

Endpoint ClearCashboxLevels

Method POST

URL {server_url}/api/CashDevice/ClearCashboxLevels

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the cashbox levels were cleared


successfully.
SMART_COIN_SYSTEM-COM10: Cashbox
levels cleared successfully.

400 Bad Request: If there is an error clearing the


cashbox levels.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/ClearCashboxLevels?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Post);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 190


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/ClearCashboxLevels?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/ClearCashboxLevels?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/ClearCashboxLevels?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("POST", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 191


REST API - GetCashboxLevels
Description
• Retrieves the coins that have been flushed down to the cashbox.
• Reports in the same format as GetAllLevels()

Endpoint GetCashboxLevels

Method GET

URL {server_url}/api/CashDevice/GetCashboxLevels

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the cashbox levels were retrieved


successfully.
SMART_COIN_SYSTEM-COM10:
{ CashboxLevels = Number of
denominations in device: 2
10 x 10 ITL
0 x 50 ITL
Quantity of unknown coins: 0
}

400 Bad Request: If there is an error retrieving


the cashbox levels.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetCashboxLevels?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Get);

Document Revision - v.2 Cash Device REST API - 192


request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetCashboxLevels?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetCashboxLevels?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetCashboxLevels?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 193


REST API - SetSorterRoute
Description
Sets the route for the specified denomination to go to either PRIMARY or SECONDARY hopper of the Twin SMART
Coin System

Endpoint SetSorterRoute

Method POST

URL {server_url}/api/CashDevice/SetSorterRoute

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body SetSorterRouteRequest: The request body containing ValueCountryCode and SorterRoute.


• ValueCountryCode valueCountryCode: is an object representing the denomination and
its respective country code:
• UInt32 Value: Denomination value e.g 500, 1000 etc
• string CountryCode: The country code of the currency e.g. “GBP”, “EUR”, “USD”
etc
• byte sorterRoute: The sorter route to set for the specified denomination. Use 0x00 for
PRIMARY hopper and 0x01 for SECONDARY hopper.

{
"Value": 100, "CountryCode": "{{Currency}}",
"SorterRoute": 0
}

Responses
Status Body Notes

200 OK: If the sorter route was set successfully.

TWIN_SMART_COIN_SYSTEM-COM10: Sorter
route set successfully.

400 Bad Request: If there is an error setting the


sorter route.

Document Revision - v.2 Cash Device REST API - 194


Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetSorterRoute?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""Value"": 100, ""CountryCode"": ""ITL""," + "\n" +
@" ""SorterRoute"": 0" + "\n" +
@"}" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetSorterRoute?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({
"Value": 100,
"CountryCode": "ITL",
"SorterRoute": 0
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetSorterRoute?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10"

Document Revision - v.2 Cash Device REST API - 195


payload = json.dumps({
"Value": 100,
"CountryCode": "ITL",
"SorterRoute": 0
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"Value\": 100,
\"CountryCode\": \"ITL\",\r\n \"SorterRoute\": 0\r\n}\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetSorterRoute?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 196


REST API - GetSorterRouteAssignment
Description
Retrieves sorter route assignments.

Endpoint GetSorterRouteAssignment

Method GET

URL {server_url}/api/CashDevice/GetSorterRouteAssignment

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 Ok: If the sorter route assignments were


retrieved successfully.
[
{
"currentSorterRoute":0
},
{
"currentSorterRoute":1
},
{
"currentSorterRoute":0
}
]

404 Not Found: If no sorter route assignments


were found.

400 Bad Request: If there is an error retrieving


the sorter route assignments.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")

Document Revision - v.2 Cash Device REST API - 197


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetSorterRouteAssignment?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetSorterRouteAssignment?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetSorterRouteAssignment?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetSorterRouteAssignment?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")

Document Revision - v.2 Cash Device REST API - 198


.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 199


REST API - SetPayoutLimit
Description
• Limits the number of coins that can be dispensed in one transaction
• Should be sent during the setup of the device

Endpoint SetPayoutLimit

Method POST

URL {server_url}/api/CashDevice/SetPayoutLimit

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body ushort value: The maximum number of coins that can be dispensed in one transaction

Responses
Status Body Notes

200 OK: If the payout limit was set successfully.

TWIN_SMART_COIN_SYSTEM-COM10: Payout
limit set successfully.

400 Bad Request: If there is an error setting the


payout limit.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetPayoutLimit?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"5";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);

Document Revision - v.2 Cash Device REST API - 200


Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetPayoutLimit?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(5)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetPayoutLimit?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10"

payload = json.dumps(5)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "5");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetPayoutLimit?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 201


REST API - GetPayoutCount
Description
Gets the number of coins the hopper wants to pay out after it calculates the coin split on a test payout.

Endpoint GetPayoutCount

Method GET

URL {server_url}/api/CashDevice/GetPayoutCount

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the payout count was retrieved


successfully.
TWIN_SMART_COIN_SYSTEM-COM10:
{ PayoutCount = 0 }

400 Bad Request: If there is an error retrieving


the payout count.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetPayoutCount?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 202


NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetPayoutCount?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetPayoutCount?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetPayoutCount?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 203


REST API - SetTwInMode
Description
A command to select the operation mode of the Twin SCS

Endpoint SetTwInMode

Method POST

URL {server_url}/api/CashDevice/SetTwInMode

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body • byte twinMode: The operation mode. Currently there are 4 modes available:
• 0: Normal Smart Coin System: The master SCS works alone as a normal SCS.
There is no need to connect the secondary hopper as it is unused in this mode.
• 1: Twin Smart Coin System: The unit works as a complete Twin Smart Coin
System. The secondary hopper needs to be connected to the main hopper.
• 2: Twin Single Smart Coin System: The Twin Feeder is able to pay in coins to both
routes (main hopper or lateral) based on host selection, but there is no control
over the secondary hopper. That means in this mode only the main hopper is in
control for the payouts. The slave hopper, if connected, should be controlled by
the host individually. For this mode the following commands/events can be used
by the host
• Get coin amount to lateral route: To account for the coins sent to the
lateral path.
• Set coin amount to lateral route: To set/reset the coins amount to the
lateral path.
• When working with individual coin events during pay-in (event coin credit
0x0D in CC2), every coin paid-in reports the value and the country code as
usual, but also an extra byte with the route (main hopper or lateral). In
this way the coins sent to lateral can be accounted in this Single Twin
mode during a pay-in.
• 3: Twin 1ec Balanced mode: This mode is the same as the Twin mode 0x01, but it
handles the EUR 1ec in a way that the quantities are balanced in both hoppers.
This mode improves the quantity of 1ec coins that the system can handle in the
hoppers. Please note:
• During payins, the 1ec coins will be routed to the hopper with less
quantity of coins.
• During payouts, the 1ec coins will be taken from the hopper with more
1ec coins (or from both if necessary).
• If the set coin amount command is sent, the levels will be updated in the
slave hopper only (as for operation it might be easer to manipulate the
levels). If a level 0 is sent both hoppers levels will be cleared of 1ec.

Document Revision - v.2 Cash Device REST API - 204


Responses
Status Body Notes

200 OK: If the twin mode was set successfully.

TWIN_SMART_COIN_SYSTEM-COM10: Twin
mode set successfully.

400 Bad Request: If there is an error setting the


twin mode.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/SetTwInMode?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhbG.....");
var body = @"1";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/SetTwInMode?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(1)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Document Revision - v.2 Cash Device REST API - 205


Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/SetTwInMode?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10"

payload = json.dumps(1)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "1");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/SetTwInMode?
deviceID=TWIN_SMART_COIN_SYSTEM-COM10")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 206


REST API - ExtendedGetDatasetVersion
Description
Command to return a variable length ASCII array containing the installed dataset version of the attached device
that appends compilation date/time

Endpoint ExtendedGetDatasetVersion

Method GET

URL {server_url}/api/CashDevice/ExtendedGetDatasetVersion

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the extended dataset version was


retrieved successfully.
NV4000-COM5: { ExtendedDatasetVersion
= EUR41044_25.09.24_13:39:30 }

400 Bad Request: If there is an error retrieving


the extended dataset version.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/ExtendedGetDatasetVersion?
deviceID=NV4000-COM5", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 207


NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/ExtendedGetDatasetVersion?
deviceID=NV4000-COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/ExtendedGetDatasetVersion?
deviceID=NV4000-COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/ExtendedGetDatasetVersion?
deviceID=NV4000-COM5")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 208


REST API - ExtendedGetFirmwareVersion
Description
Command to return a variable length ASCII array containing the full firmware version of the attached device that
appends compilation date/time

Endpoint ExtendedGetFirmwareVersion

Method GET

URL {server_url}/api/CashDevice/ExtendedGetFirmwareVersion

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the extended firmware version was


retrieved successfully.
NV4000-COM5:
{ ExtendedFirmwareVersion =
NVS2004301066NV4_11.11.24_16: 33: 37
}

400 Bad Request: If there is an error retrieving


the extended firmware version.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/ExtendeDGetFirmwareVersion?
deviceID=NV4000-COM5", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 209


NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/ExtendeDGetFirmwareVersion?
deviceID=NV4000-COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/ExtendeDGetFirmwareVersion?
deviceID=NV4000-COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/ExtendeDGetFirmwareVersion?
deviceID=NV4000-COM5")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 210


REST API - comPortReadError
Description
Checks if there is any read error on the COM port

Endpoint comPortReadError

Method GET

URL {server_url}/api/CashDevice/comPortReadError

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the com port read error status was


retrieved successfully.
NV4000-COM5: { ComPortReadError =
False
}

400 Bad Request

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/comPortReadError?deviceID=NV4000-COM5",
Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 211


NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/comPortReadError?deviceID=NV4000-COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/comPortReadError?deviceID=NV4000-COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/comPortReadError?deviceID=NV4000-COM5")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 212


REST API - DeviceState_StartupReady
Description
Checks if the device state indicates that the device is ready for startup.

Endpoint DeviceState_StartupReady

Method POST

URL {server_url}/api/CashDevice/DeviceState_StartupReady

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body DeviceState deviceStateToCheck: The device state to check

Responses
Status Body Notes

200 OK: If the device state is ready for startup.

NV4000-COM5: { StartupReady = False


}

400 Bad Request

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/DeviceState_StartupReady?
deviceID=NV4000-COM5", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"3";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 213


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/DeviceState_StartupReady?
deviceID=NV4000-COM5',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(3)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/DeviceState_StartupReady?deviceID=NV4000-
COM5"

payload = json.dumps(3)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "3");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/DeviceState_StartupReady?
deviceID=NV4000-COM5")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 214


REST API - GetLifterStatus
Description
Allows to get the current status of the lifter

Endpoint GetLifterStatus

Method GET

URL {server_url}/api/CashDevice/GetLifterStatus

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the lifter status was retrieved


successfully.
SMART_COIN_SYSTEM-COM10:
{ LifterConnected = True,
LifterOptoClear = True, LifterJammed
= False }

400 Bad Request: If there is an error retrieving


the lifter status.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetLifterStatus?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 215


NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetLifterStatus?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetLifterStatus?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetLifterStatus?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 216


REST API - GetLastRejectCode
Description
Gets the reason the device rejected the last note

Endpoint GetLastRejectCode

Method GET

URL {server_url}/api/CashDevice/GetLastRejectCode

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body None

Responses
Status Body Notes

200 OK: If the last reject code was retrieved


successfully.
SPECTRAL_PAYOUT-COM5:
{ RejectCategory = Reject Reason:
Channel Inhibit
}

400 Bad Request: If there is an error retrieving


the last reject code.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/GetLastRejectCode?
deviceID=SPECTRAL_PAYOUT-COM5", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 217


NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/CashDevice/GetLastRejectCode?
deviceID=SPECTRAL_PAYOUT-COM5',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

url = "http://localhost:5000/api/CashDevice/GetLastRejectCode?
deviceID=SPECTRAL_PAYOUT-COM5"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/GetLastRejectCode?
deviceID=SPECTRAL_PAYOUT-COM5")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 218


REST API - DeviceErrorLimpMode
Description
Checks if the device error indicates that the device is in limp mode

Endpoint DeviceErrorLimpMode

Method POST

URL {server_url}/api/CashDevice/DeviceErrorLimpMode

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body DeviceError deviceErrorToCheck: The device error to check

Responses
Status Body Notes

200 OK: If the device error limp mode status


was retrieved successfully.
SMART_COIN_SYSTEM-COM10: { LimpMode =
False }

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/DeviceErrorLimpMode?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"2";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 219


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/DeviceErrorLimpMode?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(2)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/DeviceErrorLimpMode?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = json.dumps(2)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "2");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/DeviceErrorLimpMode?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 220


REST API - DeviceStateLimpMode
Description
Checks if the device state indicates that the device is in limp mode

Endpoint DeviceStateLimpMode

Method POST

URL {server_url}/api/CashDevice/DeviceStateLimpMode

Parameters • deviceID (string): The value of "deviceID" obtained from the response to the
OpenConnection request

Authorisatio Bearer Token


n

Body DeviceState deviceStateToCheck: The device state to check

Responses
Status Body Notes

200 OK: If the device state limp mode status


was retrieved successfully.
SMART_COIN_SYSTEM-COM10: { LimpMode =
False }

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/CashDevice/DeviceStateLimpMode?
deviceID=SMART_COIN_SYSTEM-COM10", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"2" + "\n" +
@"";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Document Revision - v.2 Cash Device REST API - 221


NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/CashDevice/DeviceStateLimpMode?
deviceID=SMART_COIN_SYSTEM-COM10',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify(2)

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/CashDevice/DeviceStateLimpMode?
deviceID=SMART_COIN_SYSTEM-COM10"

payload = json.dumps(2)
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "2\r\n");
Request request = new Request.Builder()
.url("http://localhost:5000/api/CashDevice/DeviceStateLimpMode?
deviceID=SMART_COIN_SYSTEM-COM10")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 222


REST API - StartDownload
Description
Begins the download of the specified firmware/dataset file to the ITL cash device.

Not Available in Android APK at this time.

Endpoint StartDownload

Method POST

URL {server_url}/api/Download/StartDownload

Parameters None

Authorisatio Bearer Token


n

Body

{
"DownloadFileName": "{{DownloadFilePath}}\\{{UpdateFileName}}.bv1",
"ComPort": "{{ComPort}}",
"SspAddress": {{SspAddress}}
}

Body Parameters
Parameter Type Description Required Default

DownloadFileName string Full path to the firmware/ Yes


dataset file (.bv1)

ComPort string The COM port to use Yes

SSPAddress byte SSP address Yes

PacketDownload boolean Enable Packet Download No true

BaudRate int The data transfer rate No 115200

Document Revision - v.2 Cash Device REST API - 223


Responses
Status Body Notes

200 OK: Successfully initiated download.

Download initiated. Check progress


with /GetDownloadStatus.

400 Bad Request

Invalid parameters. Please provide a


valid file name and COM port.

500 Internal Server Error

Failed to initiate download.

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/Download/StartDownload", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer eyJhb.....");
var body = @"{" + "\n" +
@" ""DownloadFileName"": ""C:\\InnovativeTechnology\\UpdateFile\
\ITL01003_NVS2004311048000_IF_01.bv1""," + "\n" +
@" ""ComPort"": ""COM5""," + "\n" +
@" ""SspAddress"": 0" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'POST',
'url': 'http://localhost:5000/api/Download/StartDownload',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
},
body: JSON.stringify({

Document Revision - v.2 Cash Device REST API - 224


"DownloadFileName": "C:\\InnovativeTechnology\\UpdateFile\
\ITL01003_NVS2004311048000_IF_01.bv1",
"ComPort": "COM5",
"SspAddress": 0
})

};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests
import json

url = "http://localhost:5000/api/Download/StartDownload"

payload = json.dumps({
"DownloadFileName": "C:\\InnovativeTechnology\\UpdateFile\
\ITL01003_NVS2004311048000_IF_01.bv1",
"ComPort": "COM5",
"SspAddress": 0
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"DownloadFileName\": \"C:\\
\\InnovativeTechnology\\\\UpdateFile\\\\ITL01003_NVS2004311048000_IF_01.bv1\",\r\n
\"ComPort\": \"COM5\",\r\n \"SspAddress\": 0\r\n}");
Request request = new Request.Builder()
.url("http://localhost:5000/api/Download/StartDownload")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 225


REST API - GetDownloadStatus
Description
Used to monitor the progress of a firmware/dataset update to the ITL cash device in real-time.

Not Available in Android APK at this time.

Endpoint GetDownloadStatus

Method Get

URL {server_url}/api/Download/GetDownloadStatus

Parameters None

Authorisatio Bearer Token


n

Body None

Responses
Field Type Description

State string Current state of the download:


· IDLE
· UPDATING
· COMPLETE

CurrentDownloadBlock integer The current download block number

TotalDownloadBlock integer Total number of download blocks

Success boolean True if the download is complete, otherwise


false

Document Revision - v.2 Cash Device REST API - 226


Example Responses
Status Body Notes

200 OK: Successfully initiated download.

{
"state": "UPDATING",
"currentDownloadBlock": 4453,
"totalDownloadBlock": 4655,
"success": false
}

400 Bad Request

500 Internal Server Error

Code Examples

C#

var options = new RestClientOptions("http://localhost:5000")


{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/Download/GetDownloadStatus", Method.Get);
request.AddHeader("Authorization", "Bearer eyJhb.....");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

NodeJS

var request = require('request');


var options = {
'method': 'GET',
'url': 'http://localhost:5000/api/Download/GetDownloadStatus',
'headers': {
'Authorization': 'Bearer eyJhb.....'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});

Python

import requests

Document Revision - v.2 Cash Device REST API - 227


url = "http://localhost:5000/api/Download/GetDownloadStatus"

payload = {}
headers = {
'Authorization': 'Bearer eyJhb.....'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Java

OkHttpClient client = new OkHttpClient().newBuilder()


.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("http://localhost:5000/api/Download/GetDownloadStatus")
.method("GET", body)
.addHeader("Authorization", "Bearer eyJhb.....")
.build();
Response response = client.newCall(request).execute();

Document Revision - v.2 Cash Device REST API - 228

You might also like