JSON RPC auto-generated documentation

To call any of these methods, send a POST request to this url 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). Batch requests are supported.


Method Index

auth

devices

endusers

hydip

network

networks

pricezones

sites

tanks




                    

Methods

ack_alert

Parameters
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.

Parameters
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_reg_ids

Parameters
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

change_password

Replaced by auth.change_password
Back to top

change_tag_pin

Replaced by hydip.change_tag_pin
Back to top

get_alerts

Gets a list of alert objects for the companies devices. Make the same queries as the front page.

Parameters
Parameter Purpose Default Required?
company uid of the company to filter by Yes
limit Number of objects in each page null No
network_uid The uid of the network null No
page Pagination page, index starts at 1 null No
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"}]

Parameters
Parameter Purpose Default Required?
sessionkey A session key returned from login Yes
Back to top

get_customer_transactions_by_date

Back to top

get_device

Gets a single device

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

get_device_with_uid

Gets a single device

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

get_devices_with_locations

Parameters
Parameter Purpose Default Required?
company uid of the company to filter by null No
network_uid The uid of the network null No
sessionkey A session key returned from login Yes
Back to top

get_product_types

Back to top

get_site_groups

Replaced by sites.get_site_groups
Back to top

get_tag_types

Gets all tag types as enum labels and values in a dict

No parameters

Back to top

get_tank_samples

Back to top

hello

Sends a greeting to who.

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

Parameters
Parameter Purpose Default Required?
who Name to greet Yes
Back to top

hydip_get_customer_transactions

Back to top

hydip_get_tag_detail

Replaced by hydip.get_tag_detail
Back to top

hydip_get_tags

Replaced by hydip.get_tags
Back to top

hydip_get_transactions

Back to top

hydip_tag_add_mobile_reg

Back to top

hydip_tag_login

Replaced by hydip.tag_login
Back to top

hydip_user_add_mobile_reg

Back to top

hydip_user_login

Replaced by hydip.user_login
Back to top

hydip_user_mute_all

Replaced by hydip.user_mute_all
Back to top

keep_alive

Does nothing except extend the session for another hour.

Parameters
Parameter Purpose Default Required?
sessionkey A session key returned from login Yes
Back to top

login

Replaced by auth.login
Back to top

logout

Replaced by auth.logout
Back to top

sites.get_networks

Replaced by networks.get_networks
Back to top

auth.authorize

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

Parameters
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
id_token ID token received from the SSO provider. Yes
Back to top

auth.change_password

Change password for the user specified by sessionkey. User must submit the current password for verification

Return the following output: { "password_changed": bool, whether the password was changed "errors": list of errors, when the password could not be changed }

Parameters
Parameter Purpose Default Required?
current_password Current password for verification Yes
new_password New password to set 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.

Parameters
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.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.

Parameters
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.

Parameters
Parameter Purpose Default Required?
sessionkey A session key returned from login Yes
Back to top

auth.reset_password

Looks up user by the specified email. Tries to send the password reset link; returns the following structure:

{ "reset_email_sent": True, if user was found False, otherwise }

Parameters
Parameter Purpose Default Required?
email User's email Yes
Back to top

devices.get_devices_by_asset_tag

Parameters
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

endusers.assign_tag

This method binds Tag specified by tag_uid to the customer specified by enduser_uid

Parameters
Parameter Purpose Default Required?
company_key The uid of the company Yes
enduser_uid EndUser uid Yes
network_key The uid of the network Yes
sessionkey A session key returned from login Yes
tag_uid Tag uid Yes
Back to top

endusers.create_enduser

Creates Customer object.

The input data has the following allowed fields:

{
'address1': <string>, // first line of address lines
'address2': <string>, // second line of address lines
'address3': <string>, // third line of address lines
'cash_limit': <optional string>, // cash limit
'cash_prepay_limit': <optional string>, // limit for cash prepay
'credit_type': <int>, allowed values: 1 - Cash, 2 - Volume
'email': <optional string>,
'external_customer_id': <optional string>,
'tel': <string>,
'mobile': <string>,
'multiproduct_limit': None,
'mute_all_notifications': <boolean>,
'name': <string>,
'notes': <optional string>,
'organization': <string>,
'payment_type': <int>, possible values: 0 - pre-pay, 1 - daily limit,
'pin': <optional string>,
'send_email': <boolean>,
'suspended': <boolean>,
'zipcode': <string>,
}

