JSON RPC auto-generated documentation

To call any of these methods, send a POST request to this url (/jsonrpc/) with encoded JSON according to the JSON RPC 2.0 spec.

The 'params' value should be specified by-name (i.e. as a JS object). All time values are encoded as seconds since the epoch.

New: Batch requests are supported




            

Tutorial

This short tutorial will run through the steps of:

  • Authenticating
  • Creating a new device
  • Creating a list of samplers
  • Adding sample data

Each step will show the JSON required.

Authentication

To authenticate we call the device.auth method

{
    "jsonrpc": "2.0",
    "method": "device.auth",
    "params": {"username":"your_username","password":"your_password", "serial":"device_serial"},
    "id": 1
}

If authentication is successful, it will return the following.

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "the_auth_token"
}

You need to save the value of the auth token for future calls.

Create a new device

This method will create a new device class, firmware and device if they don't already exist

{
	"jsonrpc": "2.0",
	"method": "device,register",
	"params": {"auth_token":"the_auth_token","device_class_name":"class_name","name":"device_name",
               "serial":"device_serial"},
	"id": 1
}

If successful this method will return:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "message": "Device registered successfully",
        "device_class": "device_class_uid"
    }
}

The device class uid is not needed for future calls.

Create samplers

This call creates new named samplers. This requires 2 batched json calls, the first to check authentication, and the second to create the samplers.

[{
	"jsonrpc": "2.0",
	"method": "device.check_auth",
	"params": {"auth_token":"the_auth_token", "device_class":"class_name", "serial":"device_serial"},
	"id": 1
},
{
	"jsonrpc": "2.0",
	"method": "device.create_samplers",
	"params": {"sampler_names":["s1","s2"]},
	"id": 1
}]

This will return:

[
    {
        "jsonrpc": "2.0",
        "id": 1,
        "result": true
    },
    {
        "jsonrpc": "2.0",
        "id": 1,
        "result": true
    }
]

Add Samples

Again, this call requires a batched call with check_auth.

[{
	"jsonrpc": "2.0",
	"method": "device.check_auth",
	"params": {"auth_token":"the_auth_token","device_class":"class_name","serial":"device_serial"},
	"id": 1
},
{
	"jsonrpc": "2.0",
	"method": "device.add_samples",
	"params": {"device_class":"class_name","sampler_name":"s1","serial":"device_serial","samples":[[12342345, 123], [25324365.0, 420.0]]},
	"id": 1
}]

Again this returns:

[
    {
        "jsonrpc": "2.0",
        "id": 1,
        "result": true
    },
    {
        "jsonrpc": "2.0",
        "id": 1,
        "result": true
    }
]

Authentication Extension

In addition to authenticating via a batch call, the server offers an optional extension to the JSONRPC protocol. You can supply the auth token and sync id on the query string, which will authenticate the method call(s) in the request. The values are as follows:

  • auth
    The value returned by 'device.auth'
  • sync_id
    The value that would normally be passed to 'device.check_auth'

Here's an example:

?auth=kwkewyn7wernw9er7&sync_id=28

The form at the top of this page has a input for the query string, which you may use to test the authentication extension.

ack_alert

Parameter Purpose Default Required?
alert_id Yes
dismiss False No
sessionkey A session key returned from login Yes

Back to Top

add

Add a and b together and return the result.

This is a dumb method for debugging. Requires a valid sessionkey, so use this to test logging in.

Parameter Purpose Default Required?
a First number Yes
b Second number 0 No
sessionkey A session key returned from login Yes

Back to Top

add_android_reg_id

Parameter Purpose Default Required?
reg_id Yes
sessionkey A session key returned from login Yes

Back to Top

add_ios_reg_id

Parameter Purpose Default Required?
reg_id Yes
sessionkey A session key returned from login Yes

Back to Top

add_ms_uri

Parameter Purpose Default Required?
sessionkey A session key returned from login Yes
uri Yes

Back to Top

add_reg_ids

Parameter Purpose Default Required?
id_type String. One of android, ios, ms_mobile or ms_win Yes
reg_id Yes
sessionkey A session key returned from login Yes

Back to Top

boom

Test for error handling, this method attempts to divide by zero

No parameters


Back to Top

get_alerts