Parameters
Parameter Purpose Default Required?
company_key The uid of the company Yes
enduser_data EndUser data Yes
network_key The uid of the network Yes
sessionkey A session key returned from login Yes
Back to top

endusers.get_endusers_by_network

Get list of Customers.

Returned in the following format:

[
{
'address1': '',
'address2': '',
'address3': '',
'cash_limit': None,
'cash_prepay_limit': None,
'credit_type': 1,
'email': None,
'external_customer_id': None,
'mobile': '',
'multiproduct_limit': None,
'mute_all_notifications': False,
'name': 'treyes',
'notes': None,
'number': '0',
'organization': '',
'payment_type': 0,
'pin': None,
'send_email': False,
'suspended': False,
'tel': '',
'uid': '498961e0-0bd2-4f46-a219-58f0cc2f6759',
'zipcode': '',
}
]

Returns: List[EndUserDict]: List of serialized EndUser objects

Parameters
Parameter Purpose Default Required?
company_key The uid of the company Yes
limit Maximum number of endusers to return (optional, defaults to 25, valid only when page is not empty) 25 No
network_key The uid of the network Yes
order_by list of fields to order the data against; Optional. fields that are allowed for ordering: name, email, external_customer_id, tel. If you want to filter in descending order, please prefix the field with a minus sign (-). Example input values: ["-name"], ["name", "tel"] null No
page 1-indexed page number (optional) null No
search_query Query to filter the users against; The following fields will be filtered: name, tel, mobile, address, email, organization null No
sessionkey A session key returned from login Yes
Back to top

endusers.remove_enduser

This function moves all enduser tags to inventory and removes the user

Parameters
Parameter Purpose Default Required?
company_key The uid of the company Yes
enduser_key EndUser uid Yes
network_key The uid of the network Yes
sessionkey A session key returned from login Yes
Back to top

hydip.change_tag_pin

Changes the tag pin

Parameters
Parameter Purpose Default Required?
new_pin New pin number Yes
old_pin Current pin number Yes
sessionkey A session key returned from login Yes
Back to top

hydip.get_customer_info

Get customer info for logged in user.

Parameters
Parameter Purpose Default Required?
sessionkey Sessionkey from logged in user. Yes
Back to top

hydip.get_customer_transactions

Gets customer transactions for the hydip app

Parameters
Parameter Purpose Default Required?
filters Mapping of filters null No
limit maximum number of transactions to return 10 No
page 1-indexed page number 1 No
sessionkey A session key returned from login Yes
tag_id ID for tag null No
Back to top

hydip.get_customer_transactions_by_date

Get customer transactions. Transaction limit: 500.

Request example:

"filters":
{
"date":
{
"start": "2016-01-26 00:16:00" | "2016-01-01",
"end": "2016-01-26 00:35:00" | "2018-01-01"
}
}
}

Parameters
Parameter Purpose Default Required?
filters Mapping of filters null No
sessionkey A session key returned from login Yes
tag_id ID for tag null No
Back to top

hydip.get_tag_detail

Get information regarding a logged in tag.

A successful response will return the following:

{
"tag": <string>,
"tag_id": <string: identifier for tag to be used in queries>,
"tag_number": <string: formatted tag number for display>,
"cust_name": <string: Customer name>,
"address": <string: hex offset of tag in nems memory>,
"hash": <string: hash of tag>,
"source": <string: 'UI' or 'IMPORTED'>,
"type": <integer: tag type>,
"credit_type": <string: 'INVALID', 'CASH', or 'VOLUME'>,
"credit type_id": <integer: 0, 1, 2>,
"credit_type_label": <string: 'invalid', 'cash', or 'volume'>,
"pay_class": <string: 'CASH_DAILY_LIMIT', 'CASH_PRE_PAY', 'VOLUME_DAILY_LIMIT', 'VOLUME_PRE_PAY'> or null,
"pay_class_id": <integer: 0, 1, 2, 3> or null
"pay_class_label": <integer: 'cash daily limit', 'cash_prepay', 'vol. daily limit', 'vol.prepay'> or null,
"products": <list of string: names of products enabled on tag>,
"credit": <number>,
"muted": <boolean: notifications muted>,
"reset_time": <number or null: epoch time of next reset or null for no rest time>
"amount_used": <number: amount of tag used>,
"limit": <number>,
"phone_support_number": <optional str>,
}