Parameter Purpose Default Required?
company uid of the company to filter by null No
limit Number of objects in each page null No
page Pagination page, index starts at 1 null No
sessionkey A session key returned from login Yes

Back to Top

get_all_devices_with_locations

Parameter Purpose Default Required?
limit 10 No
page 1 No
secret Yes

Back to Top

get_android_interface

Get android interface definitions.

The interface for android is stored in the UI xml. This method will return the contents of <mobileinterface>, with variable substitutions.

Parameter Purpose Default Required?
device_key A device key Yes
sessionkey A session key returned from login Yes

Back to Top

get_companies

Get a list of companies that may be managed by the user.

Companies are returned as a list of objects containing the name, company key and logo url.

e.g. [{"name":"Microsoft", "key":10}, {"name":"Sony", "key":20, "image_url": "example.com/images/logo.png"}]

Parameter Purpose Default Required?
sessionkey A session key returned from login Yes

Back to Top

get_company_paths

Get a flat list of all the device tree paths associated with a company.

Paths are given in a dotted notation. i.e. "Middle Earth.Mordor" references the "Mordor" folder inside "Middle Earth". The root path is an empty string ("").

NB. Paths that do not contain folders that the user has permission to view will be pruned

Parameter Purpose Default Required?
company_key A company key Yes
sessionkey A session key returned from login Yes

Back to Top

get_device

Gets a single device

Parameter Purpose Default Required?
device_key The device key Yes
sessionkey A session key returned from login Yes

Back to Top

get_device_locations

Accepts a list of device ids as a parameter. Returns a list of dicts containing the device id, lat and lng. If no device has gps coords, then no dict is returned for that device. If none of the devices have gps coords, an empty list is returned.

Parameter Purpose Default Required?
device_list List of device ids Yes
sessionkey A session key returned from login Yes

Back to Top

get_device_paths

Similar to get_company_paths, except this method also returns device data.

Parameter Purpose Default Required?
basic False No
company_key Yes
sessionkey A session key returned from login Yes

Back to Top

get_device_with_uid

Gets a single device

Parameter Purpose Default Required?
device_uid The device uid Yes
sessionkey A session key returned from login Yes

Back to Top

get_devices

Gets a list of devices in a device tree folder.

Devices are returned as a list of objects, containing the name and device key ("name", "key" respectively), plus some other information.

Parameter Purpose Default Required?
company_key Company key returned from get_companies. Yes
path Path in the device tree (not including "Home") e.g. "Middle Earth.Mordor.Mount Doom" Yes
sessionkey A session key returned from login Yes

Back to Top

get_devices_with_locations

Parameter Purpose Default Required?
company uid of the company to filter by null No
sessionkey A session key returned from login Yes

Back to Top

get_hydip_data

Parameter Purpose Default Required?
device_key Yes
sessionkey A session key returned from login Yes

Back to Top

get_named_samples

Parameter Purpose Default Required?
device_key A device key Yes
end_date End date in unix timestamp format Yes
max_points 1000 No
sampler_list A list of sampler names Yes
sessionkey A session key returned from login Yes
start_date Start date in unix timestamp format Yes

Back to Top

get_product_types

No parameters


Back to Top

get_tag_types

No parameters


Back to Top

get_tank_samples

Get a range of tank dips for a given device from start to end. If start is omitted then the start will be from the first available sample, if end is omitted, samples up to the most recent will be returned.

Samples are returned as a list of tuples where each tuple contains the timestamp and volume.

Parameter Purpose Default Required?
end End date of sample range (as seconds since epoch) null No
sessionkey A session key returned from login Yes
start Start date of sample range (as seconds since epoch) null No
tank_uid A tank uid Yes

Back to Top

hello

Sends a greeting to who.

This is a test method, meant as a debugging aid.

Parameter Purpose Default Required?
who Name to greet Yes

Back to Top

hydip_get_all_customer_transactions

Parameter Purpose Default Required?
filters {} No
limit 10 No
page 1 No
sessionkey A session key returned from login Yes

Back to Top

hydip_get_customer_transactions

Parameter Purpose Default Required?
filters {} No
limit 10 No
page 1 No
sessionkey A session key returned from login Yes
tag_id Yes

Back to Top

hydip_get_samples

This call is only for devices that haven't been migrated to the sites framework. Get a range of tank dips for a given device from start to end. If start is omitted then the start will be from the first available sample, if end is omitted, samples up to the most recent will be returned.

Samples are returned as a list of dictionaries. Each dictionary contains two values; "sensor" is the index of the sensor, and "dips" is a list samples, where each sample is a list containing the timestamp and volume.

Parameter Purpose Default Required?
device_key A device key Yes
end End date of sample range (as seconds since epoch) null No
sessionkey A session key returned from login Yes
start Start date of sample range (as seconds since epoch) null No

Back to Top

hydip_get_tag_detail

Parameter Purpose Default Required?
sessionkey A session key returned from login Yes

Back to Top

hydip_get_tags

Parameter Purpose Default Required?
filters {} No
limit 10 No
page 1 No
sessionkey A session key returned from login Yes

Back to Top

hydip_get_transactions

Parameter Purpose Default Required?
filters {} No
limit 10 No
page 1 No
sessionkey A session key returned from login Yes

Back to Top

hydip_tag_add_mobile_reg

Parameter Purpose Default Required?
id_type Yes
reg_id Yes
sessionkey A session key returned from login Yes

Back to Top

hydip_tag_login

Parameter Purpose Default Required?
pin Tag pin number Yes
tag Tag name Yes

Back to Top

hydip_tag_mutetag

Parameter Purpose Default Required?
mute True No
sessionkey A session key returned from login Yes

Back to Top

hydip_user_add_mobile_reg

Parameter Purpose Default Required?
id_type Yes
reg_id Yes
sessionkey A session key returned from login Yes

Back to Top

hydip_user_login

Parameter Purpose Default Required?
custid Customer id Yes
pin Customer pin number Yes

Back to Top

hydip_user_mute_all

Parameter Purpose Default Required?
mute True No
sessionkey A session key returned from login Yes

Back to Top

hydip_user_mutetag

Parameter Purpose Default Required?
mute True No
sessionkey A session key returned from login Yes
tag_id Yes

Back to Top

keep_alive

Does nothing except extend the session for another hour.

Parameter Purpose Default Required?
sessionkey A session key returned from login Yes

Back to Top

login

Log in a user with credentials username and password.

Most of the json rpc methods require a login, so this should be the first call before anything else. If login is successful, this method will return a string containing the session key, this value should be passed to the other methods as a parameter called sessionkey.

If login is not successful this method will return an error state.

Sessions are automatically logged out, 60 minutes after the last request.

Parameter Purpose Default Required?
password Password Yes
username Username Yes

Back to Top

logout

Log out a given session. Subsequent calls to methods requiring a login will fail.

Not really required, since sessions expire after 60 minutes, but this is good house-keeping, and can protect against potential exploits.

Parameter Purpose Default Required?
sessionkey A session key returned from login Yes

Back to Top

post_form

Parameter Purpose Default Required?
device_key Yes
form_data Yes
form_id Yes
sessionkey A session key returned from login Yes

Back to Top

remove_android_reg_id

Parameter Purpose Default Required?
reg_id Yes
sessionkey A session key returned from login Yes

Back to Top

sites.get_networks

Parameter Purpose Default Required?
company_key The uid of the company Yes
sessionkey A session key returned from login Yes

Back to Top

sites.get_site_groups

Parameter Purpose Default Required?
company_key The uid of the company Yes
network_key The uid of the network Yes
sessionkey A session key returned from login Yes

Back to Top

auth.connect_device

Connect a device with a user, and return an auth key.

Parameter Purpose Default Required?
device_name Name of the device (max 100 chars). This text should be recognizable to the user. e.g. "Will's iPhone" Yes
device_token An ID to identify the device (max 40 chars). Yes
password User's password Yes
username User's username Yes

Back to Top

auth.get_authenticated_user

Parameter Purpose Default Required?
sessionkey A session key returned from login Yes

Back to Top

auth.login

Log in a user with credentials username and password.

Most of the json rpc methods require a login, so this should be the first call before anything else. If login is successful, this method will return a string containing the session key, this value should be passed to the other methods as a parameter called sessionkey.

If login is not successful this method will return an error state.