Parameters
Parameter Purpose Default Required?
sessionkey A session key returned from login Yes
Back to top

hydip.get_tags

Returns tags for a hydip user

Parameters
Parameter Purpose Default Required?
filters Mapping of filters null No
limit maximum number of transactions to return 10 No
page 1-indexed page number 1 No
sessionkey A session key returned from login Yes
Back to top

hydip.get_transactions

Returns list of transactions for the currently logged in tag Args: request (HttpRequest): Django HTTP Request object sessionkey (str): session ID for the currently logged in tag page (int, optional): page number. Defaults to 1. limit (int, optional): number of items per page. Defaults to 10. filters (StringMap, optional): Additional filters for the queryset. Defaults to {}. Returns: List[StringMap]: List of transactions

Parameters
Parameter Purpose Default Required?
filters Tag filters null No
limit Number of results per page 10 No
page 1-indexed page number 1 No
sessionkey A session key returned from login Yes
Back to top

hydip.tag_add_mobile_reg

Adds the mobile reg id to the tag object

Parameters
Parameter Purpose Default Required?
id_type One of 'android', 'ios', 'ms_mobile' Yes
reg_id Registration ID Yes
sessionkey A session key returned from login Yes
Back to top

hydip.tag_login

Logs in with a tag number and a PIN.

On success, the response will be:

{
"Session_key": <str>,
"pin_change_enabled": <bool>,
"customer_info" : <dict or None> {
"name": <str>,
"addr1": <str>,
"addr2": <str>,
"zip": <str>,
"tel": <str>,
"mobile": <str>
},
"database_id": <optional int>,
"database_name": <optional str>,
"company_id": <optional str>
}

Parameters
Parameter Purpose Default Required?
pin Tag pin number Yes
tag Tag number Yes
tag_type Tag type: 'ti' or 'mifare' ti No
Back to top

hydip.user_add_mobile_reg

Adds the mobile reg id to the EndUser object

Parameters
Parameter Purpose Default Required?
id_type Yes
reg_id A registration id Yes
sessionkey A session key returned from login Yes
Back to top

hydip.user_login

Logs a user in from a customer id and a PIN. Returns object containing session_key and other information.

{
"session_key": <string>,
"customer_info" : <object> {
"name": <string>,
"addr1": <string>,
"addr2": <string>,
"zip": <string>,
"tel": <string>,
"mobile": <string>
},
"mute_all": <boolean>,
"database_id": <optional integer>,
"database_name": <optional string>,
"company_id"" <optional str>
}

Parameters
Parameter Purpose Default Required?
custid Customer id Yes
pin Customer PIN number Yes
Back to top

hydip.user_mute_all

Mutes notifications for a user

Parameters
Parameter Purpose Default Required?
mute Mute notifications True No
sessionkey A session key returned from login Yes
Back to top

network.create_tag

Create a tag specified by tag_data properties. The tag will either be created anew or moved from the inventory, if it exists there.

Tag details are specified as following:

{
tag_number: str - tag number encoded as string
tag_system: str - tag system. this field can be one of two values: mifare or ti
customer: Optional[str] - the UID of customer that the new tag will be assigned to
tag_type: int - tag type. Allowed values:
1 (Tag)
2 (Card)
3 (Odometer required)
4 (UID requied)
5 (UID and Odometer required)
credit_type: str. Allowed values:
'CASH'
'VOLUME'
product_mask: list[int] - List of product types to support
pin: Optional[str]
suspended: bool
daily_limits: list[tuple[int, Optional[int]]]
metered_product_daily_limit: Optional[int]
vehicle_reg: str
vehicle_model: str
vehicle_fleet_no: str
}