Sessions are automatically logged out, 60 minutes after the last request.

Parameter Purpose Default Required?
password Password Yes
username Username Yes

Back to Top

auth.logout

Log out a given session. Subsequent calls to methods requiring a login will fail.

Not really required, since sessions expire after 60 minutes, but this is good house-keeping, and can protect against potential exploits.

Parameter Purpose Default Required?
sessionkey A session key returned from login Yes

Back to Top

devices.get_devices_by_asset_tag

Parameter Purpose Default Required?
asset_tag Asset tag of a device Yes
company_key The uid of the company Yes
network_key The uid of the network Yes
sessionkey A session key returned from login Yes

Back to Top

fueltracking.export_new_transactions

Get new transactions since a previous call.

This method retrieves new transaction based on an update_index. On the first call to this method, update_index should be 0, which will return all transactions. A new value for update_index will be returned along with the transactions. Subsequent calls should use the update_index from the previous calls. This ensures that only new transactions will be returned.

This method returns the following response. The list of transactions is in the same format as the export_transactions method.

{
"update_index": <integer update index>,
"transactions": <list of transactions>
}

Parameter Purpose Default Required?
db_name Name of the tag database ('hytrak' for now) hytrak No
sessionkey A session key returned from login Yes
update_index The update index returned from a previous export, (send 0 first time) 0 No

Back to Top

fueltracking.export_transactions

Get a list of transactions, with an option date range. If start and end are supplied, they should be given as seconds since the epoch.

A transaction contains the following information:

{
"tag": <string tag id>,
"device": <device key>,
"customer": <string customer id>,
"id": <string unique identifier for this transaction>,
"start": <float start time>, # as seconds since the epoch)
"stop": <float stop time>, # as seconds since the epoch
"seq_num": <integer sequence number>,
"product": <integer product enum (see fueltracking.import)>,
"volume": <float volume dispensed>,
"price": <float price of transaction>,
"unit_price": <float price per unit of volume>,
"status": <integer transaction status bits (see below)>
"dispenser_index": <integer index of dispense>,
"credit": <float credit applied>,
"debit": <float debit applied>,
"source": <integer source enum>,
"odometer": <integer value of odometer>,
"userid": <integer user ID>,
"hosenumber": <integer index of hose>
}

Transaction status bits:

INVALID_ID = 1 << 0
ID_SEARCH_FAIL = 1 << 1
OUT_OF_CREDIT = 1 << 2
PIN_INCORRECT = 1 << 3
PIN_ENTRY_TIMEOUT = 1 << 4
DISPENSE_TIME_EXCEEDED = 1 << 5
COMM_ERR = 1 << 6
PWR_FAIL = 1 << 7
BCB_COMM_FAIL = 1 << 8
USER_ID_ENTRY_TIMEOUT = 1 << 9
ODOMETER_ENTRY_TIMEOUT = 1 << 10
RESTRICTED_FUEL_BIT = 1 << 11
CREDIT_CHECK = 1 << 12

Transaction source enum:

UNKNOWN = 0 (not used)
DEVICE = 1 (transaction was a device)
ADMIN = 100 (transaction was from admin)

Parameter Purpose Default Required?
company uid of the company to filter by null No
db_name Name of the tag database ('hytrak' for now) hytrak No
end end time of transaction, or to last transaction if null null No
limit Number of objects in a page null No
page Pagination number, index starts at 1 null No
sessionkey A session key returned from login Yes
start start time of transaction range, or from earliest transaction if null null No

Back to Top

fueltracking.import

Import tag database. On success this method returns a dictionary containing statistics regarding the number of objects that were newly imported, modified or suspended. If the import fails for some reason an error code 7 will be returned, along with a (hopefully) helpful error message.

Customers and tags are given as a list of objects. Any enduser or tag that was previously imported, but not in this call will be marked as 'suspended'.

A customer should contain one or more of the following fields:

{
"id": <string customer id (required)>,
"name": <string customer name>,
"address1": <string address line 1>,
"address2": <string address line 2>,
"address3": <string address line 3>,
"zipcode": <string zipcode>,
"tel": <string telephone number>,
"mobile": <string mobile number>,
"notes": <string free notes field>,
"suspended": <boolean true if user is suspended>,
"balances": <list of balances, where a balance is a list of [<product enum>, <product value>]>,
"daily_limits": <list of balances, as balances, but the value may also be null>,
"payment_type": <integer payment type enum> (see below)
}

Payment type enum:

PRE_PAY = 0
DAILY_LIMIT = 1

The following is an example value for balances, were water is 100 liters and ADBLUE is 300 liters:

[[1, 100], [6, 300]]

A tag should contain one or more of the following fields:

{
"id": <string tag id (required)>,
"customer": <string id of customer who has this tag>,
"tag_type": <integer TAG=1, CARD=2, ODOM_REQ=3, UID_REQ=4, UID_ODOM_REQ=5 (required)>,
"credit_type": <integer CASH=1, VOLUME=2>,
"product_mask": <list of integers (see products enum below)>
"pin": <string for PIN number, or null for no PIN>,
"suspended": <boolean true if this card may not be used>,
"daily_limits": <list of per-tag daily limits, given as a list of [<product enum>, <product value>] (value may be null to indicate no limit)>,
"metered_product_daily_limit": <number for daily limit for volume tags with multiple products, or null>
}

Product enum:

RESERVED_0 = 0
WATER = 1
DIESEL = 2
PREMIUM_UNLEADED = 3
UNLEADED = 4
LEADED = 5
ADBLUE = 6
OIL = 7
LPG = 8
KEROSENE = 9
AVGAS = 10
JETA1 = 11
CNG = 12
MPD = 13
RESERVED_1 = 14
RESERVED_2 = 15

Parameter Purpose Default Required?
customers A list of customers to import null No
db_name Name of the tag database ('hytrak' for now) hytrak No
sessionkey A session key returned from login Yes
tags A list of tags to add/modify null No

Back to Top

hydip.get_samples

This call is only for devices that haven't been migrated to the sites framework. Get a range of tank dips for a given device from start to end. If start is omitted then the start will be from the first available sample, if end is omitted, samples up to the most recent will be returned.

Samples are returned as a list of dictionaries. Each dictionary contains two values; "sensor" is the index of the sensor, and "dips" is a list samples, where each sample is a list containing the timestamp and volume.

Parameter Purpose Default Required?
device_key A device key Yes
end End date of sample range (as seconds since epoch) null No
sessionkey A session key returned from login Yes
start Start date of sample range (as seconds since epoch) null No

Back to Top

network.get_network_transactions

Get a list of transactions, with an option date range. If start and end are supplied, they should be given as seconds since the epoch.

A transaction contains the following information:

{
"tag": <string tag id>,
"device": <device key>,
"customer": <string customer id>,
"id": <string unique identifier for this transaction>,
"start": <float start time>, # as seconds since the epoch)
"stop": <float stop time>, # as seconds since the epoch
"seq_num": <integer sequence number>,
"product": <integer product enum (see fueltracking.import)>,
"volume": <float volume dispensed>,
"price": <float price of transaction>,
"unit_price": <float price per unit of volume>,
"status": <integer transaction status bits (see below)>
"dispenser_index": <integer index of dispense>,
"credit": <float credit applied>,
"debit": <float debit applied>,
"source": <integer source enum>,
"odometer": <integer value of odometer>,
"userid": <integer user ID>,
"hosenumber": <integer index of hose>,
"network_uid": <uuid uid of network>,
"currency_display": <string currency>,
"units_display": <string units of measurement (e.g litres)>,
"device_name": <string device name>,
"product_name": <string readable product label from enum>,
"credit_type": <string readable credit type label from enum>,
"dispenser_index": <string hose number>,
"user_friendly_tagid": <string user friendly tag id>
}

Transaction status bits:

INVALID_ID = 1 << 0
ID_SEARCH_FAIL = 1 << 1
OUT_OF_CREDIT = 1 << 2
PIN_INCORRECT = 1 << 3
PIN_ENTRY_TIMEOUT = 1 << 4
DISPENSE_TIME_EXCEEDED = 1 << 5
COMM_ERR = 1 << 6
PWR_FAIL = 1 << 7
BCB_COMM_FAIL = 1 << 8
USER_ID_ENTRY_TIMEOUT = 1 << 9
ODOMETER_ENTRY_TIMEOUT = 1 << 10
RESTRICTED_FUEL_BIT = 1 << 11
CREDIT_CHECK = 1 << 12