Parameters
Parameter Purpose Default Required?
network_uid The uid of the network Yes
sessionkey A session key returned from login Yes
tag_data Tag data Yes
Back to top

network.get_network_tags

Get tag objects that belong to a network specified by network_uid.

This method returns the following response:

[
tag_detail,
tag_detail,
...
]

where tag_detail is the same response as in hydip.get_tag_detail, i.e.:

{
"tag": <string>
"tag_id": <string, identifier for tag to be used in queries>,

...

and so on
}

Parameters
Parameter Purpose Default Required?
limit Number of results per page; Optional, defaults to null null No
network_uid The uid of the network Yes
page 1-indexed page number; Optional, defaults to null null No
search_query Tag number to search for null No
sessionkey A session key returned from login Yes
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)

Parameters
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>
}

Parameters
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)

Parameters
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
network_uid The uid of the network null 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)
"driver_ids": <list of allowed driver ids>
}

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

Parameters
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

network.remove_tag

Unassigns the tag from network

Parameters
Parameter Purpose Default Required?
network_uid The uid of the network Yes
sessionkey A session key returned from login Yes
tag_uid The uid of the tag Yes
Back to top

networks.get_networks

Get a list of networks.

Returned in the followed format:

[
{
"name": <Network name>,
"key": <Company key>
}
]

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

networks.get_product_types

Gets all product types as enum labels and values in a dict. If a session key is given, the product names will be returned for the associated network, otherwise global names will be returned.

Parameters
Parameter Purpose Default Required?
sessionkey The sessionkey (optional) Yes
Back to top

pricezones.get_pricezone

Get price zone for a given network.

Returns the following:

{
"key": <price zone key>,
"name": <price zone name>,
"prices": {
"<product name>": "<price or empty string>"
},
"prices_enum": {
"<product enum>": "<price or empty string>"
},
}

Prices are encoded as a strings (to avoid floating point error). An empty string indicates a null price (i.e. no price set).

Parameters
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

Get pricezones for a given network.

Returns a list of objects for each price zone, in the following format:

[
{
"key": <price zone uid>,
"name": <price zone name>,
"prices": {
<product name>: <product price>
},
"prices_enum": {
<product enum>: <product price>
}
}
]

Prices are encoded as a strings (to avoid floating point error). An empty string indicates a null price (i.e. no price set).

Parameters
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 should be an object which maps the product on to the price.

The product should be an integer product enumeration. The price should be a string containing a price to three decimal places.

The product may also be string containing the product name, i.e. "diesel", but this is for backwards compatibility only.

Products not included in price_data will be left unchanged.

Return value is always True.

Parameters
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 pricezone to update Yes
sessionkey A session key returned from login Yes
Back to top

sites.get_site_groups

Parameters
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

sites.get_site_objects

Parameters
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

Parameters
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_sites_in_range

Get the sites within a given radius from a location.

Response is the same as get_sites with the following additions:

"distance" is the distance to the site in km

"tanks" is a list of tanks in the site, exposing "name", "key", "product", "last_sample_time", and "last_sample_level"

"devices" is a list of the devices in a site, exposing "name", "key" and "gps"

Parameters
Parameter Purpose Default Required?
company_key The uid of the company Yes
latitude Latitude of a location Yes
longitude Longitude of a location Yes
network_key The uid of the network Yes
radius Radius (in km) to search for sites 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_sites_with_objects_gps

Gets a list of sites in a network, and the gps coords of the site, devices and tanks

Parameters
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

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.

Parameters
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

Parameters
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

tanks.get_latest_samples

Get latest samples for all tanks the user has access to.

Return value is a mapping of tank key to a list of two values, containing sample time and sample level.

{
<tank key>: [<sample time>, <sample level>],
etc...
}

The sample pairs may also be [null, null] if the tank has never recorded a sample.

Parameters
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
tank_group_key The uid of the tank group (optional) null No
Back to top

tanks.get_tank_groups

Gets the tank groups that the user has permission to see

Parameters
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

tanks.get_tanks

Get tank objects for network and company

Parameters
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
tank_group_key The uid of the tank group (optional) null No
Back to top