Transaction source enum:

UNKNOWN = 0 (not used)
DEVICE = 1 (transaction was a device)
ADMIN = 100 (transaction was from admin)

Parameter Purpose Default Required?
end end time of transaction, or to last transaction if null null No
network_uid The uid of the network Yes
sessionkey A session key returned from login Yes
start start time of transaction range, or from earliest transaction if null null No

Back to Top

network.get_new_transactions

Get new transactions since a previous call.

This method retrieves new transaction based on an update_index. On the first call to this method, update_index should be 0, which will return all transactions. A new value for update_index will be returned along with the transactions. Subsequent calls should use the update_index from the previous calls. This ensures that only new transactions will be returned.

This method returns the following response. The list of transactions is in the same format as the get_network_transactions method.

{
"update_index": <integer update index>,
"transactions": <list of transactions>
}

Parameter Purpose Default Required?
network_uid The uid of the network Yes
sessionkey A session key returned from login Yes
update_index The update index returned from a previous export, (send 0 first time) 0 No

Back to Top

network.get_recent_transactions

Get a list of recent transactions, default limit of 50.

A transaction contains the following information:

{
"tag": <string tag id>,
"device": <device key>,
"customer": <string customer id>,
"id": <string unique identifier for this transaction>,
"start": <float start time>, # as seconds since the epoch)
"stop": <float stop time>, # as seconds since the epoch
"seq_num": <integer sequence number>,
"product": <integer product enum (see fueltracking.import)>,
"volume": <float volume dispensed>,
"price": <float price of transaction>,
"unit_price": <float price per unit of volume>,
"status": <integer transaction status bits (see below)>
"dispenser_index": <integer index of dispense>,
"credit": <float credit applied>,
"debit": <float debit applied>,
"source": <integer source enum>,
"odometer": <integer value of odometer>,
"userid": <integer user ID>,
"hosenumber": <integer index of hose>,
"network_uid": <uuid uid of network>,
"currency_display": <string currency>,
"units_display": <string units of measurement (e.g litres)>,
"device_name": <string device name>,
"product_name": <string readable product label from enum>,
"credit_type": <string readable credit type label from enum>,
"dispenser_index": <string hose number>,
"user_friendly_tagid": <string user friendly tag id>
}

Transaction status bits:

INVALID_ID = 1 << 0
ID_SEARCH_FAIL = 1 << 1
OUT_OF_CREDIT = 1 << 2
PIN_INCORRECT = 1 << 3
PIN_ENTRY_TIMEOUT = 1 << 4
DISPENSE_TIME_EXCEEDED = 1 << 5
COMM_ERR = 1 << 6
PWR_FAIL = 1 << 7
BCB_COMM_FAIL = 1 << 8
USER_ID_ENTRY_TIMEOUT = 1 << 9
ODOMETER_ENTRY_TIMEOUT = 1 << 10
RESTRICTED_FUEL_BIT = 1 << 11
CREDIT_CHECK = 1 << 12

Transaction source enum:

UNKNOWN = 0 (not used)
DEVICE = 1 (transaction was a device)
ADMIN = 100 (transaction was from admin)

Parameter Purpose Default Required?
company uid of the company to filter by Yes
limit Number of objects in a page. Default 50, max 1000 50 No
sessionkey A session key returned from login Yes

Back to Top

network.import

Import tag database. On success this method returns a dictionary containing statistics regarding the number of objects that were newly imported, modified or suspended. If the import fails for some reason an error code 7 will be returned, along with a (hopefully) helpful error message.

Customers and tags are given as a list of objects. Any enduser or tag that was previously imported, but not in this call will be marked as 'suspended'.

A customer should contain one or more of the following fields:

{
"id": <string customer id (required)>,
"name": <string customer name>,
"address1": <string address line 1>,
"address2": <string address line 2>,
"address3": <string address line 3>,
"zipcode": <string zipcode>,
"tel": <string telephone number>,
"mobile": <string mobile number>,
"notes": <string free notes field>,
"suspended": <boolean true if user is suspended>,
"balances": <list of balances, where a balance is a list of [<product enum>, <product value>]>,
"daily_limits": <list of balances, as balances, but the value may also be null>,
"payment_type": <integer payment type enum> (see below)
}

Payment type enum:

PRE_PAY = 0
DAILY_LIMIT = 1

The following is an example value for balances, were water is 100 liters and ADBLUE is 300 liters:

[[1, 100], [6, 300]]

A tag should contain one or more of the following fields:

{
"id": <string tag id (required)>,
"customer": <string id of customer who has this tag>,
"tag_type": <integer TAG=1, CARD=2, ODOM_REQ=3, UID_REQ=4, UID_ODOM_REQ=5 (required)>,
"credit_type": <integer CASH=1, VOLUME=2>,
"product_mask": <list of integers (see products enum below)>
"pin": <string for PIN number, or null for no PIN>,
"suspended": <boolean true if this card may not be used>,
"daily_limits": <list of per-tag daily limits, given as a list of [<product enum>, <product value>] (value may be null to indicate no limit)>,
"metered_product_daily_limit": <number for daily limit for volume tags with multiple products, or null>,
"vehicle_reg": <user defined vehicle reg number>,
"vehicle_model": <user defined vehicle model>,
"vehicle_fleet_no": <user defined vehicle fleet number>
}

Product enum:

RESERVED_0 = 0
WATER = 1
DIESEL = 2
PREMIUM_UNLEADED = 3
UNLEADED = 4
LEADED = 5
ADBLUE = 6
OIL = 7
LPG = 8
KEROSENE = 9
AVGAS = 10
JETA1 = 11
CNG = 12
MPD = 13
RESERVED_1 = 14
RESERVED_2 = 15

Parameter Purpose Default Required?
customers A list of customers to import null No
network_uid The uid of the network Yes
sessionkey A session key returned from login Yes
tags A list of tags to add/modify null No

Back to Top

networks.get_networks

Parameter Purpose Default Required?
company_key The uid of the company Yes
sessionkey A session key returned from login Yes

Back to Top

pricezones.get_pricezone

Parameter Purpose Default Required?
company_key The uid of the company Yes
network_key The uid of the network Yes
pricezone_key The uid of the pricezone Yes
sessionkey A session key returned from login Yes

Back to Top

pricezones.get_pricezones

Parameter Purpose Default Required?
company_key The uid of the company Yes
network_key The uid of the network Yes
sessionkey A session key returned from login Yes

Back to Top

pricezones.set_pricezone

The price_data parameter should be in the following format: { "water": "1.234", "diesel": "1.234", "premium_unleaded": "1.234", "unleaded": "1.234", "leaded": "1.234", "adblue": "1.234", "oil": "1.234", "lpg": "1.234", "kerosene": "1.234", "avgas": "1.234", "jeta1": "1.234", "cng": "1.234", "mpd": "1.234" }

You don't have to add every price, you can just include the ones that you want to change.

Parameter Purpose Default Required?
company_key The uid of the company Yes
network_key The uid of the network Yes
price_data Dictionary of prices Yes
pricezone_key The uid of the priczone to update Yes
sessionkey A session key returned from login Yes

Back to Top

sites.get_site_objects

Parameter Purpose Default Required?
company_key The uid of the company Yes
sessionkey A session key returned from login Yes
site_key The uid of the site Yes

Back to Top

sites.get_sites

Parameter Purpose Default Required?
company_key The uid of the company Yes
network_key The uid of the network Yes
sessionkey A session key returned from login Yes
site_group_key The uid of the site group (optional) null No

Back to Top

sites.get_tank_samples

Get a range of tank dips for a given device from start to end. If start is omitted then the start will be from the first available sample, if end is omitted, samples up to the most recent will be returned.

Samples are returned as a list of tuples where each tuple contains the timestamp and volume.

Parameter Purpose Default Required?
end End date of sample range (as seconds since epoch) null No
sessionkey A session key returned from login Yes
start Start date of sample range (as seconds since epoch) null No
tank_uid A tank uid Yes

Back to Top

sites.get_tanks_by_asset_tag

Parameter Purpose Default Required?
asset_tag Asset tag of a device Yes
company_key The uid of the company Yes
network_key The uid of the network Yes
sessionkey A session key returned from login Yes

Back to Top