NAV Navbar
python js

Introduction

Welcome to the BBOXX SMARTSolar API.

The SMARTSolar API is an interface designed to allow users to remotely and automatically control a BBOXX unit and access its information.

This document aims to provide a complete listing of the actions that a user can take, the data available in the SMARTSolar API and the schema and architecture of the API.

The different sections of the Documentation are as follows:

Schema

This section describes the full schema of the SMARTSolar Database.

You can find listings of every table and the relationships between objects as well as information on how to query, create and modifiy information via the API.

Action Type

Contains details of the types of Action that a technician can take during a repair

The action_type object

Field Description
action_type_id
int (primary key)
A unique integer identifier for each action_type.
name
string (not-null,unique)
description
string
label
string (not-null,unique)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
action_type_product_type_linker The associated action_type_product_type_linker
repair_action_type_linker The associated repair_action_type_linker



An example POST request. Note that action_type_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/action_types"
    data = json.dumps({
        "name": "test",
        "description": "test",
        "label": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "action_type_id": 1
        "name": "test",
        "description": "test",
        "label": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the action_type created by specifying its action_type_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/action_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "action_type_id": 1
        "name": "test",
        "description": "test",
        "label": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all action_types by omitting the action_type_id:

    url = 'https://smartapi.bboxx.co.uk/v1/action_types'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created action_type with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/action_types/1'
    data = json.dumps({
        "name": "changed",
        "description": "changed",
        "label": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "action_type_id": 1
        "name": "changed",
        "description": "changed",
        "label": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the action_type

    url = 'https://smartapi.bboxx.co.uk/v1/action_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/action_types
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the action_type that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/action_types or /v1/action_types/<action_type_id>
method GET
url_params action_type_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/action_types/<action_type_id>
method PUT
url_params action_type_id of the action_type you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/action_types/<action_type_id>
method DELETE
url_params action_type_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Action Type Product Type Linker

Specifies which action-types can be taken on each product-type during a repair.

The action_type_product_type_linker object

Field Description
action_type_product_type_linker_id
int (primary key)
A unique integer identifier for each action_type_product_type_linker.
product_type_id
int (not-null,foreign-key)
action_type_id
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that action_type_product_type_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/action_type_product_type_linker"
    data = json.dumps({
        "product_type_id": 1,
        "action_type_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "action_type_product_type_linker_id": 1
        "product_type_id": 1,
        "action_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the action_type_product_type_linker created by specifying its action_type_product_type_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/action_type_product_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "action_type_product_type_linker_id": 1
        "product_type_id": 1,
        "action_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all action_type_product_type_linker by omitting the action_type_product_type_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/action_type_product_type_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created action_type_product_type_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/action_type_product_type_linker/1'
    data = json.dumps({
        "product_type_id": 2,
        "action_type_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "action_type_product_type_linker_id": 1
        "product_type_id": 2,
        "action_type_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the action_type_product_type_linker

    url = 'https://smartapi.bboxx.co.uk/v1/action_type_product_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/action_type_product_type_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the action_type_product_type_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/action_type_product_type_linker or /v1/action_type_product_type_linker/<action_type_product_type_linker_id>
method GET
url_params action_type_product_type_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/action_type_product_type_linker/<action_type_product_type_linker_id>
method PUT
url_params action_type_product_type_linker_id of the action_type_product_type_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/action_type_product_type_linker/<action_type_product_type_linker_id>
method DELETE
url_params action_type_product_type_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Alert

Contains all of the alerts that exist for each product.

The alert object

Field Description
alert_id
int (primary key)
A unique integer identifier for each alert.
product_imei
varchar(15) (not-null,foreign-key)
alert_type_id
int (not-null,foreign-key)
start_time
datetime
dismissed_at
datetime
dismissed_by
string
dismissal_reason
string
repair_id
int (foreign-key)
extra_info
string
customer_contact_date
datetime
customer_contact_type
string

options: ["visit", "sms", "phone"]
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that alert_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/alerts"
    data = json.dumps({
        "product_imei": "000000000000000",
        "alert_type_id": 1,
        "start_time": "2000-01-01 00:00:00",
        "dismissed_at": "2000-01-01 00:00:00",
        "dismissed_by": "test",
        "dismissal_reason": "test",
        "repair_id": 1,
        "extra_info": "test",
        "customer_contact_date": "2000-01-01 00:00:00",
        "customer_contact_type": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "alert_id": 1
        "product_imei": "000000000000000",
        "alert_type_id": 1,
        "start_time": "2000-01-01 00:00:00",
        "dismissed_at": "2000-01-01 00:00:00",
        "dismissed_by": "test",
        "dismissal_reason": "test",
        "repair_id": 1,
        "extra_info": "test",
        "customer_contact_date": "2000-01-01 00:00:00",
        "customer_contact_type": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the alert created by specifying its alert_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/alerts/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "alert_id": 1
        "product_imei": "000000000000000",
        "alert_type_id": 1,
        "start_time": "2000-01-01 00:00:00",
        "dismissed_at": "2000-01-01 00:00:00",
        "dismissed_by": "test",
        "dismissal_reason": "test",
        "repair_id": 1,
        "extra_info": "test",
        "customer_contact_date": "2000-01-01 00:00:00",
        "customer_contact_type": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all alerts by omitting the alert_id:

    url = 'https://smartapi.bboxx.co.uk/v1/alerts'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created alert with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/alerts/1'
    data = json.dumps({
        "product_imei": "999999999999999",
        "alert_type_id": 2,
        "start_time": "2016-07-01 12:34:45",
        "dismissed_at": "2016-07-01 12:34:45",
        "dismissed_by": "changed",
        "dismissal_reason": "changed",
        "repair_id": 2,
        "extra_info": "changed",
        "customer_contact_date": "2016-07-01 12:34:45",
        "customer_contact_type": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "alert_id": 1
        "product_imei": "999999999999999",
        "alert_type_id": 2,
        "start_time": "2016-07-01 12:34:45",
        "dismissed_at": "2016-07-01 12:34:45",
        "dismissed_by": "changed",
        "dismissal_reason": "changed",
        "repair_id": 2,
        "extra_info": "changed",
        "customer_contact_date": "2016-07-01 12:34:45",
        "customer_contact_type": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the alert

    url = 'https://smartapi.bboxx.co.uk/v1/alerts/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/alerts
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the alert that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/alerts or /v1/alerts/<alert_id>
method GET
url_params alert_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/alerts/<alert_id>
method PUT
url_params alert_id of the alert you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/alerts/<alert_id>
method DELETE
url_params alert_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Alert Type

Contains details of the different alert-types that can be raised.

The alert_type object

Field Description
alert_type_id
int (primary key)
A unique integer identifier for each alert_type.
name
string (not-null)
version
int (not-null)
category
string
purpose
string
message
string
status
string (not-null)
severity
string
analysis_frequency
datetime (not-null)
cooling_off_period
datetime
active
boolean (not-null)
label
string (not-null,unique)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
alerts The associated alerts
alert_type_entity_anti_linker The associated alert_type_entity_anti_linker
alert_type_product_type_linker The associated alert_type_product_type_linker
analysis_histories The associated analysis_histories
alert_type_state_type_linker The associated alert_type_state_type_linker



An example POST request. Note that alert_type_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/alert_types"
    data = json.dumps({
        "name": "test",
        "version": 1,
        "category": "test",
        "purpose": "test",
        "message": "test",
        "status": "test",
        "severity": "test",
        "analysis_frequency": "2000-01-01 00:00:00",
        "cooling_off_period": "2000-01-01 00:00:00",
        "active": True,
        "label": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "alert_type_id": 1
        "name": "test",
        "version": 1,
        "category": "test",
        "purpose": "test",
        "message": "test",
        "status": "test",
        "severity": "test",
        "analysis_frequency": "2000-01-01 00:00:00",
        "cooling_off_period": "2000-01-01 00:00:00",
        "active": True,
        "label": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the alert_type created by specifying its alert_type_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/alert_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "alert_type_id": 1
        "name": "test",
        "version": 1,
        "category": "test",
        "purpose": "test",
        "message": "test",
        "status": "test",
        "severity": "test",
        "analysis_frequency": "2000-01-01 00:00:00",
        "cooling_off_period": "2000-01-01 00:00:00",
        "active": True,
        "label": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all alert_types by omitting the alert_type_id:

    url = 'https://smartapi.bboxx.co.uk/v1/alert_types'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created alert_type with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/alert_types/1'
    data = json.dumps({
        "name": "changed",
        "version": 2,
        "category": "changed",
        "purpose": "changed",
        "message": "changed",
        "status": "changed",
        "severity": "changed",
        "analysis_frequency": "2016-07-01 12:34:45",
        "cooling_off_period": "2016-07-01 12:34:45",
        "active": False,
        "label": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "alert_type_id": 1
        "name": "changed",
        "version": 2,
        "category": "changed",
        "purpose": "changed",
        "message": "changed",
        "status": "changed",
        "severity": "changed",
        "analysis_frequency": "2016-07-01 12:34:45",
        "cooling_off_period": "2016-07-01 12:34:45",
        "active": False,
        "label": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the alert_type

    url = 'https://smartapi.bboxx.co.uk/v1/alert_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/alert_types
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the alert_type that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/alert_types or /v1/alert_types/<alert_type_id>
method GET
url_params alert_type_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/alert_types/<alert_type_id>
method PUT
url_params alert_type_id of the alert_type you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/alert_types/<alert_type_id>
method DELETE
url_params alert_type_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Alert Type Entity Anti Linker

Specifies which alert-types can be raised on each entity

The alert_type_entity_anti_linker object

Field Description
alert_type_entity_anti_linker_id
int (primary key)
A unique integer identifier for each alert_type_entity_anti_linker.
alert_type_id
int (not-null,foreign-key)
entity_id
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that alert_type_entity_anti_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/alert_type_entity_anti_linker"
    data = json.dumps({
        "alert_type_id": 1,
        "entity_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "alert_type_entity_anti_linker_id": 1
        "alert_type_id": 1,
        "entity_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the alert_type_entity_anti_linker created by specifying its alert_type_entity_anti_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/alert_type_entity_anti_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "alert_type_entity_anti_linker_id": 1
        "alert_type_id": 1,
        "entity_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all alert_type_entity_anti_linker by omitting the alert_type_entity_anti_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/alert_type_entity_anti_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created alert_type_entity_anti_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/alert_type_entity_anti_linker/1'
    data = json.dumps({
        "alert_type_id": 2,
        "entity_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "alert_type_entity_anti_linker_id": 1
        "alert_type_id": 2,
        "entity_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the alert_type_entity_anti_linker

    url = 'https://smartapi.bboxx.co.uk/v1/alert_type_entity_anti_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/alert_type_entity_anti_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the alert_type_entity_anti_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/alert_type_entity_anti_linker or /v1/alert_type_entity_anti_linker/<alert_type_entity_anti_linker_id>
method GET
url_params alert_type_entity_anti_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/alert_type_entity_anti_linker/<alert_type_entity_anti_linker_id>
method PUT
url_params alert_type_entity_anti_linker_id of the alert_type_entity_anti_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/alert_type_entity_anti_linker/<alert_type_entity_anti_linker_id>
method DELETE
url_params alert_type_entity_anti_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Alert Type Product Type Linker

Specifies which alert-types can be raised on each product-types

The alert_type_product_type_linker object

Field Description
alert_type_product_type_linker_id
int (primary key)
A unique integer identifier for each alert_type_product_type_linker.
alert_type_id
int (not-null,foreign-key)
product_type_id
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that alert_type_product_type_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/alert_type_product_type_linker"
    data = json.dumps({
        "alert_type_id": 1,
        "product_type_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "alert_type_product_type_linker_id": 1
        "alert_type_id": 1,
        "product_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the alert_type_product_type_linker created by specifying its alert_type_product_type_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/alert_type_product_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "alert_type_product_type_linker_id": 1
        "alert_type_id": 1,
        "product_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all alert_type_product_type_linker by omitting the alert_type_product_type_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/alert_type_product_type_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created alert_type_product_type_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/alert_type_product_type_linker/1'
    data = json.dumps({
        "alert_type_id": 2,
        "product_type_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "alert_type_product_type_linker_id": 1
        "alert_type_id": 2,
        "product_type_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the alert_type_product_type_linker

    url = 'https://smartapi.bboxx.co.uk/v1/alert_type_product_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/alert_type_product_type_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the alert_type_product_type_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/alert_type_product_type_linker or /v1/alert_type_product_type_linker/<alert_type_product_type_linker_id>
method GET
url_params alert_type_product_type_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/alert_type_product_type_linker/<alert_type_product_type_linker_id>
method PUT
url_params alert_type_product_type_linker_id of the alert_type_product_type_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/alert_type_product_type_linker/<alert_type_product_type_linker_id>
method DELETE
url_params alert_type_product_type_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Alert Type State Type Linker

Specifies which alert-types can be raised on each state-types

The alert_type_state_type_linker object

Field Description
alert_type_state_type_linker_id
int (primary key)
A unique integer identifier for each alert_type_state_type_linker.
alert_type_id
int (not-null,foreign-key)
state_type_id
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that alert_type_state_type_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/alert_type_state_type_linker"
    data = json.dumps({
        "alert_type_id": 1,
        "state_type_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "alert_type_state_type_linker_id": 1
        "alert_type_id": 1,
        "state_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the alert_type_state_type_linker created by specifying its alert_type_state_type_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/alert_type_state_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "alert_type_state_type_linker_id": 1
        "alert_type_id": 1,
        "state_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all alert_type_state_type_linker by omitting the alert_type_state_type_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/alert_type_state_type_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created alert_type_state_type_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/alert_type_state_type_linker/1'
    data = json.dumps({
        "alert_type_id": 2,
        "state_type_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "alert_type_state_type_linker_id": 1
        "alert_type_id": 2,
        "state_type_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the alert_type_state_type_linker

    url = 'https://smartapi.bboxx.co.uk/v1/alert_type_state_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/alert_type_state_type_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the alert_type_state_type_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/alert_type_state_type_linker or /v1/alert_type_state_type_linker/<alert_type_state_type_linker_id>
method GET
url_params alert_type_state_type_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/alert_type_state_type_linker/<alert_type_state_type_linker_id>
method PUT
url_params alert_type_state_type_linker_id of the alert_type_state_type_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/alert_type_state_type_linker/<alert_type_state_type_linker_id>
method DELETE
url_params alert_type_state_type_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Analysis History

Records which analyses have been run on which units and at what time.

The analysis_history object

Field Description
analysis_history_id
int (primary key)
A unique integer identifier for each analysis_history.
product_imei
varchar(15) (not-null,foreign-key)
alert_type_id
int (not-null,foreign-key)
timestamp
datetime (not-null)
status
string (not-null)

options: ["success", "failure"]
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that analysis_history_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/analysis_history"
    data = json.dumps({
        "product_imei": "000000000000000",
        "alert_type_id": 1,
        "timestamp": "2000-01-01 00:00:00",
        "status": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "analysis_history_id": 1
        "product_imei": "000000000000000",
        "alert_type_id": 1,
        "timestamp": "2000-01-01 00:00:00",
        "status": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the analysis_history created by specifying its analysis_history_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/analysis_history/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "analysis_history_id": 1
        "product_imei": "000000000000000",
        "alert_type_id": 1,
        "timestamp": "2000-01-01 00:00:00",
        "status": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all analysis_history by omitting the analysis_history_id:

    url = 'https://smartapi.bboxx.co.uk/v1/analysis_history'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created analysis_history with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/analysis_history/1'
    data = json.dumps({
        "product_imei": "999999999999999",
        "alert_type_id": 2,
        "timestamp": "2016-07-01 12:34:45",
        "status": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "analysis_history_id": 1
        "product_imei": "999999999999999",
        "alert_type_id": 2,
        "timestamp": "2016-07-01 12:34:45",
        "status": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the analysis_history

    url = 'https://smartapi.bboxx.co.uk/v1/analysis_history/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/analysis_history
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the analysis_history that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/analysis_history or /v1/analysis_history/<analysis_history_id>
method GET
url_params analysis_history_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/analysis_history/<analysis_history_id>
method PUT
url_params analysis_history_id of the analysis_history you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/analysis_history/<analysis_history_id>
method DELETE
url_params analysis_history_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Appliance Action Type Appliance Type Linker

Determines which appliance-actions can be performed on which appliance-types

The appliance_action_type_appliance_type_linker object

Field Description
appliance_action_type_appliance_type_linker_id
int (primary key)
A unique integer identifier for each appliance_action_type_appliance_type_linker.
appliance_type_id
int (not-null,foreign-key)
appliance_action_type_id
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that appliance_action_type_appliance_type_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/appliance_action_type_appliance_type_linker"
    data = json.dumps({
        "appliance_type_id": 1,
        "appliance_action_type_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "appliance_action_type_appliance_type_linker_id": 1
        "appliance_type_id": 1,
        "appliance_action_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the appliance_action_type_appliance_type_linker created by specifying its appliance_action_type_appliance_type_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_action_type_appliance_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_action_type_appliance_type_linker_id": 1
        "appliance_type_id": 1,
        "appliance_action_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all appliance_action_type_appliance_type_linker by omitting the appliance_action_type_appliance_type_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_action_type_appliance_type_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created appliance_action_type_appliance_type_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_action_type_appliance_type_linker/1'
    data = json.dumps({
        "appliance_type_id": 2,
        "appliance_action_type_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_action_type_appliance_type_linker_id": 1
        "appliance_type_id": 2,
        "appliance_action_type_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the appliance_action_type_appliance_type_linker

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_action_type_appliance_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/appliance_action_type_appliance_type_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the appliance_action_type_appliance_type_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/appliance_action_type_appliance_type_linker or /v1/appliance_action_type_appliance_type_linker/<appliance_action_type_appliance_type_linker_id>
method GET
url_params appliance_action_type_appliance_type_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/appliance_action_type_appliance_type_linker/<appliance_action_type_appliance_type_linker_id>
method PUT
url_params appliance_action_type_appliance_type_linker_id of the appliance_action_type_appliance_type_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/appliance_action_type_appliance_type_linker/<appliance_action_type_appliance_type_linker_id>
method DELETE
url_params appliance_action_type_appliance_type_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Appliance Action Type

Listing possible actions that could be taken during an appliance repair.

The appliance_action_type object

Field Description
appliance_action_type_id
int (primary key)
A unique integer identifier for each appliance_action_type.
name
string (not-null,unique)
description
string
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
appliance_action_type_appliance_type_linker The associated appliance_action_type_appliance_type_linker
repair_action_type_linker The associated repair_action_type_linker



An example POST request. Note that appliance_action_type_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/appliance_action_types"
    data = json.dumps({
        "name": "test",
        "description": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "appliance_action_type_id": 1
        "name": "test",
        "description": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the appliance_action_type created by specifying its appliance_action_type_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_action_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_action_type_id": 1
        "name": "test",
        "description": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all appliance_action_types by omitting the appliance_action_type_id:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_action_types'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created appliance_action_type with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_action_types/1'
    data = json.dumps({
        "name": "changed",
        "description": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_action_type_id": 1
        "name": "changed",
        "description": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the appliance_action_type

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_action_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/appliance_action_types
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the appliance_action_type that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/appliance_action_types or /v1/appliance_action_types/<appliance_action_type_id>
method GET
url_params appliance_action_type_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/appliance_action_types/<appliance_action_type_id>
method PUT
url_params appliance_action_type_id of the appliance_action_type you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/appliance_action_types/<appliance_action_type_id>
method DELETE
url_params appliance_action_type_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Appliance Part Type Replacement Linker

Lists which part_types can replace which during an appliance repair.Can also be used to determine valid appliance part_types for an appliance

The appliance_part_type_replacement_linker object

Field Description
appliance_part_type_replacement_linker_id
int (primary key)
A unique integer identifier for each appliance_part_type_replacement_linker.
appliance_type_id
int (not-null,foreign-key)
existing_appliance_part_type_id
int (not-null,foreign-key)
max_part_count
int (default=1)
Maximum number of parts of this type that can be replaced for this appliance type
replacement_appliance_part_type_id
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that appliance_part_type_replacement_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/appliance_part_type_replacement_linker"
    data = json.dumps({
        "appliance_type_id": 1,
        "existing_appliance_part_type_id": 1,
        "replacement_appliance_part_type_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "appliance_part_type_replacement_linker_id": 1
        "appliance_type_id": 1,
        "existing_appliance_part_type_id": 1,
        "max_part_count": 1,
        "replacement_appliance_part_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the appliance_part_type_replacement_linker created by specifying its appliance_part_type_replacement_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_part_type_replacement_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_part_type_replacement_linker_id": 1
        "appliance_type_id": 1,
        "existing_appliance_part_type_id": 1,
        "max_part_count": 1,
        "replacement_appliance_part_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all appliance_part_type_replacement_linker by omitting the appliance_part_type_replacement_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_part_type_replacement_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created appliance_part_type_replacement_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_part_type_replacement_linker/1'
    data = json.dumps({
        "appliance_type_id": 2,
        "existing_appliance_part_type_id": 2,
        "replacement_appliance_part_type_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_part_type_replacement_linker_id": 1
        "appliance_type_id": 2,
        "existing_appliance_part_type_id": 2,
        "max_part_count": 1,
        "replacement_appliance_part_type_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the appliance_part_type_replacement_linker

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_part_type_replacement_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/appliance_part_type_replacement_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the appliance_part_type_replacement_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/appliance_part_type_replacement_linker or /v1/appliance_part_type_replacement_linker/<appliance_part_type_replacement_linker_id>
method GET
url_params appliance_part_type_replacement_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/appliance_part_type_replacement_linker/<appliance_part_type_replacement_linker_id>
method PUT
url_params appliance_part_type_replacement_linker_id of the appliance_part_type_replacement_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/appliance_part_type_replacement_linker/<appliance_part_type_replacement_linker_id>
method DELETE
url_params appliance_part_type_replacement_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Appliance Part Type

Lists the types of part that can be used during appliance repair

The appliance_part_type object

Field Description
appliance_part_type_id
int (primary key)
A unique integer identifier for each appliance_part_type.
name
string
description
string
erp_code
unknown-type
image
string
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
appliance_repair_appliance_type_linker The associated appliance_repair_appliance_type_linker



An example POST request. Note that appliance_part_type_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/appliance_part_types"
    data = json.dumps({
        "name": "test",
        "description": "test",
        "erp_code": Unknown column type,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "appliance_part_type_id": 1
        "name": "test",
        "description": "test",
        "erp_code": Unknown column type,
        "image": "DC+Shaver+V2/000.png",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the appliance_part_type created by specifying its appliance_part_type_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_part_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_part_type_id": 1
        "name": "test",
        "description": "test",
        "erp_code": Unknown column type,
        "image": "DC+Shaver+V2/000.png",
        "created_at": "2000-01-01 00:00:00",
        "created_by": "test.user@bboxx.co.uk",
        "modified_at": None
    }

We can retrieve all appliance_part_types by omitting the appliance_part_type_id:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_part_types'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created appliance_part_type with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_part_types/1'
    data = json.dumps({
        "name": "changed",
        "description": "changed",
        "erp_code": Unknown column type,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_part_type_id": 1
        "name": "changed",
        "description": "changed",
        "erp_code": Unknown column type,
        "image": "DC+Shaver+V2/000.png",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the appliance_part_type

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_part_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/appliance_part_types
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the appliance_part_type that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/appliance_part_types or /v1/appliance_part_types/<appliance_part_type_id>
method GET
url_params appliance_part_type_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/appliance_part_types/<appliance_part_type_id>
method PUT
url_params appliance_part_type_id of the appliance_part_type you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/appliance_part_types/<appliance_part_type_id>
method DELETE
url_params appliance_part_type_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Appliance Repair Appliance Action Type Linker

Contains which appliance actions occured during each appliance repair

The appliance_repair_appliance_action_type_linker object

Field Description
appliance_repair_appliance_action_type_linker_id
int (primary key)
A unique integer identifier for each appliance_repair_appliance_action_type_linker.
appliance_repair_id
int (not-null,foreign-key)
appliance_action_type_id
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that appliance_repair_appliance_action_type_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_action_type_linker"
    data = json.dumps({
        "appliance_repair_id": 1,
        "appliance_action_type_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "appliance_repair_appliance_action_type_linker_id": 1
        "appliance_repair_id": 1,
        "appliance_action_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the appliance_repair_appliance_action_type_linker created by specifying its appliance_repair_appliance_action_type_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_action_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_repair_appliance_action_type_linker_id": 1
        "appliance_repair_id": 1,
        "appliance_action_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all appliance_repair_appliance_action_type_linker by omitting the appliance_repair_appliance_action_type_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_action_type_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created appliance_repair_appliance_action_type_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_action_type_linker/1'
    data = json.dumps({
        "appliance_repair_id": 2,
        "appliance_action_type_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_repair_appliance_action_type_linker_id": 1
        "appliance_repair_id": 2,
        "appliance_action_type_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the appliance_repair_appliance_action_type_linker

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_action_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/appliance_repair_appliance_action_type_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the appliance_repair_appliance_action_type_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/appliance_repair_appliance_action_type_linker or /v1/appliance_repair_appliance_action_type_linker/<appliance_repair_appliance_action_type_linker_id>
method GET
url_params appliance_repair_appliance_action_type_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/appliance_repair_appliance_action_type_linker/<appliance_repair_appliance_action_type_linker_id>
method PUT
url_params appliance_repair_appliance_action_type_linker_id of the appliance_repair_appliance_action_type_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/appliance_repair_appliance_action_type_linker/<appliance_repair_appliance_action_type_linker_id>
method DELETE
url_params appliance_repair_appliance_action_type_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Appliance Repair Appliance Part Type Linker

Lists the appliance part_types that were used in a given appliance_repair

The appliance_repair_appliance_part_type_linker object

Field Description
appliance_repair_appliance_part_type_linker_id
int (primary key)
A unique integer identifier for each appliance_repair_appliance_part_type_linker.
appliance_repair_id
int (not-null,foreign-key)
old_appliance_part_type_id
int (not-null,foreign-key)
new_appliance_part_type_id
int (foreign-key)
repaired_parts_count
int
Number of parts of this type replaced in this repair
requested_date
datetime
replaced_date
datetime
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that appliance_repair_appliance_part_type_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_part_type_linker"
    data = json.dumps({
        "appliance_repair_id": 1,
        "old_appliance_part_type_id": 1,
        "new_appliance_part_type_id": 1,
        "requested_date": "2000-01-01 00:00:00",
        "replaced_date": "2000-01-01 00:00:00",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "appliance_repair_appliance_part_type_linker_id": 1
        "appliance_repair_id": 1,
        "old_appliance_part_type_id": 1,
        "new_appliance_part_type_id": 1,
        "repaired_parts_count": 1,
        "requested_date": "2000-01-01 00:00:00",
        "replaced_date": "2000-01-01 00:00:00",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the appliance_repair_appliance_part_type_linker created by specifying its appliance_repair_appliance_part_type_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_part_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_repair_appliance_part_type_linker_id": 1
        "appliance_repair_id": 1,
        "old_appliance_part_type_id": 1,
        "new_appliance_part_type_id": 1,
        "repaired_parts_count": 1,
        "requested_date": "2000-01-01 00:00:00",
        "replaced_date": "2000-01-01 00:00:00",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all appliance_repair_appliance_part_type_linker by omitting the appliance_repair_appliance_part_type_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_part_type_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created appliance_repair_appliance_part_type_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_part_type_linker/1'
    data = json.dumps({
        "appliance_repair_id": 2,
        "old_appliance_part_type_id": 2,
        "new_appliance_part_type_id": 2,
        "requested_date": "2016-07-01 12:34:45",
        "replaced_date": "2016-07-01 12:34:45",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_repair_appliance_part_type_linker_id": 1
        "appliance_repair_id": 2,
        "old_appliance_part_type_id": 2,
        "new_appliance_part_type_id": 2,
        "repaired_parts_count": 1,
        "requested_date": "2016-07-01 12:34:45",
        "replaced_date": "2016-07-01 12:34:45",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the appliance_repair_appliance_part_type_linker

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_part_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/appliance_repair_appliance_part_type_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the appliance_repair_appliance_part_type_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/appliance_repair_appliance_part_type_linker or /v1/appliance_repair_appliance_part_type_linker/<appliance_repair_appliance_part_type_linker_id>
method GET
url_params appliance_repair_appliance_part_type_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/appliance_repair_appliance_part_type_linker/<appliance_repair_appliance_part_type_linker_id>
method PUT
url_params appliance_repair_appliance_part_type_linker_id of the appliance_repair_appliance_part_type_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/appliance_repair_appliance_part_type_linker/<appliance_repair_appliance_part_type_linker_id>
method DELETE
url_params appliance_repair_appliance_part_type_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Appliance Repair Appliance Symptom Linker

Lists the symptoms that a particular appliance had for a particular repair

The appliance_repair_appliance_symptom_linker object

Field Description
appliance_repair_appliance_symptom_linker_id
int (primary key)
A unique integer identifier for each appliance_repair_appliance_symptom_linker.
appliance_repair_id
int (foreign-key)
appliance_symptom_id
int (foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that appliance_repair_appliance_symptom_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_symptom_linker"
    data = json.dumps({
        "appliance_repair_id": 1,
        "appliance_symptom_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "appliance_repair_appliance_symptom_linker_id": 1
        "appliance_repair_id": 1,
        "appliance_symptom_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the appliance_repair_appliance_symptom_linker created by specifying its appliance_repair_appliance_symptom_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_symptom_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_repair_appliance_symptom_linker_id": 1
        "appliance_repair_id": 1,
        "appliance_symptom_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all appliance_repair_appliance_symptom_linker by omitting the appliance_repair_appliance_symptom_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_symptom_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created appliance_repair_appliance_symptom_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_symptom_linker/1'
    data = json.dumps({
        "appliance_repair_id": 2,
        "appliance_symptom_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_repair_appliance_symptom_linker_id": 1
        "appliance_repair_id": 2,
        "appliance_symptom_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the appliance_repair_appliance_symptom_linker

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repair_appliance_symptom_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/appliance_repair_appliance_symptom_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the appliance_repair_appliance_symptom_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/appliance_repair_appliance_symptom_linker or /v1/appliance_repair_appliance_symptom_linker/<appliance_repair_appliance_symptom_linker_id>
method GET
url_params appliance_repair_appliance_symptom_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/appliance_repair_appliance_symptom_linker/<appliance_repair_appliance_symptom_linker_id>
method PUT
url_params appliance_repair_appliance_symptom_linker_id of the appliance_repair_appliance_symptom_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/appliance_repair_appliance_symptom_linker/<appliance_repair_appliance_symptom_linker_id>
method DELETE
url_params appliance_repair_appliance_symptom_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Appliance Repair

Lists repairs of BBOXX appliances

The appliance_repair object

Field Description
appliance_repair_id
int (primary key)
A unique integer identifier for each appliance_repair.
appliance_id
int (not-null,foreign-key)
arrival_date
date
refurbishment_date
date
pending_status
boolean
process
string

options: ["Repair and Return", "Replaced", "Repossessed", "Broken on Arrival"]
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
replacements The associated replacements
symptoms The associated symptoms
appliance_action_types The associated appliance_action_types



An example POST request. Note that appliance_repair_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/appliance_repairs"
    data = json.dumps({
        "appliance_id": 1,
        "arrival_date": "2000-01-01 00:00:00",
        "refurbishment_date": "2000-01-01 00:00:00",
        "pending_status": True,
        "process": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "appliance_repair_id": 1
        "appliance_id": 1,
        "arrival_date": "2000-01-01 00:00:00",
        "refurbishment_date": "2000-01-01 00:00:00",
        "pending_status": True,
        "process": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the appliance_repair created by specifying its appliance_repair_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repairs/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_repair_id": 1
        "appliance_id": 1,
        "arrival_date": "2000-01-01 00:00:00",
        "refurbishment_date": "2000-01-01 00:00:00",
        "pending_status": True,
        "process": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all appliance_repairs by omitting the appliance_repair_id:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repairs'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created appliance_repair with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repairs/1'
    data = json.dumps({
        "appliance_id": 2,
        "arrival_date": "2000-01-01 00:00:00",
        "refurbishment_date": "2000-01-01 00:00:00",
        "pending_status": False,
        "process": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_repair_id": 1
        "appliance_id": 2,
        "arrival_date": "2000-01-01 00:00:00",
        "refurbishment_date": "2000-01-01 00:00:00",
        "pending_status": False,
        "process": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the appliance_repair

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_repairs/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/appliance_repairs
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the appliance_repair that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/appliance_repairs or /v1/appliance_repairs/<appliance_repair_id>
method GET
url_params appliance_repair_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/appliance_repairs/<appliance_repair_id>
method PUT
url_params appliance_repair_id of the appliance_repair you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/appliance_repairs/<appliance_repair_id>
method DELETE
url_params appliance_repair_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Appliance

Lists the appliances that BBOXX handles.Appliances can be 'tracked' (known serial) or 'untracked' (invented serial)

The appliance object

Field Description
appliance_id
int (primary key)
A unique integer identifier for each appliance.
appliance_type_id
int (not-null,foreign-key)
serial_number
string (unique)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
appliance_repairs The associated appliance_repairs



An example POST request. Note that appliance_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/appliances"
    data = json.dumps({
        "appliance_type_id": 1,
        "serial_number": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "appliance_id": 1
        "appliance_type_id": 1,
        "serial_number": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the appliance created by specifying its appliance_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/appliances/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_id": 1
        "appliance_type_id": 1,
        "serial_number": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all appliances by omitting the appliance_id:

    url = 'https://smartapi.bboxx.co.uk/v1/appliances'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created appliance with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/appliances/1'
    data = json.dumps({
        "appliance_type_id": 2,
        "serial_number": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_id": 1
        "appliance_type_id": 2,
        "serial_number": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the appliance

    url = 'https://smartapi.bboxx.co.uk/v1/appliances/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/appliances
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the appliance that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/appliances or /v1/appliances/<appliance_id>
method GET
url_params appliance_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/appliances/<appliance_id>
method PUT
url_params appliance_id of the appliance you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/appliances/<appliance_id>
method DELETE
url_params appliance_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Appliance Symptom Appliance Type Linker

Lists the symptoms that a particular appliance can have.

The appliance_symptom_appliance_type_linker object

Field Description
appliance_symptom_appliance_type_linker_id
int (primary key)
A unique integer identifier for each appliance_symptom_appliance_type_linker.
appliance_type_id
int (foreign-key)
appliance_symptom_id
int (foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that appliance_symptom_appliance_type_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/appliance_symptom_appliance_type_linker"
    data = json.dumps({
        "appliance_type_id": 1,
        "appliance_symptom_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "appliance_symptom_appliance_type_linker_id": 1
        "appliance_type_id": 1,
        "appliance_symptom_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the appliance_symptom_appliance_type_linker created by specifying its appliance_symptom_appliance_type_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_symptom_appliance_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_symptom_appliance_type_linker_id": 1
        "appliance_type_id": 1,
        "appliance_symptom_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all appliance_symptom_appliance_type_linker by omitting the appliance_symptom_appliance_type_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_symptom_appliance_type_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created appliance_symptom_appliance_type_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_symptom_appliance_type_linker/1'
    data = json.dumps({
        "appliance_type_id": 2,
        "appliance_symptom_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_symptom_appliance_type_linker_id": 1
        "appliance_type_id": 2,
        "appliance_symptom_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the appliance_symptom_appliance_type_linker

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_symptom_appliance_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/appliance_symptom_appliance_type_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the appliance_symptom_appliance_type_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/appliance_symptom_appliance_type_linker or /v1/appliance_symptom_appliance_type_linker/<appliance_symptom_appliance_type_linker_id>
method GET
url_params appliance_symptom_appliance_type_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/appliance_symptom_appliance_type_linker/<appliance_symptom_appliance_type_linker_id>
method PUT
url_params appliance_symptom_appliance_type_linker_id of the appliance_symptom_appliance_type_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/appliance_symptom_appliance_type_linker/<appliance_symptom_appliance_type_linker_id>
method DELETE
url_params appliance_symptom_appliance_type_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Appliance Symptom

Lists the possible symptoms that a BBOXX appliance could have.

The appliance_symptom object

Field Description
appliance_symptom_id
int (primary key)
A unique integer identifier for each appliance_symptom.
name
string (unique)
description
string
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
appliance_symptom_appliance_type_linker The associated appliance_symptom_appliance_type_linker
appliance_repair_appliance_symptom_linker The associated appliance_repair_appliance_symptom_linker



An example POST request. Note that appliance_symptom_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/appliance_symptoms"
    data = json.dumps({
        "name": "test",
        "description": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "appliance_symptom_id": 1
        "name": "test",
        "description": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the appliance_symptom created by specifying its appliance_symptom_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_symptoms/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_symptom_id": 1
        "name": "test",
        "description": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all appliance_symptoms by omitting the appliance_symptom_id:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_symptoms'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created appliance_symptom with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_symptoms/1'
    data = json.dumps({
        "name": "changed",
        "description": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_symptom_id": 1
        "name": "changed",
        "description": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the appliance_symptom

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_symptoms/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/appliance_symptoms
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the appliance_symptom that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/appliance_symptoms or /v1/appliance_symptoms/<appliance_symptom_id>
method GET
url_params appliance_symptom_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/appliance_symptoms/<appliance_symptom_id>
method PUT
url_params appliance_symptom_id of the appliance_symptom you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/appliance_symptoms/<appliance_symptom_id>
method DELETE
url_params appliance_symptom_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Appliance Type

Lists the types of appliance that BBOXX handles.

The appliance_type object

Field Description
appliance_type_id
int (primary key)
A unique integer identifier for each appliance_type.
category
string
name
string (unique)
description
string
erp_code
unknown-type (unique)
tracked
boolean
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
appliances The associated appliances
symptoms The associated symptoms
actions The associated actions



An example POST request. Note that appliance_type_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/appliance_types"
    data = json.dumps({
        "category": "test",
        "name": "test",
        "description": "test",
        "erp_code": Unknown column type,
        "tracked": True,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "appliance_type_id": 1
        "category": "test",
        "name": "test",
        "description": "test",
        "erp_code": Unknown column type,
        "tracked": True,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the appliance_type created by specifying its appliance_type_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_type_id": 1
        "category": "test",
        "name": "test",
        "description": "test",
        "erp_code": Unknown column type,
        "tracked": True,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all appliance_types by omitting the appliance_type_id:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_types'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created appliance_type with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_types/1'
    data = json.dumps({
        "category": "changed",
        "name": "changed",
        "description": "changed",
        "erp_code": Unknown column type,
        "tracked": False,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "appliance_type_id": 1
        "category": "changed",
        "name": "changed",
        "description": "changed",
        "erp_code": Unknown column type,
        "tracked": False,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the appliance_type

    url = 'https://smartapi.bboxx.co.uk/v1/appliance_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/appliance_types
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the appliance_type that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/appliance_types or /v1/appliance_types/<appliance_type_id>
method GET
url_params appliance_type_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/appliance_types/<appliance_type_id>
method PUT
url_params appliance_type_id of the appliance_type you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/appliance_types/<appliance_type_id>
method DELETE
url_params appliance_type_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Balance

Most recent balance remaining on each DCM unit.

The balance object

Field Description
balance_id
int (primary key)
A unique integer identifier for each balance.
product_imei
varchar(15) (not-null,foreign-key)
balance
int (not-null)
expected_expiry
datetime (not-null)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

We can retrieve the balance created by specifying its balance_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/balances/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "balance_id": 1
        "product_imei": "000000000000000",
        "balance": 1,
        "expected_expiry": "2000-01-01 00:00:00",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all balances by omitting the balance_id:

    url = 'https://smartapi.bboxx.co.uk/v1/balances'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/balances or /v1/balances/<balance_id>
method GET
url_params balance_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Battery Test Result

Test results from the BBOXX Battery Test

The battery_test_result object

Field Description
battery_test_result_id
int (primary key)
A unique integer identifier for each battery_test_result.
product_imei
varchar(15) (not-null,foreign-key)
type
string (not-null)
result
string (not-null)
problem
string
message
string
lvd_time
datetime
energy
float
battery_part_id
int (foreign-key)
repair_workflow_event_id
int (foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that battery_test_result_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/battery_test_results"
    data = json.dumps({
        "product_imei": "000000000000000",
        "type": "test",
        "result": "test",
        "problem": "test",
        "message": "test",
        "lvd_time": "2000-01-01 00:00:00",
        "energy": 1.0,
        "battery_part_id": 1,
        "repair_workflow_event_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "battery_test_result_id": 1
        "product_imei": "000000000000000",
        "type": "test",
        "result": "test",
        "problem": "test",
        "message": "test",
        "lvd_time": "2000-01-01 00:00:00",
        "energy": 1.0,
        "battery_part_id": 1,
        "repair_workflow_event_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the battery_test_result created by specifying its battery_test_result_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/battery_test_results/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "battery_test_result_id": 1
        "product_imei": "000000000000000",
        "type": "test",
        "result": "test",
        "problem": "test",
        "message": "test",
        "lvd_time": "2000-01-01 00:00:00",
        "energy": 1.0,
        "battery_part_id": 1,
        "repair_workflow_event_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all battery_test_results by omitting the battery_test_result_id:

    url = 'https://smartapi.bboxx.co.uk/v1/battery_test_results'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created battery_test_result with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/battery_test_results/1'
    data = json.dumps({
        "product_imei": "999999999999999",
        "type": "changed",
        "result": "changed",
        "problem": "changed",
        "message": "changed",
        "lvd_time": "2016-07-01 12:34:45",
        "energy": 2.0,
        "battery_part_id": 2,
        "repair_workflow_event_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "battery_test_result_id": 1
        "product_imei": "999999999999999",
        "type": "changed",
        "result": "changed",
        "problem": "changed",
        "message": "changed",
        "lvd_time": "2016-07-01 12:34:45",
        "energy": 2.0,
        "battery_part_id": 2,
        "repair_workflow_event_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the battery_test_result

    url = 'https://smartapi.bboxx.co.uk/v1/battery_test_results/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/battery_test_results
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the battery_test_result that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/battery_test_results or /v1/battery_test_results/<battery_test_result_id>
method GET
url_params battery_test_result_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/battery_test_results/<battery_test_result_id>
method PUT
url_params battery_test_result_id of the battery_test_result you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/battery_test_results/<battery_test_result_id>
method DELETE
url_params battery_test_result_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Channel

A table containing a list of available channels to subscribe to our API service

The channel object

Field Description
name
string (primary key)
A unique integer identifier for each channel.
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that name, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/channels"
    data = json.dumps({
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "name": "000000000000000"
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the channel created by specifying its name in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/channels/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "name": "000000000000000"
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all channels by omitting the name:

    url = 'https://smartapi.bboxx.co.uk/v1/channels'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created channel with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/channels/1'
    data = json.dumps({
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "name": "000000000000000"
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the channel

    url = 'https://smartapi.bboxx.co.uk/v1/channels/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/channels
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the channel that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/channels or /v1/channels/<name>
method GET
url_params name (string)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/channels/<name>
method PUT
url_params name of the channel you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/channels/<name>
method DELETE
url_params name (string)
query params N/A
body N/A
permissions SYSTEM
response 204

Connection

Contains details of every connection that every product makes to the SMARTSolar Application.

The connection object

Field Description
connection_id
int (primary key)
A unique integer identifier for each connection.
product_imei
varchar(15) (foreign-key)
location_failed_flag
boolean (not-null)
date
datetime (not-null)
mcc
int
mnc
int
cell_1_lac
int
cell_1_cid
int
cell_1_signal
int
cell_1_mcc
int
cell_1_mnc
int
cell_2_lac
int
cell_2_cid
int
cell_2_signal
int
cell_2_mcc
int
cell_2_mnc
int
cell_3_lac
int
cell_3_cid
int
cell_3_signal
int
cell_3_mcc
int
cell_3_mnc
int
cell_4_lac
int
cell_4_cid
int
cell_4_signal
int
cell_4_mcc
int
cell_4_mnc
int
cell_5_lac
int
cell_5_cid
int
cell_5_signal
int
cell_5_mcc
int
cell_5_mnc
int
cell_6_lac
int
cell_6_cid
int
cell_6_signal
int
cell_6_mcc
int
cell_6_mnc
int
cell_7_lac
int
cell_7_cid
int
cell_7_signal
int
cell_7_mcc
int
cell_7_mnc
int
frequency
int
timing_advance
int
latitude
varchar(12)
longitude
varchar(12)
error_radius
int
address
string
country_code
int
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

We can retrieve the connection created by specifying its connection_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/connections/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "connection_id": 1
        "product_imei": "000000000000000",
        "location_failed_flag": True,
        "date": "2000-01-01 00:00:00",
        "mcc": 1,
        "mnc": 1,
        "cell_1_lac": 1,
        "cell_1_cid": 1,
        "cell_1_signal": 1,
        "cell_1_mcc": 1,
        "cell_1_mnc": 1,
        "cell_2_lac": 1,
        "cell_2_cid": 1,
        "cell_2_signal": 1,
        "cell_2_mcc": 1,
        "cell_2_mnc": 1,
        "cell_3_lac": 1,
        "cell_3_cid": 1,
        "cell_3_signal": 1,
        "cell_3_mcc": 1,
        "cell_3_mnc": 1,
        "cell_4_lac": 1,
        "cell_4_cid": 1,
        "cell_4_signal": 1,
        "cell_4_mcc": 1,
        "cell_4_mnc": 1,
        "cell_5_lac": 1,
        "cell_5_cid": 1,
        "cell_5_signal": 1,
        "cell_5_mcc": 1,
        "cell_5_mnc": 1,
        "cell_6_lac": 1,
        "cell_6_cid": 1,
        "cell_6_signal": 1,
        "cell_6_mcc": 1,
        "cell_6_mnc": 1,
        "cell_7_lac": 1,
        "cell_7_cid": 1,
        "cell_7_signal": 1,
        "cell_7_mcc": 1,
        "cell_7_mnc": 1,
        "frequency": 1,
        "timing_advance": 1,
        "latitude": "-1.111111111",
        "longitude": "-1.111111111",
        "error_radius": 1,
        "address": "test",
        "country_code": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all connections by omitting the connection_id:

    url = 'https://smartapi.bboxx.co.uk/v1/connections'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

If a user has SYSTEM permissions they can delete the connection

    url = 'https://smartapi.bboxx.co.uk/v1/connections/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/connections or /v1/connections/<connection_id>
method GET
url_params connection_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

value
endpoint /v1/connections/<connection_id>
method DELETE
url_params connection_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Default Energy Limit

Default energy_limits for each type of battery in each lifecycle state.

The default_energy_limit object

Field Description
default_energy_limit_id
int (primary key)
A unique integer identifier for each default_energy_limit.
battery_type_id
int (not-null,foreign-key)
state_type_id
int (not-null,foreign-key)
entity_id
int (foreign-key)
energy_limit
float (not-null)
max_energy_limit
float (not-null)
min_energy_limit
float (not-null)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

GET requests are not allowed at this endpoint

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

### GET GET requests are not allowed at this endpoint

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Enable History

Contains a history of the enable-state of every product

The enable_history object

Field Description
enable_history_id
int (primary key)
A unique integer identifier for each enable_history.
product_imei
varchar(15) (not-null,foreign-key)
prev_enable_state
string

options: ["pending_disabled", "pending_enabled", "init", "enabled", "disabled"]
current_enable_state
string (not-null)

options: ["pending_disabled", "pending_enabled", "init", "enabled", "disabled"]
user
string (not-null)
date
datetime (not-null)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
sms_history The associated sms_history



POST requests are not allowed at this endpoint

We can retrieve the enable_history created by specifying its enable_history_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/enable_history/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "enable_history_id": 1
        "product_imei": "000000000000000",
        "prev_enable_state": "test",
        "current_enable_state": "test",
        "user": "test",
        "date": "2000-01-01 00:00:00",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all enable_history by omitting the enable_history_id:

    url = 'https://smartapi.bboxx.co.uk/v1/enable_history'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

If a user has SYSTEM permissions they can delete the enable_history

    url = 'https://smartapi.bboxx.co.uk/v1/enable_history/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/enable_history or /v1/enable_history/<enable_history_id>
method GET
url_params enable_history_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

value
endpoint /v1/enable_history/<enable_history_id>
method DELETE
url_params enable_history_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Entity

Contains details of all of the entities who own BBOXX products

The entity object

Field Description
entity_id
int (primary key)
A unique integer identifier for each entity.
name
string (not-null,unique)
bboxx_company_flag
boolean (not-null)
tariff
string
financier
boolean
geic
string (unique)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
hubs The associated hubs
product_entity_linker The associated product_entity_linker
battery_type_energy_limits The associated battery_type_energy_limits



An example POST request. Note that entity_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/entities"
    data = json.dumps({
        "name": "test",
        "bboxx_company_flag": True,
        "tariff": "test",
        "financier": True,
        "geic": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "entity_id": 1
        "name": "test",
        "bboxx_company_flag": True,
        "tariff": "test",
        "financier": True,
        "geic": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the entity created by specifying its entity_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/entities/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "entity_id": 1
        "name": "test",
        "bboxx_company_flag": True,
        "tariff": "test",
        "financier": True,
        "geic": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all entities by omitting the entity_id:

    url = 'https://smartapi.bboxx.co.uk/v1/entities'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created entity with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/entities/1'
    data = json.dumps({
        "name": "changed",
        "bboxx_company_flag": False,
        "tariff": "changed",
        "financier": False,
        "geic": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "entity_id": 1
        "name": "changed",
        "bboxx_company_flag": False,
        "tariff": "changed",
        "financier": False,
        "geic": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the entity

    url = 'https://smartapi.bboxx.co.uk/v1/entities/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/entities
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the entity that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/entities or /v1/entities/<entity_id>
method GET
url_params entity_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/entities/<entity_id>
method PUT
url_params entity_id of the entity you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/entities/<entity_id>
method DELETE
url_params entity_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Entity Facility Linker

Indicates which entities have access to manufacturing and repair facilities

The entity_facility_linker object

Field Description
entity_facility_linker_id
int (primary key)
A unique integer identifier for each entity_facility_linker.
entity_id
int (not-null,unique,foreign-key)
Entity identifier
test_jig
boolean (not-null)
Indicates whether the Entity has access to a Test Jig tool
test_bench
boolean (not-null)
Indicates whether the Entity has access to a Test Bench tool
usb_diag_tool
boolean (not-null)
Indicates whether the Entity has access to a USB Diagnostic tool
rework_process
boolean (not-null)
Indicates whether the Entity can use the PCB Rework process
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that entity_facility_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/entity_facility_linker"
    data = json.dumps({
        "entity_id": 1,
        "test_jig": True,
        "test_bench": True,
        "usb_diag_tool": True,
        "rework_process": True,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "entity_facility_linker_id": 1
        "entity_id": 1,
        "test_jig": True,
        "test_bench": True,
        "usb_diag_tool": True,
        "rework_process": True,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the entity_facility_linker created by specifying its entity_facility_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/entity_facility_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "entity_facility_linker_id": 1
        "entity_id": 1,
        "test_jig": True,
        "test_bench": True,
        "usb_diag_tool": True,
        "rework_process": True,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all entity_facility_linker by omitting the entity_facility_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/entity_facility_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created entity_facility_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/entity_facility_linker/1'
    data = json.dumps({
        "entity_id": 2,
        "test_jig": False,
        "test_bench": False,
        "usb_diag_tool": False,
        "rework_process": False,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "entity_facility_linker_id": 1
        "entity_id": 2,
        "test_jig": False,
        "test_bench": False,
        "usb_diag_tool": False,
        "rework_process": False,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the entity_facility_linker

    url = 'https://smartapi.bboxx.co.uk/v1/entity_facility_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/entity_facility_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the entity_facility_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/entity_facility_linker or /v1/entity_facility_linker/<entity_facility_linker_id>
method GET
url_params entity_facility_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/entity_facility_linker/<entity_facility_linker_id>
method PUT
url_params entity_facility_linker_id of the entity_facility_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/entity_facility_linker/<entity_facility_linker_id>
method DELETE
url_params entity_facility_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Factory Log

Product logs from factory and repair centres. (Used to be stored in influx)

The factory_log object

Field Description
factory_log_id
int (primary key)
A unique integer identifier for each factory_log.
app_name
string (not-null)
product_imei
varchar(15)
repair_id
int (foreign-key)
timestamp
datetime (not-null)
tags
unknown-type
fields
unknown-type
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that factory_log_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/factory_logs"
    data = json.dumps({
        "app_name": "test",
        "product_imei": "000000000000000",
        "repair_id": 1,
        "timestamp": "2000-01-01 00:00:00",
        "tags": Unknown column type,
        "fields": Unknown column type,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "factory_log_id": 1
        "app_name": "test",
        "product_imei": "000000000000000",
        "repair_id": 1,
        "timestamp": "2000-01-01 00:00:00",
        "tags": Unknown column type,
        "fields": Unknown column type,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the factory_log created by specifying its factory_log_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/factory_logs/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "factory_log_id": 1
        "app_name": "test",
        "product_imei": "000000000000000",
        "repair_id": 1,
        "timestamp": "2000-01-01 00:00:00",
        "tags": Unknown column type,
        "fields": Unknown column type,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all factory_logs by omitting the factory_log_id:

    url = 'https://smartapi.bboxx.co.uk/v1/factory_logs'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

value
endpoint /v1/factory_logs
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the factory_log that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/factory_logs or /v1/factory_logs/<factory_log_id>
method GET
url_params factory_log_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Final Balance

Most recent credit_balance remaining on each DCM unit.

The final_balance object

Field Description
final_balance_id
int (primary key)
A unique integer identifier for each final_balance.
product_imei
varchar(15) (not-null,foreign-key)
final_balance
int (not-null)
total_added
int (not-null)
zero_command_id
int (not-null,foreign-key)
status
string
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

We can retrieve the final_balance created by specifying its final_balance_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/final_balances/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "final_balance_id": 1
        "product_imei": "000000000000000",
        "final_balance": 1,
        "total_added": 1,
        "zero_command_id": 1,
        "status": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all final_balances by omitting the final_balance_id:

    url = 'https://smartapi.bboxx.co.uk/v1/final_balances'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/final_balances or /v1/final_balances/<final_balance_id>
method GET
url_params final_balance_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Home2 Stock Preparation Tracking

Stores results from home2 stock preparation page.

The home2_stock_preparation_tracking object

Field Description
home2_stock_preparation_tracking_id
int (primary key)
A unique integer identifier for each home2_stock_preparation_tracking.
product_imei
varchar(15) (not-null,foreign-key)
serial_number
string (not-null)
activated
boolean (not-null)
software_updated
boolean (not-null)
temperature_check
boolean (not-null)
battery_charged
boolean (not-null)
recent_data
boolean (not-null)
online_disable
boolean (not-null)
contact_support
boolean (not-null)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

GET requests are not allowed at this endpoint

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

### GET GET requests are not allowed at this endpoint

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Hub

Contains details of all every BBOXX hub-centre (obselete)

The hub object

Field Description
hub_id
int (primary key)
A unique integer identifier for each hub.
name
string (not-null,unique)
guid
string (unique)
entity_id
int (not-null,foreign-key)
latitude
varchar(12)
longitude
varchar(12)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
products The associated products
shops The associated shops



An example POST request. Note that hub_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/hubs"
    data = json.dumps({
        "name": "test",
        "guid": "test",
        "entity_id": 1,
        "latitude": "-1.111111111",
        "longitude": "-1.111111111",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "hub_id": 1
        "name": "test",
        "guid": "test",
        "entity_id": 1,
        "latitude": "-1.111111111",
        "longitude": "-1.111111111",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the hub created by specifying its hub_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/hubs/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "hub_id": 1
        "name": "test",
        "guid": "test",
        "entity_id": 1,
        "latitude": "-1.111111111",
        "longitude": "-1.111111111",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all hubs by omitting the hub_id:

    url = 'https://smartapi.bboxx.co.uk/v1/hubs'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created hub with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/hubs/1'
    data = json.dumps({
        "name": "changed",
        "guid": "changed",
        "entity_id": 2,
        "latitude": "-9.999999999",
        "longitude": "-9.999999999",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "hub_id": 1
        "name": "changed",
        "guid": "changed",
        "entity_id": 2,
        "latitude": "-9.999999999",
        "longitude": "-9.999999999",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the hub

    url = 'https://smartapi.bboxx.co.uk/v1/hubs/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/hubs
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the hub that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/hubs or /v1/hubs/<hub_id>
method GET
url_params hub_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/hubs/<hub_id>
method PUT
url_params hub_id of the hub you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/hubs/<hub_id>
method DELETE
url_params hub_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Influx Shard Data

Record of Influx shard identifiers and timespans

The influx_shard_data object

Field Description
influx_shard_data_id
int (primary key)
A unique integer identifier for each influx_shard_data.
shard_data
unknown-type
anomalies
unknown-type
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

GET requests are not allowed at this endpoint

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

### GET GET requests are not allowed at this endpoint

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Latest Software

Contains details of the most recent software for each product_type

The latest_software object

Field Description
latest_software_id
int (primary key)
A unique integer identifier for each latest_software.
product_type_id
int (not-null,foreign-key)
software_version_type_id
int (not-null,foreign-key)
date_added
datetime (not-null)
date_removed
datetime
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

GET requests are not allowed at this endpoint

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

### GET GET requests are not allowed at this endpoint

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Network

A table holding the available networks that a unit might connect on.

The network object

Field Description
mccmnc
int (primary key)
A unique integer identifier for each network.
name
string (not-null)
mcc
int
mnc
int
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that mccmnc, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/networks"
    data = json.dumps({
        "name": "test",
        "mcc": 1,
        "mnc": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "mccmnc": 1
        "name": "test",
        "mcc": 1,
        "mnc": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the network created by specifying its mccmnc in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/networks/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "mccmnc": 1
        "name": "test",
        "mcc": 1,
        "mnc": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all networks by omitting the mccmnc:

    url = 'https://smartapi.bboxx.co.uk/v1/networks'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created network with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/networks/1'
    data = json.dumps({
        "name": "changed",
        "mcc": 2,
        "mnc": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "mccmnc": 1
        "name": "changed",
        "mcc": 2,
        "mnc": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the network

    url = 'https://smartapi.bboxx.co.uk/v1/networks/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/networks
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the network that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/networks or /v1/networks/<mccmnc>
method GET
url_params mccmnc (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/networks/<mccmnc>
method PUT
url_params mccmnc of the network you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/networks/<mccmnc>
method DELETE
url_params mccmnc (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Parameter

A table containing the values of all parameters set on all unit. Each parameter is of a particular parameter type

The parameter object

Field Description
parameter_id
int (primary key)
A unique integer identifier for each parameter.
parameter_type_id
int (not-null,foreign-key)
product_imei
varchar(15) (not-null,foreign-key)
value
string (not-null)
date_added
datetime
date_removed
datetime
status
string

options: ["active", "removed", "expired", "pending"]
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that parameter_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "http://smartapi.bboxx.co.uk/v1/parameters"
    data = json.dumps({
        "parameter_type_id": 1,
        "product_imei": "000000000000000",
        "value": "test",
        "date_added": "2000-01-01 00:00:00",
        "date_removed": "2000-01-01 00:00:00",
        "status": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "parameter_id": 1
        "parameter_type_id": 1,
        "product_imei": "000000000000000",
        "value": "test",
        "date_added": "2000-01-01 00:00:00",
        "date_removed": "2000-01-01 00:00:00",
        "status": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

> We can retrieve the parameter created by specifying its parameter_id in the request url:

    url = 'http://smartapi.bboxx.co.uk/v1/parameters/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "parameter_id": 1
        "parameter_type_id": 1,
        "product_imei": "000000000000000",
        "value": "test",
        "date_added": "2000-01-01 00:00:00",
        "date_removed": "2000-01-01 00:00:00",
        "status": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all parameters by omitting the parameter_id:

    url = 'http://smartapi.bboxx.co.uk/v1/parameters'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created parameter with a PUT request:

    url = 'http://smartapi.bboxx.co.uk/v1/parameters/1'
    data = json.dumps({
        "parameter_type_id": 2,
        "product_imei": "999999999999999",
        "value": "changed",
        "date_added": "2016-07-01 12:34:45",
        "date_removed": "2016-07-01 12:34:45",
        "status": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "parameter_id": 1
        "parameter_type_id": 2,
        "product_imei": "999999999999999",
        "value": "changed",
        "date_added": "2016-07-01 12:34:45",
        "date_removed": "2016-07-01 12:34:45",
        "status": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the parameter

    url = 'http://smartapi.bboxx.co.uk/v1/parameters/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/parameters
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the parameter that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/parameters or /v1/parameters/<parameter_id>
method GET
url_params parameter_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/parameters/<parameter_id>
method PUT
url_params parameter_id of the parameter you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/parameters/<parameter_id>
method DELETE
url_params parameter_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Parameter Type

A table of the possible types of Parameter that may be set. Each ParameterType is linked to oneor more ProductTypes.

The parameter_type object

Field Description
parameter_type_id
int (primary key)
A unique integer identifier for each parameter_type.
name
string (not-null,unique)
data_type
string (not-null)

options: ["float", "datetime", "int", "string", "bool"]
validation_rules
unknown-type
description
string
units
string
repeatable
boolean (not-null)
setting
boolean (not-null)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
product_parameters The associated product_parameters



An example POST request. Note that parameter_type_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/parameter_types"
    data = json.dumps({
        "name": "test",
        "data_type": "test",
        "validation_rules": Unknown column type,
        "description": "test",
        "units": "test",
        "repeatable": True,
        "setting": True,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "parameter_type_id": 1
        "name": "test",
        "data_type": "test",
        "validation_rules": Unknown column type,
        "description": "test",
        "units": "test",
        "repeatable": True,
        "setting": True,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the parameter_type created by specifying its parameter_type_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/parameter_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "parameter_type_id": 1
        "name": "test",
        "data_type": "test",
        "validation_rules": Unknown column type,
        "description": "test",
        "units": "test",
        "repeatable": True,
        "setting": True,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all parameter_types by omitting the parameter_type_id:

    url = 'https://smartapi.bboxx.co.uk/v1/parameter_types'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created parameter_type with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/parameter_types/1'
    data = json.dumps({
        "name": "changed",
        "data_type": "changed",
        "validation_rules": Unknown column type,
        "description": "changed",
        "units": "changed",
        "repeatable": False,
        "setting": False,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "parameter_type_id": 1
        "name": "changed",
        "data_type": "changed",
        "validation_rules": Unknown column type,
        "description": "changed",
        "units": "changed",
        "repeatable": False,
        "setting": False,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the parameter_type

    url = 'https://smartapi.bboxx.co.uk/v1/parameter_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/parameter_types
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the parameter_type that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/parameter_types or /v1/parameter_types/<parameter_type_id>
method GET
url_params parameter_type_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/parameter_types/<parameter_type_id>
method PUT
url_params parameter_type_id of the parameter_type you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/parameter_types/<parameter_type_id>
method DELETE
url_params parameter_type_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Part Product Linker

Specifies which parts are associated with which product.Includes a history of which product each part is associated with.Includes the repair during which the new part was added and what it replaced.

The part_product_linker object

Field Description
part_product_linker_id
int (primary key)
A unique integer identifier for each part_product_linker.
part_id
int (not-null,foreign-key)
product_imei
varchar(15) (not-null,foreign-key)
date_added
datetime
date_removed
datetime
added_repair_id
int (foreign-key)
removed_repair_id
int (foreign-key)
replaced_part_id
int (foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

We can retrieve the part_product_linker created by specifying its part_product_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/part_product_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "part_product_linker_id": 1
        "part_id": 1,
        "product_imei": "000000000000000",
        "date_added": "2000-01-01 00:00:00",
        "date_removed": "2000-01-01 00:00:00",
        "added_repair_id": 1,
        "removed_repair_id": 1,
        "replaced_part_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all part_product_linker by omitting the part_product_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/part_product_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created part_product_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/part_product_linker/1'
    data = json.dumps({
        "part_id": 2,
        "product_imei": "999999999999999",
        "date_added": "2016-07-01 12:34:45",
        "date_removed": "2016-07-01 12:34:45",
        "added_repair_id": 2,
        "removed_repair_id": 2,
        "replaced_part_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "part_product_linker_id": 1
        "part_id": 2,
        "product_imei": "999999999999999",
        "date_added": "2016-07-01 12:34:45",
        "date_removed": "2016-07-01 12:34:45",
        "added_repair_id": 2,
        "removed_repair_id": 2,
        "replaced_part_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the part_product_linker

    url = 'https://smartapi.bboxx.co.uk/v1/part_product_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/part_product_linker or /v1/part_product_linker/<part_product_linker_id>
method GET
url_params part_product_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/part_product_linker/<part_product_linker_id>
method PUT
url_params part_product_linker_id of the part_product_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/part_product_linker/<part_product_linker_id>
method DELETE
url_params part_product_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Part

Contains details of all of the parts in each BBOXX product.

The part object

Field Description
part_id
int (primary key)
A unique integer identifier for each part.
serial_number
string (unique)
part_type_id
int (not-null,foreign-key)
properties
unknown-type
manufacturer
string
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
part_product_linker The associated part_product_linker



An example POST request. Note that part_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/parts"
    data = json.dumps({
        "serial_number": "test",
        "part_type_id": 1,
        "properties": Unknown column type,
        "manufacturer": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "part_id": 1
        "serial_number": "test",
        "part_type_id": 1,
        "properties": Unknown column type,
        "manufacturer": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the part created by specifying its part_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/parts/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "part_id": 1
        "serial_number": "test",
        "part_type_id": 1,
        "properties": Unknown column type,
        "manufacturer": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all parts by omitting the part_id:

    url = 'https://smartapi.bboxx.co.uk/v1/parts'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created part with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/parts/1'
    data = json.dumps({
        "serial_number": "changed",
        "part_type_id": 2,
        "properties": Unknown column type,
        "manufacturer": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "part_id": 1
        "serial_number": "changed",
        "part_type_id": 2,
        "properties": Unknown column type,
        "manufacturer": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the part

    url = 'https://smartapi.bboxx.co.uk/v1/parts/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/parts
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the part that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/parts or /v1/parts/<part_id>
method GET
url_params part_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/parts/<part_id>
method PUT
url_params part_id of the part you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/parts/<part_id>
method DELETE
url_params part_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Part Type Category

The category of parts that each part_type belongs to

The part_type_category object

Field Description
part_type_category_id
int (primary key)
A unique integer identifier for each part_type_category.
name
string (not-null,unique)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
part_types The associated part_types



An example POST request. Note that part_type_category_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/part_type_categories"
    data = json.dumps({
        "name": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "part_type_category_id": 1
        "name": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the part_type_category created by specifying its part_type_category_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/part_type_categories/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "part_type_category_id": 1
        "name": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all part_type_categories by omitting the part_type_category_id:

    url = 'https://smartapi.bboxx.co.uk/v1/part_type_categories'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created part_type_category with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/part_type_categories/1'
    data = json.dumps({
        "name": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "part_type_category_id": 1
        "name": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the part_type_category

    url = 'https://smartapi.bboxx.co.uk/v1/part_type_categories/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/part_type_categories
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the part_type_category that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/part_type_categories or /v1/part_type_categories/<part_type_category_id>
method GET
url_params part_type_category_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/part_type_categories/<part_type_category_id>
method PUT
url_params part_type_category_id of the part_type_category you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/part_type_categories/<part_type_category_id>
method DELETE
url_params part_type_category_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Part Type Product Type Linker

Specifies which part_types are allowed to be linked to which product_types.

The part_type_product_type_linker object

Field Description
part_type_product_type_linker_id
int (primary key)
A unique integer identifier for each part_type_product_type_linker.
product_type_id
int (not-null,foreign-key)
part_type_id
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that part_type_product_type_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "http://smartapi.bboxx.co.uk/v1/part_type_product_type_linker"
    data = json.dumps({
        "product_type_id": 1,
        "part_type_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "part_type_product_type_linker_id": 1
        "product_type_id": 1,
        "part_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

> We can retrieve the part_type_product_type_linker created by specifying its part_type_product_type_linker_id in the request url:

    url = 'http://smartapi.bboxx.co.uk/v1/part_type_product_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "part_type_product_type_linker_id": 1
        "product_type_id": 1,
        "part_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all part_type_product_type_linker by omitting the part_type_product_type_linker_id:

    url = 'http://smartapi.bboxx.co.uk/v1/part_type_product_type_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created part_type_product_type_linker with a PUT request:

    url = 'http://smartapi.bboxx.co.uk/v1/part_type_product_type_linker/1'
    data = json.dumps({
        "product_type_id": 2,
        "part_type_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "part_type_product_type_linker_id": 1
        "product_type_id": 2,
        "part_type_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the part_type_product_type_linker

    url = 'http://smartapi.bboxx.co.uk/v1/part_type_product_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/part_type_product_type_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the part_type_product_type_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/part_type_product_type_linker or /v1/part_type_product_type_linker/<part_type_product_type_linker_id>
method GET
url_params part_type_product_type_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/part_type_product_type_linker/<part_type_product_type_linker_id>
method PUT
url_params part_type_product_type_linker_id of the part_type_product_type_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/part_type_product_type_linker/<part_type_product_type_linker_id>
method DELETE
url_params part_type_product_type_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Part Type Replacement Linker

Specifies which parts can replace which other parts.This table can be used to generate list of possible parts for each product_type.

The part_type_replacement_linker object

Field Description
part_type_replacement_linker_id
int (primary key)
A unique integer identifier for each part_type_replacement_linker.
product_type_id
int (foreign-key)
existing_part_type_id
int (not-null,foreign-key)
replacement_part_type_id
int (not-null,foreign-key)
default_part_type
boolean (not-null)
critical_part_type
boolean (not-null)
non_transferable
boolean (not-null)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that part_type_replacement_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/part_type_replacement_linker"
    data = json.dumps({
        "product_type_id": 1,
        "existing_part_type_id": 1,
        "replacement_part_type_id": 1,
        "default_part_type": True,
        "critical_part_type": True,
        "non_transferable": True,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "part_type_replacement_linker_id": 1
        "product_type_id": 1,
        "existing_part_type_id": 1,
        "replacement_part_type_id": 1,
        "default_part_type": True,
        "critical_part_type": True,
        "non_transferable": True,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the part_type_replacement_linker created by specifying its part_type_replacement_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/part_type_replacement_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "part_type_replacement_linker_id": 1
        "product_type_id": 1,
        "existing_part_type_id": 1,
        "replacement_part_type_id": 1,
        "default_part_type": True,
        "critical_part_type": True,
        "non_transferable": True,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all part_type_replacement_linker by omitting the part_type_replacement_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/part_type_replacement_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created part_type_replacement_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/part_type_replacement_linker/1'
    data = json.dumps({
        "product_type_id": 2,
        "existing_part_type_id": 2,
        "replacement_part_type_id": 2,
        "default_part_type": False,
        "critical_part_type": False,
        "non_transferable": False,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "part_type_replacement_linker_id": 1
        "product_type_id": 2,
        "existing_part_type_id": 2,
        "replacement_part_type_id": 2,
        "default_part_type": False,
        "critical_part_type": False,
        "non_transferable": False,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the part_type_replacement_linker

    url = 'https://smartapi.bboxx.co.uk/v1/part_type_replacement_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/part_type_replacement_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the part_type_replacement_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/part_type_replacement_linker or /v1/part_type_replacement_linker/<part_type_replacement_linker_id>
method GET
url_params part_type_replacement_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/part_type_replacement_linker/<part_type_replacement_linker_id>
method PUT
url_params part_type_replacement_linker_id of the part_type_replacement_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/part_type_replacement_linker/<part_type_replacement_linker_id>
method DELETE
url_params part_type_replacement_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Part Type

Lists the available part types

The part_type object

Field Description
part_type_id
int (primary key)
A unique integer identifier for each part_type.
name
string (not-null,unique)
description
string
erp_code
unknown-type
part_type_category_id
int (not-null,foreign-key)
serial_number_category
string (not-null)

options: ["known", "hidden", "unknown"]
parameter_types
array
part_type_metadata_validator
string
is_sent_by_unit
boolean
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
parts The associated parts
old_part_type_linkers The associated old_part_type_linkers
new_part_type_linkers The associated new_part_type_linkers
replacements The associated replacements
existings The associated existings
default_energy_limits The associated default_energy_limits



An example POST request. Note that part_type_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/part_types"
    data = json.dumps({
        "name": "test",
        "description": "test",
        "erp_code": Unknown column type,
        "part_type_category_id": 1,
        "serial_number_category": "test",
        "parameter_types": [1,2,3],
        "part_type_metadata_validator": "test",
        "is_sent_by_unit": True,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "part_type_id": 1
        "name": "test",
        "description": "test",
        "erp_code": Unknown column type,
        "part_type_category_id": 1,
        "serial_number_category": "test",
        "parameter_types": [1,2,3],
        "part_type_metadata_validator": "test",
        "is_sent_by_unit": True,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the part_type created by specifying its part_type_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/part_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "part_type_id": 1
        "name": "test",
        "description": "test",
        "erp_code": Unknown column type,
        "part_type_category_id": 1,
        "serial_number_category": "test",
        "parameter_types": [1,2,3],
        "part_type_metadata_validator": "test",
        "is_sent_by_unit": True,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all part_types by omitting the part_type_id:

    url = 'https://smartapi.bboxx.co.uk/v1/part_types'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created part_type with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/part_types/1'
    data = json.dumps({
        "name": "changed",
        "description": "changed",
        "erp_code": Unknown column type,
        "part_type_category_id": 2,
        "serial_number_category": "changed",
        "parameter_types": [1,2,3,4,5,6],
        "part_type_metadata_validator": "changed",
        "is_sent_by_unit": False,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "part_type_id": 1
        "name": "changed",
        "description": "changed",
        "erp_code": Unknown column type,
        "part_type_category_id": 2,
        "serial_number_category": "changed",
        "parameter_types": [1,2,3,4,5,6],
        "part_type_metadata_validator": "changed",
        "is_sent_by_unit": False,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the part_type

    url = 'https://smartapi.bboxx.co.uk/v1/part_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/part_types
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the part_type that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/part_types or /v1/part_types/<part_type_id>
method GET
url_params part_type_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/part_types/<part_type_id>
method PUT
url_params part_type_id of the part_type you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/part_types/<part_type_id>
method DELETE
url_params part_type_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Payment Command

PaymentCommands received and then forwarded sent to the unit.

The payment_command object

Field Description
payment_command_id
int (primary key)
A unique integer identifier for each payment_command.
product_imei
varchar(15) (not-null,foreign-key)
value
int (not-null)
category
string (not-null)

options: ["payment", "bad-payment", "zero-command", "force-reset"]
void
boolean (not-null)
status
string
transaction_id
string (not-null,unique)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
final_balance The associated final_balance



POST requests are not allowed at this endpoint

We can retrieve the payment_command created by specifying its payment_command_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/payment_commands/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "payment_command_id": 1
        "product_imei": "000000000000000",
        "value": 1,
        "category": "test",
        "void": True,
        "status": "test",
        "transaction_id": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all payment_commands by omitting the payment_command_id:

    url = 'https://smartapi.bboxx.co.uk/v1/payment_commands'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/payment_commands or /v1/payment_commands/<payment_command_id>
method GET
url_params payment_command_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

/products/<imei>/balance_and_pending_payments

Description

A GET request to this endpoint will return the balance, expected expiry and pending payment commands associated with that unit.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/balance_and_pending_payments"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    print(r.json())

    >>>{
        "status": "success",
        "message": "Balance and pending credits.",
        "data": {
            "balance": 432000,
            "expected_expiry": "2020-11-06T07:07:45.796359",
            "pending_payment_commands": [
                {
                    "category": "force-reset",
                    "created_at": "2020-11-06T07:07:45.742314",
                    "modified_at": "2020-11-06T07:07:45.742314",
                    "value": 0
                },
                {
                    "category": "zero-command",
                    "created_at": "2020-11-06T07:02:44.906775",
                    "modified_at": "2020-11-06T07:07:45.742314",
                    "value": 0
                },
                {
                    "category": "payment",
                    "created_at": "2020-10-29T12:40:49.443969",
                    "modified_at": "2020-11-06T07:07:45.742314",
                    "value": 2592000
                }
            ]
        }
    }


A GET request to this endpoint will return:

Endpoint

value
endpoint /products/<imei>/balance_and_pending_payments
method GET
url_params product_imei (str)
payload None
response 200
__permissions OVERVIEW

Product Note

Table of notes about each product

The product_note object

Field Description
product_note_id
int (primary key)
A unique integer identifier for each product_note.
note_text
string (not-null)
product_imei
string (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that product_note_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/product_notes"
    data = json.dumps({
        "note_text": "test",
        "product_imei": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "product_note_id": 1
        "note_text": "test",
        "product_imei": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the product_note created by specifying its product_note_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/product_notes/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "product_note_id": 1
        "note_text": "test",
        "product_imei": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all product_notes by omitting the product_note_id:

    url = 'https://smartapi.bboxx.co.uk/v1/product_notes'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created product_note with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/product_notes/1'
    data = json.dumps({
        "note_text": "changed",
        "product_imei": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "product_note_id": 1
        "note_text": "changed",
        "product_imei": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the product_note

    url = 'https://smartapi.bboxx.co.uk/v1/product_notes/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/product_notes
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the product_note that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/product_notes or /v1/product_notes/<product_note_id>
method GET
url_params product_note_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/product_notes/<product_note_id>
method PUT
url_params product_note_id of the product_note you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/product_notes/<product_note_id>
method DELETE
url_params product_note_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Product Parameter

Contains details of the parameter settings of every product.

The product_parameter object

Field Description
product_parameter_id
int (primary key)
A unique integer identifier for each product_parameter.
product_imei
varchar(15) (not-null,foreign-key)
parameter_type_id
int (not-null,foreign-key)
status
string

options: ["expired", "removed", "active", "pending"]
value
string (not-null)
date_added
datetime
date_removed
datetime
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that product_parameter_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/product_parameters"
    data = json.dumps({
        "product_imei": "000000000000000",
        "parameter_type_id": 1,
        "status": "test",
        "value": "test",
        "date_added": "2000-01-01 00:00:00",
        "date_removed": "2000-01-01 00:00:00",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "product_parameter_id": 1
        "product_imei": "000000000000000",
        "parameter_type_id": 1,
        "status": "test",
        "value": "test",
        "date_added": "2000-01-01 00:00:00",
        "date_removed": "2000-01-01 00:00:00",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the product_parameter created by specifying its product_parameter_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/product_parameters/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "product_parameter_id": 1
        "product_imei": "000000000000000",
        "parameter_type_id": 1,
        "status": "test",
        "value": "test",
        "date_added": "2000-01-01 00:00:00",
        "date_removed": "2000-01-01 00:00:00",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all product_parameters by omitting the product_parameter_id:

    url = 'https://smartapi.bboxx.co.uk/v1/product_parameters'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created product_parameter with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/product_parameters/1'
    data = json.dumps({
        "product_imei": "999999999999999",
        "parameter_type_id": 2,
        "status": "changed",
        "value": "changed",
        "date_added": "2016-07-01 12:34:45",
        "date_removed": "2016-07-01 12:34:45",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "product_parameter_id": 1
        "product_imei": "999999999999999",
        "parameter_type_id": 2,
        "status": "changed",
        "value": "changed",
        "date_added": "2016-07-01 12:34:45",
        "date_removed": "2016-07-01 12:34:45",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the product_parameter

    url = 'https://smartapi.bboxx.co.uk/v1/product_parameters/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/product_parameters
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the product_parameter that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/product_parameters or /v1/product_parameters/<product_parameter_id>
method GET
url_params product_parameter_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/product_parameters/<product_parameter_id>
method PUT
url_params product_parameter_id of the product_parameter you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/product_parameters/<product_parameter_id>
method DELETE
url_params product_parameter_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

/products/<imei>/parts

Description

A GET request to this endpoint will return a complete list of parts and related data currently associated with that unit.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/parts"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    print r.json()
    >>> {
        "message": "Parts found.",
        "status": "success",
        "data": {
            "10737": {
              "created_at": "2015-07-02T11:50:23",
              "created_by": "d.mclean@bboxx.co.uk",
              "modified_at": null,
              "part_id": 10737,
              "part_product_linker": {
                "added_repair_id": null,
                "created_at": "2015-07-02T11:50:25",
                "created_by": "d.mclean@bboxx.co.uk",
                "date_added": "2015-07-02T11:50:24",
                "date_removed": null,
                "modified_at": null,
                "part_id": 10737,
                "part_product_linker_id": 10719,
                "product_imei": "013950005303699",
                "removed_repair_id": null,
                "replaced_part_id": null
              },
              "part_type": {
                "created_at": "2015-04-10T10:48:40",
                "created_by": "d.mclean@bboxx.co.uk",
                "description": "A SIM card provided and activated by Vodafone",
                "erp_code": null,
                "modified_at": null,
                "name": "Vodafone SIM",
                "part_type_id": 1,
                "serial_number_category": "known"
              },
              "part_type_id": 1,
              "replacement_part_types": [
                {
                  "created_at": "2015-04-10T10:48:40",
                  "created_by": "d.mclean@bboxx.co.uk",
                  "description": "A SIM card provided and activated by Vodafone",
                  "erp_code": null,
                  "modified_at": null,
                  "name": "Vodafone SIM",
                  "part_type_id": 1,
                  "serial_number_category": "known"
                },
                {
                  "created_at": "2015-04-10T10:49:38",
                  "created_by": "d.mclean@bboxx.co.uk",
                  "description": "A SIM card provided and activated by Wireless Logic",
                  "erp_code": null,
                  "modified_at": null,
                  "name": "Wireless Logic SIM",
                  "part_type_id": 2,
                  "serial_number_category": "known"
                }
              ],
              "serial_number": "204043256110756"
            },
            "308501": {
              "created_at": "2016-06-14T09:48:39.622906",
              "created_by": "h.he@bboxx.co.uk",
              "modified_at": null,
              "part_id": 308501,
              "part_product_linker": {
                "added_repair_id": null,
                "created_at": "2016-06-14T09:48:40.486927",
                "created_by": "h.he@bboxx.co.uk",
                "date_added": "2016-06-14T09:48:40.748124",
                "date_removed": null,
                "modified_at": null,
                "part_id": 308501,
                "part_product_linker_id": 307244,
                "product_imei": "013950005303699",
                "removed_repair_id": null,
                "replaced_part_id": null
              },
              "part_type": {
                "created_at": "2016-03-10T15:40:46.578552",
                "created_by": "d.mclean@bboxx.co.uk",
                "description": "5A fuse",
                "erp_code": null,
                "modified_at": null,
                "name": "5A Fuse",
                "part_type_id": 13,
                "serial_number_category": "unknown"
              },
              "part_type_id": 13,
              "replacement_part_types": [
                {
                  "created_at": "2016-03-10T15:40:46.578552",
                  "created_by": "d.mclean@bboxx.co.uk",
                  "description": "5A fuse",
                  "erp_code": null,
                  "modified_at": null,
                  "name": "5A Fuse",
                  "part_type_id": 13,
                  "serial_number_category": "unknown"
                }
              ],
              "serial_number": "tCXYvInR0xwCQpzAnJS76dPfHMr1uTMmFRZs7Jj49to0P2wxzCPAfYzie2AvncZF"
            },
        }

This endpoint is designed to for use during repairs of the Unit. A GET request to this endpoint will return:

Endpoint

value
endpoint /products/<imei>/parts
method GET
url_params product_imei (str)
payload None
response 200
__permissions OVERVIEW

Response

The format of the data returned by this endpoint is a dictionary where the keys are part_ids and the value is another dictionary of the data associated with the part.

part_id: {part_data}

Where {part_data} is a dictionary as follows:

{ "part_id": id "part_type_id": type_id "serial_number":serial, "part_product_linker": linker dict "part_type": part_type_dict "replacement_part_types": [list-of-replacement-part_type-objects] "created_at": timestamp "created_by": user "modified_at": timestamp }

You can see an example of the full object in the code snippet to the right.

The intended use for this endpoint is for implementing repairs to BBOXX Units.

Product Product Group Linker

Specifies which products are associated with which product_groups. Includes a history of which product_group each product is associated with.

The product_product_group_linker object

Field Description
product_product_group_linker_id
int (primary key)
A unique integer identifier for each product_product_group_linker.
product_group_id
int (not-null,foreign-key)
product_imei
varchar(15) (not-null,foreign-key)
date_added
datetime
date_removed
datetime
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

We can retrieve the product_product_group_linker created by specifying its product_product_group_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/product_product_group_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "product_product_group_linker_id": 1
        "product_group_id": 1,
        "product_imei": "000000000000000",
        "date_added": "2000-01-01 00:00:00",
        "date_removed": "2000-01-01 00:00:00",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all product_product_group_linker by omitting the product_product_group_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/product_product_group_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/product_product_group_linker or /v1/product_product_group_linker/<product_product_group_linker_id>
method GET
url_params product_product_group_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Product

Lists all the products in the SMARTSolar Backend.

The product object

Field Description
product_imei
varchar(15) (primary key)
analysis_timestamp
datetime
current_enable_flag
boolean (not-null)
desired_enable_flag
boolean (not-null)
disable_date
datetime
device_key
varchar(24) (unique)
hub_id
int (foreign-key)
imsi
varchar(15) (not-null,unique)
iccid
unknown-type (unique)
latest_connection_id
int
latest_connection_location_id
int
latest_state_id
int (foreign-key)
latest_enable_history_id
int (foreign-key)
product_type_id
int (not-null,foreign-key)
serial_number
string (not-null,unique)
shop_id
int (foreign-key)
software_lock
int (foreign-key)
rtc_network_name
string

options: ["Test-SIM-Provider", "Aeris", "Eseye", "Wireless-Logic"]
ip_address
varchar(15)
latest_rtc_connection_history_id
int
latest_rtc_mo_status_report_time
datetime
latest_rtc_mt_status_update_time
datetime
rtc_enabled_flag
boolean (not-null)
dcm_enabled_flag
boolean (not-null)
boolean value that shows whether a device is DCM enabled or not
assembler
string
gps_lat
float
gps_lon
float
warranty_start_date
date (nullable)
The date (in YYYY-MM-DD format) indicating the day a product's warranty started
is_payg
boolean (not-null)
boolean value that shows if a unit is to be paid for to stay turned ON or not (aka is the unit "Pay As You Go" i.e customer should keep on paying Bboxx in order to use the device)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
connections The associated connections
notes The associated notes
part_product_linker The associated part_product_linker
product_product_group_linker The associated product_product_group_linker
product_entity_linker The associated product_entity_linker
product_software_linker The associated product_software_linker
enable_history_rel The associated enable_history_rel
repairs The associated repairs
sms_history The associated sms_history
states The associated states
product_parameter The associated product_parameter
analysis_histories The associated analysis_histories
rtc_message_history The associated rtc_message_history
rtc_connection_history The associated rtc_connection_history
migration_history The associated migration_history
payment_command The associated payment_command
balance The associated balance
final_balance The associated final_balance



POST requests are not allowed at this endpoint

We can retrieve the product created by specifying its product_imei in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/products/111010101010101'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "product_imei": "111010101010101",
        "analysis_timestamp": "2000-01-01 00:00:00",
        "current_enable_flag": True,
        "desired_enable_flag": True,
        "disable_date": "2000-01-01 00:00:00",
        "device_key": "awjs875jg7thskr9485984rf",
        "hub_id": 1,
        "imsi": "000000000000000",
        "iccid": Unknown column type,
        "latest_connection_id": 1,
        "latest_connection_location_id": 1,
        "latest_state_id": 1,
        "latest_enable_history_id": 1,
        "product_type_id": 1,
        "serial_number": "test",
        "shop_id": 1,
        "software_lock": 1,
        "rtc_network_name": "test",
        "ip_address": "000000000000000",
        "latest_rtc_connection_history_id": 1,
        "latest_rtc_mo_status_report_time": "2000-01-01 00:00:00",
        "latest_rtc_mt_status_update_time": "2000-01-01 00:00:00",
        "rtc_enabled_flag": True,
        "dcm_enabled_flag": False,
        "assembler": "test",
        "gps_lat": 1.0,
        "gps_lon": 1.0,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all products by omitting the product_imei:

    url = 'https://smartapi.bboxx.co.uk/v1/products'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created product with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/products/111010101010101'
    data = json.dumps({
        "analysis_timestamp": "2016-07-01 12:34:45",
        "current_enable_flag": False,
        "desired_enable_flag": False,
        "disable_date": "2016-07-01 12:34:45",
        "device_key": "awjs875jg7thskr9485984rf",
        "hub_id": 2,
        "imsi": "999999999999999",
        "iccid": Unknown column type,
        "latest_connection_id": 2,
        "latest_connection_location_id": 2,
        "latest_state_id": 2,
        "latest_enable_history_id": 2,
        "product_type_id": 2,
        "serial_number": "changed",
        "shop_id": 2,
        "software_lock": 2,
        "rtc_network_name": "changed",
        "ip_address": "999999999999999",
        "latest_rtc_connection_history_id": 2,
        "latest_rtc_mo_status_report_time": "2016-07-01 12:34:45",
        "latest_rtc_mt_status_update_time": "2016-07-01 12:34:45",
        "rtc_enabled_flag": False,
        "dcm_enabled_flag": False,
        "assembler": "changed",
        "gps_lat": 2.0,
        "gps_lon": 2.0,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "product_imei": "111010101010101",
        "analysis_timestamp": "2016-07-01 12:34:45",
        "current_enable_flag": False,
        "desired_enable_flag": False,
        "disable_date": "2016-07-01 12:34:45",
        "device_key": "awjs875jg7thskr9485984rf",
        "hub_id": 2,
        "imsi": "999999999999999",
        "iccid": Unknown column type,
        "latest_connection_id": 2,
        "latest_connection_location_id": 2,
        "latest_state_id": 2,
        "latest_enable_history_id": 2,
        "product_type_id": 2,
        "serial_number": "changed",
        "shop_id": 2,
        "software_lock": 2,
        "rtc_network_name": "changed",
        "ip_address": "999999999999999",
        "latest_rtc_connection_history_id": 2,
        "latest_rtc_mo_status_report_time": "2016-07-01 12:34:45",
        "latest_rtc_mt_status_update_time": "2016-07-01 12:34:45",
        "rtc_enabled_flag": False,
        "dcm_enabled_flag": False,
        "assembler": "changed",
        "gps_lat": 2.0,
        "gps_lon": 2.0,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the product

    url = 'https://smartapi.bboxx.co.uk/v1/products/111010101010101'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/products or /v1/products/<product_imei>
method GET
url_params product_imei (varchar(15))
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/products/<product_imei>
method PUT
url_params product_imei of the product you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/products/<product_imei>
method DELETE
url_params product_imei (varchar(15))
query params N/A
body N/A
permissions SYSTEM
response 204

Product Software Linker

Specifies which software-version-type is currently on each product.

The product_software_linker object

Field Description
product_software_linker_id
int (primary key)
A unique integer identifier for each product_software_linker.
product_imei
varchar(15) (not-null,foreign-key)
software_version_type_id
int (not-null,foreign-key)
date_added
datetime
date_removed
datetime
update_attempts
int
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that product_software_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/product_software_linker"
    data = json.dumps({
        "product_imei": "000000000000000",
        "software_version_type_id": 1,
        "date_added": "2000-01-01 00:00:00",
        "date_removed": "2000-01-01 00:00:00",
        "update_attempts": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "product_software_linker_id": 1
        "product_imei": "000000000000000",
        "software_version_type_id": 1,
        "date_added": "2000-01-01 00:00:00",
        "date_removed": "2000-01-01 00:00:00",
        "update_attempts": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the product_software_linker created by specifying its product_software_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/product_software_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "product_software_linker_id": 1
        "product_imei": "000000000000000",
        "software_version_type_id": 1,
        "date_added": "2000-01-01 00:00:00",
        "date_removed": "2000-01-01 00:00:00",
        "update_attempts": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all product_software_linker by omitting the product_software_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/product_software_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created product_software_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/product_software_linker/1'
    data = json.dumps({
        "product_imei": "999999999999999",
        "software_version_type_id": 2,
        "date_added": "2016-07-01 12:34:45",
        "date_removed": "2016-07-01 12:34:45",
        "update_attempts": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "product_software_linker_id": 1
        "product_imei": "999999999999999",
        "software_version_type_id": 2,
        "date_added": "2016-07-01 12:34:45",
        "date_removed": "2016-07-01 12:34:45",
        "update_attempts": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the product_software_linker

    url = 'https://smartapi.bboxx.co.uk/v1/product_software_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/product_software_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the product_software_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/product_software_linker or /v1/product_software_linker/<product_software_linker_id>
method GET
url_params product_software_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/product_software_linker/<product_software_linker_id>
method PUT
url_params product_software_linker_id of the product_software_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/product_software_linker/<product_software_linker_id>
method DELETE
url_params product_software_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Product Type

Specifies the different types of product that exist.

The product_type object

Field Description
product_type_id
int (primary key)
A unique integer identifier for each product_type.
name
string (not-null,unique)
erp_code
unknown-type
parameter_types
array
credit_type
string

options: ["gas", "time"]
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
products The associated products
alert_type_product_type_linker The associated alert_type_product_type_linker
product_type_software_version_type_linker The associated product_type_software_version_type_linker
action_type_product_type_linker The associated action_type_product_type_linker
symptom_types The associated symptom_types
latest_software The associated latest_software
part_type_replacements The associated part_type_replacements



An example POST request. Note that product_type_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/product_types"
    data = json.dumps({
        "name": "test",
        "erp_code": Unknown column type,
        "parameter_types": [1,2,3],
        "credit_type": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "product_type_id": 1
        "name": "test",
        "erp_code": Unknown column type,
        "parameter_types": [1,2,3],
        "credit_type": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the product_type created by specifying its product_type_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/product_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "product_type_id": 1
        "name": "test",
        "erp_code": Unknown column type,
        "parameter_types": [1,2,3],
        "credit_type": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all product_types by omitting the product_type_id:

    url = 'https://smartapi.bboxx.co.uk/v1/product_types'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created product_type with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/product_types/1'
    data = json.dumps({
        "name": "changed",
        "erp_code": Unknown column type,
        "parameter_types": [1,2,3,4,5,6],
        "credit_type": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "product_type_id": 1
        "name": "changed",
        "erp_code": Unknown column type,
        "parameter_types": [1,2,3,4,5,6],
        "credit_type": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the product_type

    url = 'https://smartapi.bboxx.co.uk/v1/product_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/product_types
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the product_type that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/product_types or /v1/product_types/<product_type_id>
method GET
url_params product_type_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/product_types/<product_type_id>
method PUT
url_params product_type_id of the product_type you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/product_types/<product_type_id>
method DELETE
url_params product_type_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Product Type Software Version Type Linker

Specifies which software-version-types can be installed on each product-type.

The product_type_software_version_type_linker object

Field Description
product_type_software_version_type_linker_id
int (primary key)
A unique integer identifier for each product_type_software_version_type_linker.
product_type_id
int (not-null,foreign-key)
software_version_type_id
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that product_type_software_version_type_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/product_type_software_version_type_linker"
    data = json.dumps({
        "product_type_id": 1,
        "software_version_type_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "product_type_software_version_type_linker_id": 1
        "product_type_id": 1,
        "software_version_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the product_type_software_version_type_linker created by specifying its product_type_software_version_type_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/product_type_software_version_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "product_type_software_version_type_linker_id": 1
        "product_type_id": 1,
        "software_version_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all product_type_software_version_type_linker by omitting the product_type_software_version_type_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/product_type_software_version_type_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created product_type_software_version_type_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/product_type_software_version_type_linker/1'
    data = json.dumps({
        "product_type_id": 2,
        "software_version_type_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "product_type_software_version_type_linker_id": 1
        "product_type_id": 2,
        "software_version_type_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the product_type_software_version_type_linker

    url = 'https://smartapi.bboxx.co.uk/v1/product_type_software_version_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/product_type_software_version_type_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the product_type_software_version_type_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/product_type_software_version_type_linker or /v1/product_type_software_version_type_linker/<product_type_software_version_type_linker_id>
method GET
url_params product_type_software_version_type_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/product_type_software_version_type_linker/<product_type_software_version_type_linker_id>
method PUT
url_params product_type_software_version_type_linker_id of the product_type_software_version_type_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/product_type_software_version_type_linker/<product_type_software_version_type_linker_id>
method DELETE
url_params product_type_software_version_type_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Repair Action Type Linker

Specifies which action-types were taken on all repairs.

The repair_action_type_linker object

Field Description
repair_action_type_linker_id
int (primary key)
A unique integer identifier for each repair_action_type_linker.
repair_id
int (not-null,foreign-key)
action_type_id
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that repair_action_type_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/repair_action_type_linker"
    data = json.dumps({
        "repair_id": 1,
        "action_type_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "repair_action_type_linker_id": 1
        "repair_id": 1,
        "action_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the repair_action_type_linker created by specifying its repair_action_type_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_action_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "repair_action_type_linker_id": 1
        "repair_id": 1,
        "action_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all repair_action_type_linker by omitting the repair_action_type_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_action_type_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created repair_action_type_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_action_type_linker/1'
    data = json.dumps({
        "repair_id": 2,
        "action_type_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "repair_action_type_linker_id": 1
        "repair_id": 2,
        "action_type_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the repair_action_type_linker

    url = 'https://smartapi.bboxx.co.uk/v1/repair_action_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/repair_action_type_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the repair_action_type_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/repair_action_type_linker or /v1/repair_action_type_linker/<repair_action_type_linker_id>
method GET
url_params repair_action_type_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/repair_action_type_linker/<repair_action_type_linker_id>
method PUT
url_params repair_action_type_linker_id of the repair_action_type_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/repair_action_type_linker/<repair_action_type_linker_id>
method DELETE
url_params repair_action_type_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Repair Part Type Linker

Specifies which part_types were replaced in each repair. Also records which parts the technicin had to wait to repair and how long they had to wait.

The repair_part_type_linker object

Field Description
repair_part_type_linker_id
int (primary key)
A unique integer identifier for each repair_part_type_linker.
repair_id
int (not-null,foreign-key)
old_part_type_id
int (foreign-key)
new_part_id
int (foreign-key)
new_part_type_id
int (foreign-key)
requested_date
datetime
replaced_date
datetime
non_transferable
boolean (not-null)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that repair_part_type_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/repair_part_type_linker"
    data = json.dumps({
        "repair_id": 1,
        "old_part_type_id": 1,
        "new_part_id": 1,
        "new_part_type_id": 1,
        "requested_date": "2000-01-01 00:00:00",
        "replaced_date": "2000-01-01 00:00:00",
        "non_transferable": True,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "repair_part_type_linker_id": 1
        "repair_id": 1,
        "old_part_type_id": 1,
        "new_part_id": 1,
        "new_part_type_id": 1,
        "requested_date": "2000-01-01 00:00:00",
        "replaced_date": "2000-01-01 00:00:00",
        "non_transferable": True,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the repair_part_type_linker created by specifying its repair_part_type_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_part_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "repair_part_type_linker_id": 1
        "repair_id": 1,
        "old_part_type_id": 1,
        "new_part_id": 1,
        "new_part_type_id": 1,
        "requested_date": "2000-01-01 00:00:00",
        "replaced_date": "2000-01-01 00:00:00",
        "non_transferable": True,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all repair_part_type_linker by omitting the repair_part_type_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_part_type_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created repair_part_type_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_part_type_linker/1'
    data = json.dumps({
        "repair_id": 2,
        "old_part_type_id": 2,
        "new_part_id": 2,
        "new_part_type_id": 2,
        "requested_date": "2016-07-01 12:34:45",
        "replaced_date": "2016-07-01 12:34:45",
        "non_transferable": False,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "repair_part_type_linker_id": 1
        "repair_id": 2,
        "old_part_type_id": 2,
        "new_part_id": 2,
        "new_part_type_id": 2,
        "requested_date": "2016-07-01 12:34:45",
        "replaced_date": "2016-07-01 12:34:45",
        "non_transferable": False,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the repair_part_type_linker

    url = 'https://smartapi.bboxx.co.uk/v1/repair_part_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/repair_part_type_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the repair_part_type_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/repair_part_type_linker or /v1/repair_part_type_linker/<repair_part_type_linker_id>
method GET
url_params repair_part_type_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/repair_part_type_linker/<repair_part_type_linker_id>
method PUT
url_params repair_part_type_linker_id of the repair_part_type_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/repair_part_type_linker/<repair_part_type_linker_id>
method DELETE
url_params repair_part_type_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Repair Product Linker

Linked to a repair when a PCB is replaced

The repair_product_linker object

Field Description
repair_product_linker_id
int (primary key)
A unique integer identifier for each repair_product_linker.
repair_id
int (not-null,foreign-key)
product_imei
varchar(15) (not-null)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

GET requests are not allowed at this endpoint

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

### GET GET requests are not allowed at this endpoint

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Repair

Lists all of the repairs that have been carried out on BBOXX control units.

The repair object

Field Description
repair_id
int (primary key)
A unique integer identifier for each repair.
product_imei
varchar(15) (not-null,foreign-key)
arrival_date
date
refurbishment_date
date
measured_battery_capacity
float
process
string

options: ["Repair and Return", "Replaced", "Repossessed", "Broken on Arrival"]
pending_status
boolean
workflow_name
string
workflow_state_id
string
context
unknown-type
latest_workflow_event_id
int
outcome
string
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
alerts The associated alerts
repair_centre_id The associated repair_centre_id
repair_symptom_type_linker The associated repair_symptom_type_linker
repair_action_type_linker The associated repair_action_type_linker
replacements The associated replacements



An example POST request. Note that repair_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/repairs"
    data = json.dumps({
        "product_imei": "000000000000000",
        "arrival_date": "2000-01-01 00:00:00",
        "refurbishment_date": "2000-01-01 00:00:00",
        "measured_battery_capacity": 1.0,
        "process": "test",
        "pending_status": True,
        "workflow_name": "test",
        "workflow_state_id": "test",
        "context": Unknown column type,
        "latest_workflow_event_id": 1,
        "outcome": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "repair_id": 1,
        "repair_centre_id": 1,
        "product_imei": "000000000000000",
        "arrival_date": "2000-01-01 00:00:00",
        "refurbishment_date": "2000-01-01 00:00:00",
        "measured_battery_capacity": 1.0,
        "process": "test",
        "pending_status": True,
        "workflow_name": "test",
        "workflow_state_id": "test",
        "context": Unknown column type,
        "latest_workflow_event_id": 1,
        "outcome": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the repair created by specifying its repair_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/repairs/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "repair_id": 1,
        "repair_centre_id": 1,
        "product_imei": "000000000000000",
        "arrival_date": "2000-01-01 00:00:00",
        "refurbishment_date": "2000-01-01 00:00:00",
        "measured_battery_capacity": 1.0,
        "process": "test",
        "pending_status": True,
        "workflow_name": "test",
        "workflow_state_id": "test",
        "context": Unknown column type,
        "latest_workflow_event_id": 1,
        "outcome": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all repairs by omitting the repair_id:

    url = 'https://smartapi.bboxx.co.uk/v1/repairs'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created repair with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/repairs/1'
    data = json.dumps({
        "product_imei": "999999999999999",
        "arrival_date": "2000-01-01 00:00:00",
        "refurbishment_date": "2000-01-01 00:00:00",
        "measured_battery_capacity": 2.0,
        "process": "changed",
        "pending_status": False,
        "workflow_name": "changed",
        "workflow_state_id": "changed",
        "context": Unknown column type,
        "latest_workflow_event_id": 2,
        "outcome": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "repair_id": 1,
        "repair_centre_id": 1,
        "product_imei": "999999999999999",
        "arrival_date": "2000-01-01 00:00:00",
        "refurbishment_date": "2000-01-01 00:00:00",
        "measured_battery_capacity": 2.0,
        "process": "changed",
        "pending_status": False,
        "workflow_name": "changed",
        "workflow_state_id": "changed",
        "context": Unknown column type,
        "latest_workflow_event_id": 2,
        "outcome": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the repair

    url = 'https://smartapi.bboxx.co.uk/v1/repairs/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/repairs
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the repair that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/repairs or /v1/repairs/<repair_id>
method GET
url_params repair_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/repairs/<repair_id>
method PUT
url_params repair_id of the repair you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/repairs/<repair_id>
method DELETE
url_params repair_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Repair Symptom Type Linker

Specifies which symptoms were diagnosed on each repair

The repair_symptom_type_linker object

Field Description
repair_symptom_type_linker_id
int (primary key)
A unique integer identifier for each repair_symptom_type_linker.
repair_id
int (not-null,foreign-key)
symptom_type_id
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that repair_symptom_type_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/repair_symptom_type_linker"
    data = json.dumps({
        "repair_id": 1,
        "symptom_type_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "repair_symptom_type_linker_id": 1
        "repair_id": 1,
        "symptom_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the repair_symptom_type_linker created by specifying its repair_symptom_type_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_symptom_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "repair_symptom_type_linker_id": 1
        "repair_id": 1,
        "symptom_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all repair_symptom_type_linker by omitting the repair_symptom_type_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_symptom_type_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created repair_symptom_type_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_symptom_type_linker/1'
    data = json.dumps({
        "repair_id": 2,
        "symptom_type_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "repair_symptom_type_linker_id": 1
        "repair_id": 2,
        "symptom_type_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the repair_symptom_type_linker

    url = 'https://smartapi.bboxx.co.uk/v1/repair_symptom_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/repair_symptom_type_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the repair_symptom_type_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/repair_symptom_type_linker or /v1/repair_symptom_type_linker/<repair_symptom_type_linker_id>
method GET
url_params repair_symptom_type_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/repair_symptom_type_linker/<repair_symptom_type_linker_id>
method PUT
url_params repair_symptom_type_linker_id of the repair_symptom_type_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/repair_symptom_type_linker/<repair_symptom_type_linker_id>
method DELETE
url_params repair_symptom_type_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Repair Workflow Event

Audit trail of workflow events associated with product repairs

The repair_workflow_event object

Field Description
repair_workflow_event_id
int (primary key)
A unique integer identifier for each repair_workflow_event.
repair_id
int (not-null,foreign-key)
current_state_id
string (not-null)
event_id
string (not-null)
payload
unknown-type
next_state_id
string
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

We can retrieve the repair_workflow_event created by specifying its repair_workflow_event_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_workflow_events/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "repair_workflow_event_id": 1
        "repair_id": 1,
        "current_state_id": "test",
        "event_id": "test",
        "payload": Unknown column type,
        "next_state_id": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all repair_workflow_events by omitting the repair_workflow_event_id:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_workflow_events'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/repair_workflow_events or /v1/repair_workflow_events/<repair_workflow_event_id>
method GET
url_params repair_workflow_event_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Repair Workflow History

History of actions associated with product repair workflows, to support undo functionality

The repair_workflow_history object

Field Description
repair_workflow_history_id
int (primary key)
A unique integer identifier for each repair_workflow_history.
repair_id
int (not-null,foreign-key)
start_state_id
string
end_state_id
string
update_commands_bin
unknown-type
can_undo
boolean
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

GET requests are not allowed at this endpoint

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

### GET GET requests are not allowed at this endpoint

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Repair Workflow Selector

Rules determining the workflow to use when a repair is created

The repair_workflow_selector object

Field Description
repair_workflow_selector_id
int (primary key)
A unique integer identifier for each repair_workflow_selector.
product_type_id
int (not-null,foreign-key)
ProductType identifier
workflow_name
string
The name workflow of the workflow to be used. Null indicates that a repair workflow cannot be created by a user matching this rule
selector_type
string (not-null)
The rule type.
options: ["USER", "ENTITY"]
selector_value
string (not-null)
The value to be matched. Email address for a 'USER' rule; GEIC code for an 'ENTITY' rule
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that repair_workflow_selector_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/repair_workflow_selectors"
    data = json.dumps({
        "product_type_id": 1,
        "workflow_name": "test",
        "selector_type": "test",
        "selector_value": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "repair_workflow_selector_id": 1
        "product_type_id": 1,
        "workflow_name": "test",
        "selector_type": "test",
        "selector_value": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the repair_workflow_selector created by specifying its repair_workflow_selector_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_workflow_selectors/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "repair_workflow_selector_id": 1
        "product_type_id": 1,
        "workflow_name": "test",
        "selector_type": "test",
        "selector_value": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all repair_workflow_selectors by omitting the repair_workflow_selector_id:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_workflow_selectors'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created repair_workflow_selector with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_workflow_selectors/1'
    data = json.dumps({
        "product_type_id": 2,
        "workflow_name": "changed",
        "selector_type": "changed",
        "selector_value": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "repair_workflow_selector_id": 1
        "product_type_id": 2,
        "workflow_name": "changed",
        "selector_type": "changed",
        "selector_value": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the repair_workflow_selector

    url = 'https://smartapi.bboxx.co.uk/v1/repair_workflow_selectors/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/repair_workflow_selectors
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the repair_workflow_selector that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/repair_workflow_selectors or /v1/repair_workflow_selectors/<repair_workflow_selector_id>
method GET
url_params repair_workflow_selector_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/repair_workflow_selectors/<repair_workflow_selector_id>
method PUT
url_params repair_workflow_selector_id of the repair_workflow_selector you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/repair_workflow_selectors/<repair_workflow_selector_id>
method DELETE
url_params repair_workflow_selector_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Repair Workflow State

Records time spent in product repair workflow states

The repair_workflow_state object

Field Description
repair_workflow_state_id
int (primary key)
A unique integer identifier for each repair_workflow_state.
repair_id
int (not-null,foreign-key)
state_id
string
entry_time
datetime
exit_time
datetime
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

We can retrieve the repair_workflow_state created by specifying its repair_workflow_state_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_workflow_states/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "repair_workflow_state_id": 1
        "repair_id": 1,
        "state_id": "test",
        "entry_time": "2000-01-01 00:00:00",
        "exit_time": "2000-01-01 00:00:00",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all repair_workflow_states by omitting the repair_workflow_state_id:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_workflow_states'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/repair_workflow_states or /v1/repair_workflow_states/<repair_workflow_state_id>
method GET
url_params repair_workflow_state_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Repair Centre

Details of Repair Centres

The repair_centre object

Field Description
repair_centre_id
int (primary key)
A unique integer identifier for each repair_centre.
name
string (not-null,unique)
Repair Centre name
entity_id
int (not-null,unique,foreign-key)
Entity identifier
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that repair_centre_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/repair_centres"
    data = json.dumps({
        "name": "test",
        "entity_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "repair_centre_id": 1
        "name": "test",
        "entity_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the repair_centre created by specifying its repair_centre_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_centres/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "repair_centre_id": 1
        "name": "test",
        "entity_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all repair_centres by omitting the repair_centre_id:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_centres'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created repair_centre with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/repair_centres/1'
    data = json.dumps({
        "name": "changed",
        "entity_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "repair_centre_id": 1
        "name": "changed",
        "entity_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the repair_centre

    url = 'https://smartapi.bboxx.co.uk/v1/repair_centres/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/repair_centres
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the repair_centre that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/repair_centres or /v1/repair_centres/<repair_centre_id>
method GET
url_params repair_centre_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/repair_centres/<repair_centre_id>
method PUT
url_params repair_centre_id of the repair_centre you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/repair_centres/<repair_centre_id>
method DELETE
url_params repair_centre_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Rtc Connection History

Contains a history of each RTC unit's connection status changes

The rtc_connection_history object

Field Description
rtc_connection_history_id
int (primary key)
A unique integer identifier for each rtc_connection_history.
product_imei
varchar(15) (not-null,foreign-key)
connection_status
string (not-null)

options: ["online", "offline"]
connection_status_time
datetime (not-null)
connection_status_reason
string (not-null)

options: ["user-request", "unknown", "low-battery-voltage", "inactivity", "sleep-mode", "message-received"]
connection_status_info
string
latest_message_time
datetime
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

We can retrieve the rtc_connection_history created by specifying its rtc_connection_history_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/rtc_connection_history/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "rtc_connection_history_id": 1
        "product_imei": "000000000000000",
        "connection_status": "test",
        "connection_status_time": "2000-01-01 00:00:00",
        "connection_status_reason": "test",
        "connection_status_info": "test",
        "latest_message_time": "2000-01-01 00:00:00",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all rtc_connection_history by omitting the rtc_connection_history_id:

    url = 'https://smartapi.bboxx.co.uk/v1/rtc_connection_history'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

If a user has SYSTEM permissions they can delete the rtc_connection_history

    url = 'https://smartapi.bboxx.co.uk/v1/rtc_connection_history/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/rtc_connection_history or /v1/rtc_connection_history/<rtc_connection_history_id>
method GET
url_params rtc_connection_history_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

value
endpoint /v1/rtc_connection_history/<rtc_connection_history_id>
method DELETE
url_params rtc_connection_history_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

RTCDeadLetter

Lists RTC mobile-orginated (MO) messages that could not be processed by SMART Solar.

The rtc_dead_letter object

Field Description
rtc_dead_letter_id
int (primary key)
A unique integer identifier for each rtc_dead_letter entry.
queue_name
text (not-null)
The name of the queue where the message originated: 'RTC-MO' or 'RTC-MT.Reply'
payload
text (not-null)
The message payload as a JSON string
status
text
The status of the message: 'replayed', 'discarded', (unprocessed)
status_time
datetime
Time of the last status change
replay_status
text
If the message has been replayed, this will contain the status of the replay attempt: 'success' or 'failure'. Otherwise
replay_status_text
text
More detail on the replay status
replay_status_time
datetime
Time the replay_status was updated
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

> We can retrieve a rtc_dead_letter by specifying its rtc_dead_letter_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/rtc_dead_letter/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "rtc_dead_letter": 1,
        "queue_name": "RTC-MO",
        "payload": "{\"ident\": \"Aeris/10.112.89.62\", \"message\": \"ggSfghpaebuvaUNvbm5lY3RlZP8=\", \"correlation_id\": \"d478ea0eeadc47e8aead97502235ccac\", \"timestamp\": \"2018-02-06T14:29:14.349698\", \"ident_type\": \"IP\"}",
        "status": "replayed",
        "status_time": "2000-01-01 00:00:00",
        "replay_status": "success",
        "replay_status_text": None,
        "replay_status_time": "2000-01-01 00:00:00",
        "created_at": "2000-01-01 00:00:00",
        "created_by": "test.user@bboxx.co.uk",
        "modified_at": None
    }

We can retrieve all rtc_dead_letter entries by omitting the rtc_dead_letter_id:

    url = 'https://smartapi.bboxx.co.uk/v1/rtc_dead_letter'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/rtc_dead_letter or /v1/rtc_dead_letter/<rtc_dead_letter_id>
method GET
url_params rtc_dead_letter (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Rtc Dead Letter

RTC messages that failed to be delivered.

The rtc_dead_letter object

Field Description
rtc_dead_letter_id
int (primary key)
A unique integer identifier for each rtc_dead_letter.
queue_name
unknown-type (not-null)
payload
string (not-null)
status
string

options: ["discarded", "replayed"]
status_time
datetime
replay_status
string

options: ["failure", "success"]
replay_status_text
string
replay_status_time
datetime
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

We can retrieve the rtc_dead_letter created by specifying its rtc_dead_letter_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/rtc_dead_letters/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "rtc_dead_letter_id": 1
        "queue_name": Unknown column type,
        "payload": "test",
        "status": "test",
        "status_time": "2000-01-01 00:00:00",
        "replay_status": "test",
        "replay_status_text": "test",
        "replay_status_time": "2000-01-01 00:00:00",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all rtc_dead_letters by omitting the rtc_dead_letter_id:

    url = 'https://smartapi.bboxx.co.uk/v1/rtc_dead_letters'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/rtc_dead_letters or /v1/rtc_dead_letters/<rtc_dead_letter_id>
method GET
url_params rtc_dead_letter_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Rtc Fallback Message History

Contains a history of occurrences of RTC Status Update messages sent to units by the fallback process

The rtc_fallback_message_history object

Field Description
rtc_fallback_message_history_id
int (primary key)
A unique integer identifier for each rtc_fallback_message_history.
product_imei
varchar(15) (not-null,foreign-key)
message_sent_time
datetime (not-null)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

GET requests are not allowed at this endpoint

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

### GET GET requests are not allowed at this endpoint

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Rtc Message History

Contains a history of RTC messages sent to each unit.

The rtc_message_history object

Field Description
rtc_message_history_id
int (primary key)
A unique integer identifier for each rtc_message_history.
product_imei
varchar(15) (not-null,foreign-key)
message_reference
string
message_bin
unknown-type
message_sent_time
datetime (not-null)
delivery_status
string

options: ["failed", "delivered"]
delivery_status_time
datetime
delivery_status_info
string
message_json
string
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

GET requests are not allowed at this endpoint

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

### GET GET requests are not allowed at this endpoint

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Rtc Mo Message History

Contains a history of RTC messages received from each unit.

The rtc_mo_message_history object

Field Description
rtc_mo_message_history_id
int (primary key)
A unique integer identifier for each rtc_mo_message_history.
product_imei
varchar(15) (not-null,foreign-key)
message_bin
unknown-type
message_json
string
message_received_time
datetime (not-null)
processing_status
string

options: ["failed", "processed"]
processing_status_info
string
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

We can retrieve the rtc_mo_message_history created by specifying its rtc_mo_message_history_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/rtc_mo_message_history/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "rtc_mo_message_history_id": 1
        "product_imei": "000000000000000",
        "message_bin": Unknown column type,
        "message_json": "test",
        "message_received_time": "2000-01-01 00:00:00",
        "processing_status": "test",
        "processing_status_info": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all rtc_mo_message_history by omitting the rtc_mo_message_history_id:

    url = 'https://smartapi.bboxx.co.uk/v1/rtc_mo_message_history'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/rtc_mo_message_history or /v1/rtc_mo_message_history/<rtc_mo_message_history_id>
method GET
url_params rtc_mo_message_history_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Serial

Table used to generate new serial_numbers

The serial object

Field Description
serial_number
int (primary key)
A unique integer identifier for each serial.
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

GET requests are not allowed at this endpoint

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

### GET GET requests are not allowed at this endpoint

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Shop

Contains details of all the BBOXX shops. (obselete)

The shop object

Field Description
shop_id
int (primary key)
A unique integer identifier for each shop.
name
string (not-null,unique)
guid
string (unique)
hub_id
int (not-null,foreign-key)
latitude
varchar(12)
longitude
varchar(12)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
products The associated products



An example POST request. Note that shop_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/shops"
    data = json.dumps({
        "name": "test",
        "guid": "test",
        "hub_id": 1,
        "latitude": "-1.111111111",
        "longitude": "-1.111111111",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "shop_id": 1
        "name": "test",
        "guid": "test",
        "hub_id": 1,
        "latitude": "-1.111111111",
        "longitude": "-1.111111111",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the shop created by specifying its shop_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/shops/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "shop_id": 1
        "name": "test",
        "guid": "test",
        "hub_id": 1,
        "latitude": "-1.111111111",
        "longitude": "-1.111111111",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all shops by omitting the shop_id:

    url = 'https://smartapi.bboxx.co.uk/v1/shops'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created shop with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/shops/1'
    data = json.dumps({
        "name": "changed",
        "guid": "changed",
        "hub_id": 2,
        "latitude": "-9.999999999",
        "longitude": "-9.999999999",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "shop_id": 1
        "name": "changed",
        "guid": "changed",
        "hub_id": 2,
        "latitude": "-9.999999999",
        "longitude": "-9.999999999",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the shop

    url = 'https://smartapi.bboxx.co.uk/v1/shops/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/shops
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the shop that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/shops or /v1/shops/<shop_id>
method GET
url_params shop_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/shops/<shop_id>
method PUT
url_params shop_id of the shop you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/shops/<shop_id>
method DELETE
url_params shop_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Sim Part Type Sim Provider Linker

Specifies which SIM types are associated with which provider

The sim_part_type_sim_provider_linker object

Field Description
sim_part_type_sim_provider_linker_id
int (primary key)
A unique integer identifier for each sim_part_type_sim_provider_linker.
sim_part_type_id
int (not-null,unique,foreign-key)
sim_provider_id
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that sim_part_type_sim_provider_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/sim_part_type_sim_provider_linker"
    data = json.dumps({
        "sim_part_type_id": 1,
        "sim_provider_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "sim_part_type_sim_provider_linker_id": 1
        "sim_part_type_id": 1,
        "sim_provider_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the sim_part_type_sim_provider_linker created by specifying its sim_part_type_sim_provider_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/sim_part_type_sim_provider_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "sim_part_type_sim_provider_linker_id": 1
        "sim_part_type_id": 1,
        "sim_provider_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all sim_part_type_sim_provider_linker by omitting the sim_part_type_sim_provider_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/sim_part_type_sim_provider_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created sim_part_type_sim_provider_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/sim_part_type_sim_provider_linker/1'
    data = json.dumps({
        "sim_part_type_id": 2,
        "sim_provider_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "sim_part_type_sim_provider_linker_id": 1
        "sim_part_type_id": 2,
        "sim_provider_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the sim_part_type_sim_provider_linker

    url = 'https://smartapi.bboxx.co.uk/v1/sim_part_type_sim_provider_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/sim_part_type_sim_provider_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the sim_part_type_sim_provider_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/sim_part_type_sim_provider_linker or /v1/sim_part_type_sim_provider_linker/<sim_part_type_sim_provider_linker_id>
method GET
url_params sim_part_type_sim_provider_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/sim_part_type_sim_provider_linker/<sim_part_type_sim_provider_linker_id>
method PUT
url_params sim_part_type_sim_provider_linker_id of the sim_part_type_sim_provider_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/sim_part_type_sim_provider_linker/<sim_part_type_sim_provider_linker_id>
method DELETE
url_params sim_part_type_sim_provider_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Sim Provider Network Linker

Specifies which networks are available to each SIM provider

The sim_provider_network_linker object

Field Description
sim_provider_network_linker_id
int (primary key)
A unique integer identifier for each sim_provider_network_linker.
sim_provider_id
int (not-null,foreign-key)
network_id
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that sim_provider_network_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/sim_provider_network_linker"
    data = json.dumps({
        "sim_provider_id": 1,
        "network_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "sim_provider_network_linker_id": 1
        "sim_provider_id": 1,
        "network_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the sim_provider_network_linker created by specifying its sim_provider_network_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/sim_provider_network_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "sim_provider_network_linker_id": 1
        "sim_provider_id": 1,
        "network_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all sim_provider_network_linker by omitting the sim_provider_network_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/sim_provider_network_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created sim_provider_network_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/sim_provider_network_linker/1'
    data = json.dumps({
        "sim_provider_id": 2,
        "network_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "sim_provider_network_linker_id": 1
        "sim_provider_id": 2,
        "network_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the sim_provider_network_linker

    url = 'https://smartapi.bboxx.co.uk/v1/sim_provider_network_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/sim_provider_network_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the sim_provider_network_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/sim_provider_network_linker or /v1/sim_provider_network_linker/<sim_provider_network_linker_id>
method GET
url_params sim_provider_network_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/sim_provider_network_linker/<sim_provider_network_linker_id>
method PUT
url_params sim_provider_network_linker_id of the sim_provider_network_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/sim_provider_network_linker/<sim_provider_network_linker_id>
method DELETE
url_params sim_provider_network_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Sim Provider

Contains a list of SIM providers

The sim_provider object

Field Description
sim_provider_id
int (primary key)
A unique integer identifier for each sim_provider.
name
string (not-null,unique)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that sim_provider_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/sim_providers"
    data = json.dumps({
        "name": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "sim_provider_id": 1
        "name": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the sim_provider created by specifying its sim_provider_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/sim_providers/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "sim_provider_id": 1
        "name": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all sim_providers by omitting the sim_provider_id:

    url = 'https://smartapi.bboxx.co.uk/v1/sim_providers'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created sim_provider with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/sim_providers/1'
    data = json.dumps({
        "name": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "sim_provider_id": 1
        "name": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the sim_provider

    url = 'https://smartapi.bboxx.co.uk/v1/sim_providers/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/sim_providers
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the sim_provider that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/sim_providers or /v1/sim_providers/<sim_provider_id>
method GET
url_params sim_provider_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/sim_providers/<sim_provider_id>
method PUT
url_params sim_provider_id of the sim_provider you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/sim_providers/<sim_provider_id>
method DELETE
url_params sim_provider_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Sms History

This description is not yet complete it should be filled in!

The sms_history object

Field Description
sms_history_id
int (primary key)
A unique integer identifier for each sms_history.
attempted_retries
int (not-null)
enable_history_id
int (foreign-key)
message_reference
string
message
string
product_imei
varchar(15) (not-null,foreign-key)
sent_time
datetime (not-null)
sms_timeout
datetime (not-null)
status
string
trigger
string
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
Relationship Description

There are no relatioships for this table.

HTTP Requests

An example POST request. Note that sms_history_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/sms_histories"
    data = json.dumps({
        "attempted_retries": 1,
        "enable_history_id": 1,
        "message_reference": "test",
        "message": "test",
        "product_imei": "000000000000000",
        "sent_time": "2000-01-01 00:00:00",
        "sms_timeout": "2000-01-01 00:00:00",
        "status": "test",
        "trigger": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + <valid_token>}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "sms_history_id": 1
        "attempted_retries": 1,
        "enable_history_id": 1,
        "message_reference": "test",
        "message": "test",
        "product_imei": "000000000000000",
        "sent_time": "2000-01-01 00:00:00",
        "sms_timeout": "2000-01-01 00:00:00",
        "status": "test",
        "trigger": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the sms_history created by specifying its sms_history_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/sms_histories/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + <valid_token>}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "sms_history_id": 1
        "attempted_retries": 1,
        "enable_history_id": 1,
        "message_reference": "test",
        "message": "test",
        "product_imei": "000000000000000",
        "sent_time": "2000-01-01 00:00:00",
        "sms_timeout": "2000-01-01 00:00:00",
        "status": "test",
        "trigger": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

and we can retrieve all sms_histories by omitted the sms_history_id:

    url = 'https://smartapi.bboxx.co.uk/v1/sms_histories'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + <valid_token>}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created sms_history with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/sms_histories'
    data = json.dumps({
        "attempted_retries": 2,
        "enable_history_id": 2,
        "message_reference": "changed",
        "message": "changed",
        "product_imei": "999999999999999",
        "sent_time": "2016-07-01 12:34:45",
        "sms_timeout": "2016-07-01 12:34:45",
        "status": "changed",
        "trigger": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + <valid_token>}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "sms_history_id": 1
        "attempted_retries": 2,
        "enable_history_id": 2,
        "message_reference": "changed",
        "message": "changed",
        "product_imei": "999999999999999",
        "sent_time": "2016-07-01 12:34:45",
        "sms_timeout": "2016-07-01 12:34:45",
        "status": "changed",
        "trigger": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the sms_history

    url = 'https://smartapi.bboxx.co.uk/v1/sms_histories/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + <valid_token>}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/sms_histories
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the sms_history that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/sms_histories or /v1/sms_histories/<sms_history_id>
method GET
url_params sms_history_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/sms_histories/<sms_history_id>
method PUT
url_params sms_history_id of the sms_history you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/sms_histories/<sms_history_id>
method DELETE
url_params sms_history_id (pk_type)
query params N/A
body N/A
permissions SYSTEM
response 204

Software Version Type

Contains the details of the possible software-version-types that a unit can have running.

The software_version_type object

Field Description
software_version_type_id
int (primary key)
A unique integer identifier for each software_version_type.
name
string (not-null,unique)
description
string
link
string
checksum
varchar(8)
release_date
datetime (not-null)
parameter_types
array
status
unknown-type

options: ["outdated", "stable", "beta", "bad"]
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
product_type_software_version_type_linker The associated product_type_software_version_type_linker
product_software_linker The associated product_software_linker
latest_software The associated latest_software



An example POST request. Note that software_version_type_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/software_version_types"
    data = json.dumps({
        "name": "test",
        "description": "test",
        "link": "test",
        "checksum": "checksum",
        "release_date": "2000-01-01 00:00:00",
        "parameter_types": [1,2,3],
        "status": Unknown column type,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "software_version_type_id": 1
        "name": "test",
        "description": "test",
        "link": "test",
        "checksum": "checksum",
        "release_date": "2000-01-01 00:00:00",
        "parameter_types": [1,2,3],
        "status": Unknown column type,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the software_version_type created by specifying its software_version_type_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/software_version_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "software_version_type_id": 1
        "name": "test",
        "description": "test",
        "link": "test",
        "checksum": "checksum",
        "release_date": "2000-01-01 00:00:00",
        "parameter_types": [1,2,3],
        "status": Unknown column type,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all software_version_types by omitting the software_version_type_id:

    url = 'https://smartapi.bboxx.co.uk/v1/software_version_types'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created software_version_type with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/software_version_types/1'
    data = json.dumps({
        "name": "changed",
        "description": "changed",
        "link": "changed",
        "checksum": "csedited",
        "release_date": "2016-07-01 12:34:45",
        "parameter_types": [1,2,3,4,5,6],
        "status": Unknown column type,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "software_version_type_id": 1
        "name": "changed",
        "description": "changed",
        "link": "changed",
        "checksum": "csedited",
        "release_date": "2016-07-01 12:34:45",
        "parameter_types": [1,2,3,4,5,6],
        "status": Unknown column type,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the software_version_type

    url = 'https://smartapi.bboxx.co.uk/v1/software_version_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/software_version_types
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the software_version_type that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/software_version_types or /v1/software_version_types/<software_version_type_id>
method GET
url_params software_version_type_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/software_version_types/<software_version_type_id>
method PUT
url_params software_version_type_id of the software_version_type you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/software_version_types/<software_version_type_id>
method DELETE
url_params software_version_type_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

State

Contains the current and historical state of every unit

The state object

Field Description
state_id
int (primary key)
A unique integer identifier for each state.
product_imei
varchar(15) (not-null,foreign-key)
prev_state_type
int (not-null,foreign-key)
current_state_type
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

We can retrieve the state created by specifying its state_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/states/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "state_id": 1
        "product_imei": "000000000000000",
        "prev_state_type": 1,
        "current_state_type": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all states by omitting the state_id:

    url = 'https://smartapi.bboxx.co.uk/v1/states'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/states or /v1/states/<state_id>
method GET
url_params state_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

State Type

Contains details of the possible types of state that a product can be in

The state_type object

Field Description
state_type_id
int (primary key)
A unique integer identifier for each state_type.
name
string (not-null,unique)
description
string
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
states The associated states
energy_limit_states The associated energy_limit_states



An example POST request. Note that state_type_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/state_types"
    data = json.dumps({
        "name": "test",
        "description": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "state_type_id": 1
        "name": "test",
        "description": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the state_type created by specifying its state_type_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/state_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "state_type_id": 1
        "name": "test",
        "description": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all state_types by omitting the state_type_id:

    url = 'https://smartapi.bboxx.co.uk/v1/state_types'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created state_type with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/state_types/1'
    data = json.dumps({
        "name": "changed",
        "description": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "state_type_id": 1
        "name": "changed",
        "description": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the state_type

    url = 'https://smartapi.bboxx.co.uk/v1/state_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/state_types
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the state_type that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/state_types or /v1/state_types/<state_type_id>
method GET
url_params state_type_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/state_types/<state_type_id>
method PUT
url_params state_type_id of the state_type you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/state_types/<state_type_id>
method DELETE
url_params state_type_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Subscriber

A table containing subscribers to our API service

The subscriber object

Field Description
subscriber_id
int (primary key)
A unique integer identifier for each subscriber.
url
string (not-null)
channel_name
string (not-null,foreign-key)
entity_id
int (foreign-key)
key
varchar(24) (not-null)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



POST requests are not allowed at this endpoint

We can retrieve the subscriber created by specifying its subscriber_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/subscribers/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "subscriber_id": 1
        "url": "test",
        "channel_name": "test",
        "entity_id": 1,
        "key": "awjs875jg7thskr9485984rf",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all subscribers by omitting the subscriber_id:

    url = 'https://smartapi.bboxx.co.uk/v1/subscribers'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

PUT requests are not allowed at this endpoint

DELETE requests are not allowed at this endpoint

POST

POST requests are not allowed at this endpoint

GET

value
endpoint /v1/subscribers or /v1/subscribers/<subscriber_id>
method GET
url_params subscriber_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

PUT requests are not allowed at this endpoint

DELETE

DELETE requests are not allowed at this endpoint

Symptom Type Product Type Linker

Specifies which symptom_types are valid for which product_types

The symptom_type_product_type_linker object

Field Description
symptom_type_product_type_linker_id
int (primary key)
A unique integer identifier for each symptom_type_product_type_linker.
product_type_id
int (not-null,foreign-key)
symptom_type_id
int (not-null,foreign-key)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that symptom_type_product_type_linker_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/symptom_type_product_type_linker"
    data = json.dumps({
        "product_type_id": 1,
        "symptom_type_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "symptom_type_product_type_linker_id": 1
        "product_type_id": 1,
        "symptom_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the symptom_type_product_type_linker created by specifying its symptom_type_product_type_linker_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/symptom_type_product_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "symptom_type_product_type_linker_id": 1
        "product_type_id": 1,
        "symptom_type_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all symptom_type_product_type_linker by omitting the symptom_type_product_type_linker_id:

    url = 'https://smartapi.bboxx.co.uk/v1/symptom_type_product_type_linker'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created symptom_type_product_type_linker with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/symptom_type_product_type_linker/1'
    data = json.dumps({
        "product_type_id": 2,
        "symptom_type_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "symptom_type_product_type_linker_id": 1
        "product_type_id": 2,
        "symptom_type_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the symptom_type_product_type_linker

    url = 'https://smartapi.bboxx.co.uk/v1/symptom_type_product_type_linker/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/symptom_type_product_type_linker
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the symptom_type_product_type_linker that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/symptom_type_product_type_linker or /v1/symptom_type_product_type_linker/<symptom_type_product_type_linker_id>
method GET
url_params symptom_type_product_type_linker_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/symptom_type_product_type_linker/<symptom_type_product_type_linker_id>
method PUT
url_params symptom_type_product_type_linker_id of the symptom_type_product_type_linker you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/symptom_type_product_type_linker/<symptom_type_product_type_linker_id>
method DELETE
url_params symptom_type_product_type_linker_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Symptom Type

Lists various symptoms that a product can present when coming in for repair.

The symptom_type object

Field Description
symptom_type_id
int (primary key)
A unique integer identifier for each symptom_type.
name
string (not-null,unique)
description
string
label
string (not-null,unique)
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
symptom_type_product_type_linker The associated symptom_type_product_type_linker
repair_symptom_type_linker The associated repair_symptom_type_linker



An example POST request. Note that symptom_type_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/symptom_types"
    data = json.dumps({
        "name": "test",
        "description": "test",
        "label": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "symptom_type_id": 1
        "name": "test",
        "description": "test",
        "label": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the symptom_type created by specifying its symptom_type_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/symptom_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "symptom_type_id": 1
        "name": "test",
        "description": "test",
        "label": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all symptom_types by omitting the symptom_type_id:

    url = 'https://smartapi.bboxx.co.uk/v1/symptom_types'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created symptom_type with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/symptom_types/1'
    data = json.dumps({
        "name": "changed",
        "description": "changed",
        "label": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "symptom_type_id": 1
        "name": "changed",
        "description": "changed",
        "label": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the symptom_type

    url = 'https://smartapi.bboxx.co.uk/v1/symptom_types/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/symptom_types
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the symptom_type that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/symptom_types or /v1/symptom_types/<symptom_type_id>
method GET
url_params symptom_type_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/symptom_types/<symptom_type_id>
method PUT
url_params symptom_type_id of the symptom_type you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/symptom_types/<symptom_type_id>
method DELETE
url_params symptom_type_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Test Jig Test Result

Test results from the BBOXX test jig

The test_jig_test_result object

Field Description
test_jig_test_result_id
int (primary key)
A unique integer identifier for each test_jig_test_result.
jig_id
unknown-type
machine_id
unknown-type
product_imei
varchar(15) (not-null,foreign-key)
jig_software_version
unknown-type
user
string (not-null)
passed
boolean (not-null)
results
unknown-type
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that test_jig_test_result_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/test_jig_test_results"
    data = json.dumps({
        "jig_id": Unknown column type,
        "machine_id": Unknown column type,
        "product_imei": "000000000000000",
        "jig_software_version": Unknown column type,
        "user": "test",
        "passed": True,
        "results": Unknown column type,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "test_jig_test_result_id": 1
        "jig_id": Unknown column type,
        "machine_id": Unknown column type,
        "product_imei": "000000000000000",
        "jig_software_version": Unknown column type,
        "user": "test",
        "passed": True,
        "results": Unknown column type,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the test_jig_test_result created by specifying its test_jig_test_result_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/test_jig_test_results/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "test_jig_test_result_id": 1
        "jig_id": Unknown column type,
        "machine_id": Unknown column type,
        "product_imei": "000000000000000",
        "jig_software_version": Unknown column type,
        "user": "test",
        "passed": True,
        "results": Unknown column type,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all test_jig_test_results by omitting the test_jig_test_result_id:

    url = 'https://smartapi.bboxx.co.uk/v1/test_jig_test_results'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created test_jig_test_result with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/test_jig_test_results/1'
    data = json.dumps({
        "jig_id": Unknown column type,
        "machine_id": Unknown column type,
        "product_imei": "999999999999999",
        "jig_software_version": Unknown column type,
        "user": "changed",
        "passed": False,
        "results": Unknown column type,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "test_jig_test_result_id": 1
        "jig_id": Unknown column type,
        "machine_id": Unknown column type,
        "product_imei": "999999999999999",
        "jig_software_version": Unknown column type,
        "user": "changed",
        "passed": False,
        "results": Unknown column type,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the test_jig_test_result

    url = 'https://smartapi.bboxx.co.uk/v1/test_jig_test_results/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/test_jig_test_results
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the test_jig_test_result that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/test_jig_test_results or /v1/test_jig_test_results/<test_jig_test_result_id>
method GET
url_params test_jig_test_result_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/test_jig_test_results/<test_jig_test_result_id>
method PUT
url_params test_jig_test_result_id of the test_jig_test_result you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/test_jig_test_results/<test_jig_test_result_id>
method DELETE
url_params test_jig_test_result_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Associates Smart Solar users with Repair Centres

Field Description
user_repair_centre_link_id
int (primary key)
A unique integer identifier for each user_repair_centre_link.
username
string (not-null,unique)
Email address of the user
repair_centre_id
int (not-null,unique,foreign-key)
Repair Centre identifier
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that user_repair_centre_link_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "https://smartapi.bboxx.co.uk/v1/user_repair_centre_links"
    data = json.dumps({
        "username": "test",
        "repair_centre_id": 1,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "user_repair_centre_link_id": 1
        "username": "test",
        "repair_centre_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve the user_repair_centre_link created by specifying its user_repair_centre_link_id in the request url:

    url = 'https://smartapi.bboxx.co.uk/v1/user_repair_centre_links/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "user_repair_centre_link_id": 1
        "username": "test",
        "repair_centre_id": 1,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all user_repair_centre_links by omitting the user_repair_centre_link_id:

    url = 'https://smartapi.bboxx.co.uk/v1/user_repair_centre_links'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created user_repair_centre_link with a PUT request:

    url = 'https://smartapi.bboxx.co.uk/v1/user_repair_centre_links/1'
    data = json.dumps({
        "username": "changed",
        "repair_centre_id": 2,
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "user_repair_centre_link_id": 1
        "username": "changed",
        "repair_centre_id": 2,
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the user_repair_centre_link

    url = 'https://smartapi.bboxx.co.uk/v1/user_repair_centre_links/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/user_repair_centre_links
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the user_repair_centre_link that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/user_repair_centre_links or /v1/user_repair_centre_links/<user_repair_centre_link_id>
method GET
url_params user_repair_centre_link_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/user_repair_centre_links/<user_repair_centre_link_id>
method PUT
url_params user_repair_centre_link_id of the user_repair_centre_link you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/user_repair_centre_links/<user_repair_centre_link_id>
method DELETE
url_params user_repair_centre_link_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

Product Actions

This sections lists endpoints which can be used to perform specific actions on a product or query specific data quickly and simply.

/products/create_hub2

A POST request to this endpoint will create a new hub 2 product on the system

    url = "https://smartapi.bboxx.co.uk/v1/products/create_hub2"
    data = json.dumps({"imsi": "213514135171353",
                       "imei": "010101234560005",
                       "device_key": "4ab1ab3ab1ab7ab9ab1ab4ab",
                       "product": {"assembler": "Assembly House 1"}})
    headers = {"Content-Type": "application/json", "Authorization": "Token token=" + A_VALID_TOKEN}

    r = requests.post(url=url, data=data, headers=headers)

    print r.json()
    >>> {
        "status": "success"
        "data": {"pcb": {"part_id": 1651798,
                         "part_type_id": 77,
                         "serial": "010101234560005"},
                 "product": {"device_key": "4ab1ab3ab1ab7ab9ab1ab4ab",
                             "imsi": "213514135171353",
                             "product_imei": "010101234560005",
                             "product_type_id": 7,
                             "serial_number": "HB000501-084031-B",
                             "assembler": "Assembly House 1"},
                 "sim": {"imsi": "213514135171353",
                         "part_id": 1651797,
                         "part_type_id": 43}},
        "message": "Hub2Product: HB000501-084031-B - (010101234560005) created.",
    }

This endpoint will create a new hub 2 product on the system

This is a convenience endpoint which is equivalent to calling /parts/create_hyena_pcb followed by calling /products/create_product/hub2

value
endpoint /products/create_hub2
method POST
url_params None
payload {"imei": <imei>,
  "imsi": <imsi>,
  "device_key": <device_key>,
  "pcb_part_type_id": <part_type_id> (optional, default=77),
  "sim_part_type_id": <part_id> (optional, default=43),
  "iccid": <iccid> (optional, if given then sim part will be created with this as serial_number, otherwise will be the imsi}
response 200
permissions FACTORY

/products/create_enterprise

A POST request to this endpoint will create a new enterprise product on the system

    url = "https://smartapi.bboxx.co.uk/v1/products/create_enterprise"
    data = json.dumps({"imsi": "213514135171353",
                       "imei": "010101234560005",
                       "device_key": "4ab1ab3ab1ab7ab9ab1ab4ab",
                       "battery": {
                           "part_type_id": 72,
                           "serial_number": "BC4pDRSReEFnMHzHARHI7Gr9",
                        },
                       "solar_panel_wattage": 100,
                       "product": {"assembler": "Assembly House 1"}
                      })
    headers = {"Content-Type": "application/json", "Authorization": "Token token=" + A_VALID_TOKEN}

    r = requests.post(url=url, data=data, headers=headers)

    print r.json()
    >>> {"status": "success"
         "data": {"battery": {"part_id": 1693186,
                              "part_type_id": 72,
                              "serial": u'BC4pDRSReEFnMHzHARHI7Gr9'},
                  "pcb": {"part_id": 1651800,
                          "part_type_id": 77,
                          "serial": "010101234560005"},
                  "product": {"device_key": "4ab1ab3ab1ab7ab9ab1ab4ab",
                              "imsi": "213514135171353",
                              "product_imei": "010101234560005",
                              "product_type_id": 4,
                              "serial_number": "HB000501-084032-G",
                              "assembler": "Assembly House 1"},
                  "sim": {"imsi": "213514135171353",
                          "part_id": 1651799,
                          "part_type_id": 43}},
         "message": "EnterpriseProduct: HB000501-084032-G - (010101234560005) created.",
     } 

This endpoint will create a new enterprise product on the system

This is a convenience endpoint which is equivalent to calling /parts/create_hyena_pcb followed by calling /products/create_product/enterprise

value
endpoint /products/create_enterprise
method POST
url_params None
payload {"imei": <imei>,
  "imsi": <imsi>,
  "device_key": <device_key>,
  "pcb_part_type_id": <part_type_id> (optional, default=77),
  "sim_part_type_id": <part_id> (optional, default=43),
  "iccid": <iccid> (optional, if given then sim part will be created with this as serial_number, otherwise will be the imsi}
response 200
permissions FACTORY

/products/create_product/home2

A POST request to this endpoint will create a new home 2 product on the system using an existing pcb

    url = "https://smartapi.bboxx.co.uk/v1/products/create_product/home2"
    data = json.dumps({"pcb_imei": "010101234560005",
                       "battery": {
                           "part_type_id": 45,
                           "serial_number": "BC4pDRSReEFnMHzHARHI7Gr9",
                        },
                        "product": {"assembler": "Assembly House 1"}
                      })
    headers = {"Content-Type": "application/json", "Authorization": "Token token=" + A_VALID_TOKEN}

    r = requests.post(url=url, data=data, headers=headers)

    print r.json()
    >>> {"status": "success"
         "data": {"battery": {"part_id": 1693186,
                              "part_type_id": 45,
                              "serial": u'BC4pDRSReEFnMHzHARHI7Gr9'},
                  "pcb": {"part_id": 1651800,
                          "part_type_id": 44,
                          "serial": "010101234560005"},
                  "product": {"device_key": "4ab1ab3ab1ab7ab9ab1ab4ab",
                              "imsi": "213514135171353",
                              "product_imei": "010101234560005",
                              "product_type_id": 6,
                              "serial_number": "HB000501-084032-G",
                              "assembler": "Assembly House 1"},
                  "sim": {"imsi": "213514135171353",
                          "part_id": 1651799,
                          "part_type_id": 43}},
         "message": "Home2Product: HB000501-084032-G - (010101234560005) created.",
     }

This endpoint will create a new home 2 product on the system using an existing pcb

value
endpoint /products/create_product/home2
method POST
url_params None
payload {"pcb_imei": <imei>,
  "battery": {"part_type_id": <part_type_id>,
                        "serial_number": <serial_number>}
}
response 200
permissions FACTORY

/products/create_product/home3

A POST request to this endpoint will create a new home 3 product on the system using an existing pcb (jackal pcb)

    url = "https://smartapi.bboxx.co.uk/v1/products/create_product/home3"
    data = json.dumps({
                'pcb_imei': '110932356179789',
                'battery': {
                        'part_type_id': 18004, 
                        'serial_number': 'BC4pDRSReEFnMHzHARHI7Gr9'
                }
            })
    headers = {"Content-Type": "application/json", "Authorization": "Token token=" + A_VALID_TOKEN}

    r = requests.post(url=url, data=data, headers=headers)

    print r.json()
    >>> {
        "data":{
            "battery":{
                "part_id":18024,
                "part_type_id":18004,
                "serial_number":"BC4pDRSReEFnMHzHARHI7Gr9"
            },
            "pcb":{
                "part_id":18023,
                "part_type_id":158,
                "properties":{
                    "device_key":"000000000000000000000004",
                    "erp_code_override":"PA04010102",
                    "iccid":"66685607592181745482",
                    "imei":"110932356179789",
                    "imsi":"748655857675019",
                    "serial_number":"PA040000-018002-9"
                },
                "serial_number":"110932356179789"
            },
            "product":{
                "device_key":"000000000000000000000004",
                "iccid":"66685607592181745482",
                "imei":"110932356179789",
                "imsi":"748655857675019",
                "product_imei":"110932356179789",
                "product_type_id":10,
                "serial_number":"PA040000-018002-9"
            },
            "sim":{
                "part_id":18022,
                "part_type_id":43,
                "serial_number":"66685607592181745482"
            }
        },
        "message":"new Home3 product successfully created.",
        "status":"success"
}

This endpoint will create a new home 3 product on the system using an existing pcb

value
endpoint /products/create_product/home3
method POST
url_params None
payload {"pcb_imei": <imei>,
  "battery": {"part_type_id": <part_type_id>,
                        "serial_number": <serial_number>}
}
response 200
permissions FACTORY

/products/create_product/hub2

A POST request to this endpoint will create a new hub 2 product on the system using an existing pcb

    url = "https://smartapi.bboxx.co.uk/v1/products/create_product/hub2"
    data = json.dumps({"pcb_imei": "010101234560005", "product": {"assembler": "Assembly House 1"}})
    headers = {"Content-Type": "application/json", "Authorization": "Token token=" + A_VALID_TOKEN}

    r = requests.post(url=url, data=data, headers=headers)

    print r.json()
    >>> {"status": "success"
         "data": {"pcb": {"part_id": 1651800,
                          "part_type_id": 77,
                          "serial": "010101234560005"},
                  "product": {"device_key": "4ab1ab3ab1ab7ab9ab1ab4ab",
                              "imsi": "213514135171353",
                              "product_imei": "010101234560005",
                              "product_type_id": 7,
                              "serial_number": "HB000501-084032-G",
                              "assembler": "Assembly House 1"},
                  "sim": {"imsi": "213514135171353",
                          "part_id": 1651799,
                          "part_type_id": 43}},
         "message": "Hub2Product: HB000501-084032-G - (010101234560005) created.",
     }

This endpoint will create a new hub 2 product on the system using an existing pcb

value
endpoint /products/create_product/hub2
method POST
url_params None
payload {"pcb_imei": <imei>}
response 200
permissions FACTORY

/products/create_product/enterprise

A POST request to this endpoint will create a new enterprise product on the system using an existing pcb

    url = "https://smartapi.bboxx.co.uk/v1/products/create_product/enterprise"
    data = json.dumps({"pcb_imei": "010101234560005",
                       "battery": {
                           "part_type_id": 72,
                           "serial_number": "BC4pDRSReEFnMHzHARHI7Gr9",
                        },
                       "solar_panel_wattage": 100,
                       "product": {"assembler": "Assembly House 1"}
                      })
    headers = {"Content-Type": "application/json", "Authorization": "Token token=" + A_VALID_TOKEN}

    r = requests.post(url=url, data=data, headers=headers)

    print r.json()
    >>> {"status": "success"
         "data": {"battery": {"part_id": 1693186,
                              "part_type_id": 72,
                              "serial": u'BC4pDRSReEFnMHzHARHI7Gr9'},
                  "pcb": {"part_id": 1651800,
                          "part_type_id": 77,
                          "serial": "010101234560005"},
                  "product": {"device_key": "4ab1ab3ab1ab7ab9ab1ab4ab",
                              "imsi": "213514135171353",
                              "product_imei": "010101234560005",
                              "product_type_id": 4,
                              "serial_number": "HB000501-084032-G",
                              "assembler": "Assembly House 1"},
                  "sim": {"imsi": "213514135171353",
                          "part_id": 1651799,
                          "part_type_id": 43}},
         "message": "EnterpriseProduct: HB000501-084032-G - (010101234560005) created.",
     } 

This endpoint will create a new enterprise product on the system using an existing pcb

value
endpoint /products/create_product/enterprise
method POST
url_params None
payload {"pcb_imei": <imei>,
  "battery": {"part_type_id": <part_type_id>,
                        "serial_number": <serial_number>}
  "solar_panel_wattage": 100
}
response 200
permissions FACTORY

/products/<imei>/enable

A PUT request to this endpoint enables the unit.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/enable"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, headers=headers)

    print r.json()
    >>> {
        "status": "success", 
        "message": "Product enabled", 
        "data": None
    }

This endpoint is used to enable (switch-on) a unit. The imei of the unit to be enabled is specified in the url.

value
endpoint /products/<imei>/enable
method PUT
url_params product_imei (str)
payload None
response 200

Pending Status and Enable History

A unit's status will only change once it makes an RC-GET connection the SMARTSolar API and retrieves it's new status before then its actual status is unchanged. To reflect this the unit is placed in a "pending" state. The pending state therefore means that the unit has been enabled (or disabled) but has not yet connected to the system to update its status.

For example:

The enable_history table

The changes above are tracked in the enable_history table. Each time an unit has a change of state this is recorded in the enable_history table, along with the user who caused the change.

WakeUp

Current WAKEUP ENABLED software:

WAKEUP_ENABLED_SOFTWARE = [
    "2.15",
    "2.16",
    "3.2",
    "3.3",
    "3.4",
    "3.5",
    "3.6",
    "3.6a",
    "hub-stc-1",
    "hub-stc-2",
    "hub-stc-3",
    "hub-stc-4",
    "hub-stc-5",
    "hub-stc-6",
]

Waiting for a unit to make an RC-GET connection can take a long time - up to 4hrs! To avoid such slow response times when enabling or disabling a unit, the unit is automatically sent a WAKEUP SMS message. This message, if received correctly, causes the unit to "wakeup" and make an RC-GET connection immediately. This usually results in a response time of ~ 2mins for enable and disable operations. The WAKEUP will only be sent to units with compatible software (see right). Each sent SMS will be stored in the sms_history table where you can check the status of the SMS and confirm it's delivery (or lack-of!). For more details of SMS and WAKEUP see "SMS and WAKEUP".

/products/<imei>/disable

A PUT request to this endpoint disables the unit.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/disable"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, headers=headers)

    print r.json()
    >>> {
        "status": "success", 
        "message': "Product disabled", 
        "data": None
    }

This endpoint is used to disable (switch-off) a unit. The imei of the unit to be disabled is specified in the url.

value
endpoint /products/<imei>/disable
method PUT
url_params product_imei (str)
payload None
response 200

Note that if a unit is already disabled the API will return "success" anyway.

Pending Status and Enable History

A unit's status will only change once it makes an RC-GET connection the SMARTSolar API and retrieves it's new status before then its actual status is unchanged. To reflect this the unit is placed in a "pending" state. The pending state therefore means that the unit has been enabled (or disabled) but has not yet connected to the system to update its status.

For example:

The enable_history table

The changes above are tracked in the enable_history table. Each time an unit has a change of state this is recorded in the enable_history table, along with the user who caused the change.

WakeUp

Current WAKEUP ENABLED software:

WAKEUP_ENABLED_SOFTWARE = [
    "2.15",
    "2.16",
    "3.2",
    "3.3",
    "3.4",
    "3.5",
    "3.6",
    "3.6a",
    "hub-stc-1",
    "hub-stc-2",
    "hub-stc-3",
    "hub-stc-4",
    "hub-stc-5",
    "hub-stc-6",
]

Waiting for a unit to make an RC-GET connection can take a long time - up to 4hrs! To avoid such slow response times when enabling or disabling a unit, the unit is automatically sent a WAKEUP SMS message. This message, if received correctly, causes the unit to "wakeup" and make an RC-GET connection immediately. This usually results in a response time of ~ 2mins for enable and disable operations. The WAKEUP will only be sent to units with compatible software (see right). Each sent SMS will be stored in the sms_history table where you can check the status of the SMS and confirm it's delivery (or lack-of!). For more details of SMS and WAKEUP see "SMS and WAKEUP".

/products/<imei>/update_software

A PUT request to this endpoint with set the unit to upgrade to the specified software when it next connects to the system.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/update_software"
    data = json.dumps({"software": <software_id> or <software_name>})
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, data=data, headers=headers)

    print r.json()
    >>> {
        "status": "success", 
        "message": "#866771029490827 updated to software_version <version_name>", 
        "data": None
    }

This endpoint is used to update the software a unit. The imei of the unit to be enbaled is specified in the url.

value
endpoint /products/<imei>/update_software
method PUT
url_params product_imei (str)
payload {"software": or }
response 200
permissions SYSTEM

The endpoint accepts both software_version_type_id or name. A complete list of the available software versions types can retreived from the /software_version_type_id endpoint.

A unit can have its software "locked" to a certain version. If the software is locked then it cannot be updated. See Software and Locking for more information.

/products/<imei>/lock_software

A PUT request to this endpoint will lock the software on the unit to the specified software.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/lock_software"
    data = json.dumps({"software": <software_id> or <software_name>})
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, data=data, headers=headers)

    print r.json()
    >>> {
        "status": "success", 
        "message": "#866771029490827 updated and locked to software_version <version_name>", 
        "data": {
            "software_lock_id": <id>,
            "software_lock_name": <name>,
    }

A PUT request with blank payload will remove the software lock.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/lock_software"
    data = json.dumps({"software": None})
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, data=data, headers=headers)

    print r.json()
    >>> {
        "status": "success", 
        "message": "#866771029490827 software_lock is now removed", 
        "data": {
            "software_lock_id": None,
            "software_lock_name": None,
        }
    }

This endpoint is used to update the software a unit. The imei of the unit to be enbaled is specified in the url. A lock is removed by making a PUT request to this endpoint with a blank payload.

value
endpoint /products/<imei>/lock_software
method PUT
url_params product_imei (str)
payload {"software": or }
response 200
permissions SYSTEM

The endpoint accepts both software_version_type_id or name. A complete list of the available software versions types can retreived from the /software_version_type_id endpoint.

A unit can have its software "locked" to a certain version. If the software is locked then it cannot be updated. See Software and Locking for more information.

/products/<imei>/expire_software_updates

A PUT request to this endpoint expires all pending software updates.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/expire_software_updates"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, headers=headers)

    print r.json()
    >>> {
        "status": "success", 
        "message": "Product 013950003928166 had 1 software update(s) expired", 
        "data": None,
    }

If there are no pending updates to expire, the response would instead be:

    >>> {
        "status": "success", 
        "message": "Product 013950003928166 had no pending updates to expire", 
        "data": None,
    }

This endpoint is used to remove a pending software update.

value
endpoint /products/<imei>/expire_software_updates
method PUT
url_params product_imei (str)
payload None
response 200
permissions SYSTEM

Please see the Software section of the docs for a comprehensive explanation of the way that the software on the unit is handled.

/products/<imei>/assign_entity

A PUT request to this endpoint assigns an entity to the specified entity.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/assign_entity"
    data = json.dumps({"entity_id": 5})
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, data=data headers=headers)

    print r.json()
    >>> {
        "status": "success", 
        "message": "Product #866771029508370 assigned to entity: 5", 
        "data": {
            "866771029508370": ["Test Entity"]
        }
    }

This endpoint is used to assign an entity to a unit. A succesful request will generate a 200 response and return a list of all entites that this unit is assigned to.

value
endpoint /products/<imei>/assign_entity
method PUT
url_params product_imei (str)
payload {"entity_id": <id>}
response 200

Entity Id

The body of the PUT should be a valid entity_id. You can see a list of entities by querying the /entities endpoint.

Unknown Entity

All units with no entity are assigned to entity #1 - Unknown Entity. This entity is removed as soon as a new entity is assigned to the unit. If all entities are removed the unit is re-assigned to Unknown Entity.

Multiple Entities

A unit can be assigned to many entities. To add a new entity to the existing list simply use /products/<imei>/assign_entity. To change the entity rather than adding a new entity see /products/<imei>/change_entity To remove an entity see `/products//remove_entity

/products/<imei>/change_entity

Since a Product can be assigned to multiple entities a specific endpoint is required to change the entity that a product belongs to.

A PUT request to this endpoint changes the specified entity to an another entity.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/change_entity"
    data = json.dumps({
        "old_entity_id": 5,
        "new_entity_id": 6
    })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, data=data headers=headers)

    print r.json()
    >>>{
        "status": "success"
        "message": "Product #000000000000000 assigned to entity: 4",
        "data": {
            "000000000000000": ["BBOXX Capital Kenya"]
        },
    }

This endpoint is used to change the entity to which a unit is. A succesful request will generate a 200 response and return a list of all entites that this unit is assigned to.

value
endpoint /products/<imei>/change_entity
method PUT
url_params product_imei (int)
payload {"old_entity_id": <id>, "new_entity_id": <id>}
response 200

Entity Id

The body of the PUT should be a valid entity_id. You can see a list of entities by querying the /entities endpoint.

Unknown Entity

All units with no entity are assigned to entity #1 - Unknown Entity. This entity is removed as soon as a new entity is assigned to the unit. If all entities are removed the unit is re-assigned to Unknown Entity.

Multiple Entities

A unit can be assigned to many entities. To add a new entity to the existing list simply use /products/<imei>/assign_entity. To change the entity rather than adding a new entity see /products/<imei>/change_entity To remove an entity see `/products//remove_entity

/products/<imei>/remove_entity

Use this endpoint to remove an entity from the product.

A PUT request to this endpoint removes the specified entity.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/remove_entity"
    data = json.dumps({
        "entity_id": 4,
    })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, data=data headers=headers)

    print r.json()
    >>>{
        "status": "success"
        "message": "Entity #4 removed from Product #000000000000000",
        "data": {
            "000000000000000": ["BBOXX Capital Kenya"]
        },
    }

This endpoint is used to change the entity to which a unit is. A succesful request will generate a 200 response and return a list of all entites that this unit is assigned to.

value
endpoint /products/<imei>/remove
method PUT
url_params product_imei (str)
payload {"entity_id": <id>}
response 200

Entity Id

The body of the PUT should be a valid entity_id. You can see a list of all entities by querying the /entities endpoint and a list of the entites with a particular product by querying the Product Entity Linker.

Unknown Entity

All units with no entity are assigned to entity #1 - Unknown Entity. This entity is removed as soon as a new entity is assigned to the unit. If all entities are removed the unit is re-assigned to Unknown Entity.

Multiple Entities

A unit can be assigned to many entities. To add a new entity to the existing list simply use /products/<imei>/assign_entity. To change the entity rather than adding a new entity see /products/<imei>/change_entity To remove an entity see `/products//remove_entity

/products/<imei>/enable_tamper_switch

Description

Each unit is fitted with a "tamper_switch" which will raise alerts if a customer is tampering with a unit. This switch can be enabled/disabled remotely, particularly useful for periods of time where the switch could be accidentally trigger raising a false alert. This is common in, for example, transportation or installation.

Endpoint

A PUT request to this endpoint enables the tamper switch on the unit.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/enable_tamper_switch"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, headers=headers)

    print r.json()
    >>> {
        "status": "success", 
        "message': "Product #000000000000000 tamper_switch_enabled", 
        "data": None
    }

This endpoint is used to enable the tamper switch on a unit. The imei of the unit to be enabled is specified in the url.

value
endpoint /products/<imei>/enable_tamper_switch
method PUT
url_params product_imei (str)
payload None
response 200

Note that if a unit is already enabled the API will return "success" anyway.

Pending Status and Enable History

A unit's tamper_switch status will only change once it makes an RC-GET connection to the SMARTSolar API and retrieves it's new status. Until the RC-GET is complete the unit's actual status is unchanged. To reflect this the unit is placed in a "pending" state. The pending state therefore means that the tamper switch has been enabled (or disabled) but has not yet connected to the system to update its status.

For example:

The tamper_enable_history table

The changes above are tracked in the tamper_enable_history table. Each time a unit has a change of state this is recorded in the tamper_enable_history table, along with the user who caused the change.

/products/<imei>/disable_tamper_switch

Description

Each unit is fitted with a "tamper_switch" which will raise alerts if a customer is tampering with a unit. This switch can be enabled/disabled remotely, particularly useful for periods of time where the switch could be accidentally trigger raising a false alert. This is common in, for example, transportation or installation.

Endpoint

A PUT request to this endpoint disables the tamper switch on the unit.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/disable_tamper_switch"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, headers=headers)

    print r.json()
    >>> {
        "status": "success", 
        "message': "Product #000000000000000 tamper_switch_disabled", 
        "data": None
    }

This endpoint is used to disable the tamper switch on a unit. The imei of the unit to be disabled is specified in the url.

value
endpoint /products/<imei>/disable_tamper_switch
method PUT
url_params product_imei (str)
payload None
response 200

Note that if a unit is already disabled the API will return "success" anyway.

Pending Status and Enable History

A unit's tamper_switch status will only change once it makes an RC-GET connection to the SMARTSolar API and retrieves it's new status. Until the RC-GET is complete the unit's actual status is unchanged. To reflect this the unit is placed in a "pending" state. The pending state therefore means that the tamper switch has been enabled (or disabled) but has not yet connected to the system to update its status.

For example:

The tamper_enable_history table

The changes above are tracked in the tamper_enable_history table. Each time a unit has a change of state this is recorded in the tamper_enable_history table, along with the user who caused the change.

/products/<imei>/send_wakeup

Description

It is possible to force the unit to connect, download new status information and upload its telemetry data to the system. This is done by sending a WAKEUP sms. For more information about unit connectivity and why this might be desirable please see this section of the docs

Endpoint

A POST request to this endpoint will send a wakeup-sms to the unit and force it to connect to the system. The response will include the sms_history record that us created as a result of the request.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/send_wakeup"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.post(url=url, headers=headers)

    print r.json()
    >>> {
        "data": {
            "sms_history_id": 37571,
            "product_imei": "013950005303699",
            "attempted_retries": 0,
            "enable_history_id": null,
            "sent_time": "2016-08-08T16:34:56.860081",
            "sms_timeout": 3600.0,
            "status": null,
            "trigger": "wakeup"
            "message": null,
            "message_reference": "/41a8b4b06a019949/12882393256110756",
            "created_at": "2016-08-08T16:34:56.886694",
            "modified_at": null,
            "created_by": "u.celery@bboxx.co.uk",
        },
        "message": "sms successfully sent",
        "status": "success"
    }

This endpoint is used to send a wakeup-sms to a unit and force it to connect to the system. The response will include the sms_history record that us created as a result of the request.

value
endpoint /products/<imei>/send_wakeup
method POST
url_params product_imei (str)
payload None
response 200
permissions ADMIN

Delivery Notifications

A record of each sms is kept in the sms_history_table. This includes a status column which can be read as follows:

/products/<imei>/balance_and_pending_payments

Description

A GET request to this endpoint will return the balance, expected expiry and pending payment commands associated with that unit.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/balance_and_pending_payments"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    print(r.json())

    >>>{
        "status": "success",
        "message": "Balance and pending credits.",
        "data": {
            "balance": 432000,
            "expected_expiry": "2020-11-06T07:07:45.796359",
            "pending_payment_commands": [
                {
                    "category": "force-reset",
                    "created_at": "2020-11-06T07:07:45.742314",
                    "modified_at": "2020-11-06T07:07:45.742314",
                    "value": 0
                },
                {
                    "category": "zero-command",
                    "created_at": "2020-11-06T07:02:44.906775",
                    "modified_at": "2020-11-06T07:07:45.742314",
                    "value": 0
                },
                {
                    "category": "payment",
                    "created_at": "2020-10-29T12:40:49.443969",
                    "modified_at": "2020-11-06T07:07:45.742314",
                    "value": 2592000
                }
            ]
        }
    }


A GET request to this endpoint will return:

Endpoint

value
endpoint /products/<imei>/balance_and_pending_payments
method GET
url_params product_imei (str)
payload None
response 200
__permissions OVERVIEW

/products/<imei>/parts

Description

A GET request to this endpoint will return a complete list of parts and related data currently associated with that unit.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/parts"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    print r.json()
    >>> {
        "message": "Parts found.",
        "status": "success",
        "data": {
            "10737": {
              "created_at": "2015-07-02T11:50:23",
              "created_by": "d.mclean@bboxx.co.uk",
              "modified_at": null,
              "part_id": 10737,
              "part_product_linker": {
                "added_repair_id": null,
                "created_at": "2015-07-02T11:50:25",
                "created_by": "d.mclean@bboxx.co.uk",
                "date_added": "2015-07-02T11:50:24",
                "date_removed": null,
                "modified_at": null,
                "part_id": 10737,
                "part_product_linker_id": 10719,
                "product_imei": "013950005303699",
                "removed_repair_id": null,
                "replaced_part_id": null
              },
              "part_type": {
                "created_at": "2015-04-10T10:48:40",
                "created_by": "d.mclean@bboxx.co.uk",
                "description": "A SIM card provided and activated by Vodafone",
                "erp_code": null,
                "modified_at": null,
                "name": "Vodafone SIM",
                "part_type_id": 1,
                "serial_number_category": "known"
              },
              "part_type_id": 1,
              "replacement_part_types": [
                {
                  "created_at": "2015-04-10T10:48:40",
                  "created_by": "d.mclean@bboxx.co.uk",
                  "description": "A SIM card provided and activated by Vodafone",
                  "erp_code": null,
                  "modified_at": null,
                  "name": "Vodafone SIM",
                  "part_type_id": 1,
                  "serial_number_category": "known"
                },
                {
                  "created_at": "2015-04-10T10:49:38",
                  "created_by": "d.mclean@bboxx.co.uk",
                  "description": "A SIM card provided and activated by Wireless Logic",
                  "erp_code": null,
                  "modified_at": null,
                  "name": "Wireless Logic SIM",
                  "part_type_id": 2,
                  "serial_number_category": "known"
                }
              ],
              "serial_number": "204043256110756"
            },
            "308501": {
              "created_at": "2016-06-14T09:48:39.622906",
              "created_by": "h.he@bboxx.co.uk",
              "modified_at": null,
              "part_id": 308501,
              "part_product_linker": {
                "added_repair_id": null,
                "created_at": "2016-06-14T09:48:40.486927",
                "created_by": "h.he@bboxx.co.uk",
                "date_added": "2016-06-14T09:48:40.748124",
                "date_removed": null,
                "modified_at": null,
                "part_id": 308501,
                "part_product_linker_id": 307244,
                "product_imei": "013950005303699",
                "removed_repair_id": null,
                "replaced_part_id": null
              },
              "part_type": {
                "created_at": "2016-03-10T15:40:46.578552",
                "created_by": "d.mclean@bboxx.co.uk",
                "description": "5A fuse",
                "erp_code": null,
                "modified_at": null,
                "name": "5A Fuse",
                "part_type_id": 13,
                "serial_number_category": "unknown"
              },
              "part_type_id": 13,
              "replacement_part_types": [
                {
                  "created_at": "2016-03-10T15:40:46.578552",
                  "created_by": "d.mclean@bboxx.co.uk",
                  "description": "5A fuse",
                  "erp_code": null,
                  "modified_at": null,
                  "name": "5A Fuse",
                  "part_type_id": 13,
                  "serial_number_category": "unknown"
                }
              ],
              "serial_number": "tCXYvInR0xwCQpzAnJS76dPfHMr1uTMmFRZs7Jj49to0P2wxzCPAfYzie2AvncZF"
            },
        }

This endpoint is designed to for use during repairs of the Unit. A GET request to this endpoint will return:

Endpoint

value
endpoint /products/<imei>/parts
method GET
url_params product_imei (str)
payload None
response 200
__permissions OVERVIEW

Response

The format of the data returned by this endpoint is a dictionary where the keys are part_ids and the value is another dictionary of the data associated with the part.

part_id: {part_data}

Where {part_data} is a dictionary as follows:

{ "part_id": id "part_type_id": type_id "serial_number":serial, "part_product_linker": linker dict "part_type": part_type_dict "replacement_part_types": [list-of-replacement-part_type-objects] "created_at": timestamp "created_by": user "modified_at": timestamp }

You can see an example of the full object in the code snippet to the right.

The intended use for this endpoint is for implementing repairs to BBOXX Units.

/products/<imei>/change_state

Description

Each unit is represented by a State Type which provides an overview of the unit within its lifecycle. There are currently 9 allowed State Types on units, each of which correspond with an integer state_type_id.

State Type state_type_id
NON_EXISTANT 1
STORED 2
SHIPPED 3
ACTIVATING 4
ACTIVATED 5
MONITORED 6
UNMONITORED 7
IN_REPAIR_SYSTEM 8
TERMINATED 9

Transition between State Types are strictly enforced and operate in the following way:

Original State Type Allowed Transitions
NON_EXISTANT STORED
STORED SHIPPED, TERMINATED
SHIPPED ACTIVATING, ACTIVATED, IN_REPAIR_SYSTEM, TERMINATED
ACTIVATING ACTIVATED, IN_REPAIR_SYSTEM, TERMINATED
ACTIVATED MONITORED, UNMONITORED, IN_REPAIR_SYSTEM, TERMINATED
MONITORED UNMONITORED, IN_REPAIR_SYSTEM, TERMINATED
UNMONITORED MONITORED, IN_REPAIR_SYSTEM, TERMINATED
IN_REPAIR_SYSTEM ACTIVATED, TERMINATED
TERMINATED

For example, a unit in IN_REPAIR_SYSTEM can only be moved into ACTIVATED or TERMINATED, all other transitions are disallowed.

State Type transitions are recorded in State with each State record containing product_imei, prev_state_type, current_state_type along with associated meta-data. For a full explanation of States see States

A PUT request to this endpoint changes the current State of the unit. A valid state_type_id need to be included in the data package. The following example shows demonstrates a unit transitioning from ACTIVATED(5) to IN_REPAIR_SYSTEM(8) successfully:

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/change_state"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}
    data = {
        "new_state": 8
    }

    r = requests.put(url=url, headers=headers, data=json.dumps(data))

    print r.json()
    >>> {
            u'status': u'success', 
            u'message': u'Product state changed'
        }

Here another PUT request is submitted to the endpoint, the unit is currently ACTIVATED(5) and an attempt to change it to STORED will result in failure:

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/change_state"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}
    data = {
        "new_state": 2
    }

    r = requests.put(url=url, headers=headers, data=json.dumps(data))

    print r.json()
    >>> {
            u'status': u'validation-error', 
            u'validation_errors': 
                {
                    u'state_transition': u" A unit may not transition from state '5' to state '2'"
                }, 
            u'message': u"Your request contained invalid data. See 'data' or 'validation_errors' for exact details", 
            u'data': 
                {
                    u'state_transition': u" A unit may not transition from state '5' to state '2'"
                }
        }

Endpoint

value
endpoint /products/<imei>/change_state
method PUT
url_params product_imei (str)
payload {"entity_id": <state_type_id>}
response 200
permissions ADMIN

/products/locations

Description

A GET request to this endpoint, by default, will return up to 1000 of latest recorded locations for your products. If you want more locations for a product, you can specify this in the parameters of the GET request under the value results_per_page (you will also need to pass the number of pages you want to display. If you just want the list, then just set page to the value of 1).

    url = "https://smartapi.bboxx.co.uk/v1/products/locations"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}
    params = {page: 1, results_per_page: 100000000}

    r = requests.get(url=url, headers=headers)

    print r.json()
    >>> {
            u'data': [
                {
                    u'error_radius': 2952,
                    u'latitude': u'-2.354956',
                    u'longitude': u'29.740627',
                    u'product_imei': u'861508031138712'
                },
                {
                    u'error_radius': 3560,
                    u'latitude': u'4.395848',
                    u'longitude': u'9.439759',
                    u'product_imei': u'862117022347339'
                },
                {
                    u'error_radius': 1936,
                    u'latitude': u'-1.591342',
                    u'longitude': u'30.071951',
                    u'product_imei': u'861508033164062'
                },
                {
                    u'error_radius': 1243,
                    u'latitude': u'-1.509023',
                    u'longitude': u'29.510557',
                    u'product_imei': u'866771029560751'
                },
                .
                .
                .
            ]
        }

This endpoint will return a complete list of products and their latest recorded locations.

Endpoint

value
endpoint /products/locations
method GET
url_params None
payload None
response 200
__permissions OVERVIEW

Response

The format of the data returned by this endpoint is a dictionary containing a single key: 'data'. The value is an array of dictionaries. Each dictionary contains the location info for a single product:

{
"product_imei": { imei },
"latitude": { latitude },
"longitude": { longitude }, "error_radius": { error_radius },
}

Parameter

A table containing the values of all parameters set on all unit. Each parameter is of a particular parameter type

The parameter object

Field Description
parameter_id
int (primary key)
A unique integer identifier for each parameter.
parameter_type_id
int (not-null,foreign-key)
product_imei
varchar(15) (not-null,foreign-key)
value
string (not-null)
date_added
datetime
date_removed
datetime
status
string

options: ["active", "removed", "expired", "pending"]
created_at
datetime
timestamp that the record was created at
created_by
text
username of the user who created the record
modified_at
datetime
timestamp that the record was last modified
modified_by
text
user that last modified the record


Relationship Description
N/A There are no relationships for this table.



An example POST request. Note that parameter_id, created_at, modified_at and created_by are all handled internally by the system and need not be explicitly specified. See Meta Data for more information.

    url = "http://smartapi.bboxx.co.uk/v1/parameters"
    data = json.dumps({
        "parameter_type_id": 1,
        "product_imei": "000000000000000",
        "value": "test",
        "date_added": "2000-01-01 00:00:00",
        "date_removed": "2000-01-01 00:00:00",
        "status": "test",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "parameter_id": 1
        "parameter_type_id": 1,
        "product_imei": "000000000000000",
        "value": "test",
        "date_added": "2000-01-01 00:00:00",
        "date_removed": "2000-01-01 00:00:00",
        "status": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

> We can retrieve the parameter created by specifying its parameter_id in the request url:

    url = 'http://smartapi.bboxx.co.uk/v1/parameters/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "parameter_id": 1
        "parameter_type_id": 1,
        "product_imei": "000000000000000",
        "value": "test",
        "date_added": "2000-01-01 00:00:00",
        "date_removed": "2000-01-01 00:00:00",
        "status": "test",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": None
    }

We can retrieve all parameters by omitting the parameter_id:

    url = 'http://smartapi.bboxx.co.uk/v1/parameters'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.get(url=url, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        u'total_pages': 1,
        u'objects': [
            {<record>},
            {<record>},
            {<record>},
            {<record>},
            {<record>},
        ],
        u'num_results': 10,
        u'page': 1
    }

We can edit the newly created parameter with a PUT request:

    url = 'http://smartapi.bboxx.co.uk/v1/parameters/1'
    data = json.dumps({
        "parameter_type_id": 2,
        "product_imei": "999999999999999",
        "value": "changed",
        "date_added": "2016-07-01 12:34:45",
        "date_removed": "2016-07-01 12:34:45",
        "status": "changed",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.put(url=url, data=data, headers=headers)

    r
    >>> <Response 200>

    r.json()
    >>> {
        "parameter_id": 1
        "parameter_type_id": 2,
        "product_imei": "999999999999999",
        "value": "changed",
        "date_added": "2016-07-01 12:34:45",
        "date_removed": "2016-07-01 12:34:45",
        "status": "changed",
        "created_at": "2000-01-01 00:00:00"
        "created_by": "test.user@bboxx.co.uk"
        "modified_at": 2016-07-07 12:34:45
    }

Note that the modified_at field has been updated accordingly.

If a user has SYSTEM permissions they can delete the parameter

    url = 'http://smartapi.bboxx.co.uk/v1/parameters/1'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.delete(url=url, headers=headers)

    r
    >>> <Response 204>

    r.text
    >>>

Note that the response from a 204 request is empty. This means that r.json() cannot be called and will throw a JSONDecodeError. In fact the response is u'' - an empty unicode string.

POST

value
endpoint /v1/parameters
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the parameter that you wish to create
permissions SYSTEM
response 201

GET

value
endpoint /v1/parameters or /v1/parameters/<parameter_id>
method GET
url_params parameter_id (int)
query params > See Query Format and Filtering
body N/A
permissions OVERVIEW
response 200

PUT

value
endpoint /v1/parameters/<parameter_id>
method PUT
url_params parameter_id of the parameter you wish to edit
query params N/A
body JSON-formatted dictionary of the columns that you wish to alter
permissions SYSTEM
response 200

DELETE

value
endpoint /v1/parameters/<parameter_id>
method DELETE
url_params parameter_id (int)
query params N/A
body N/A
permissions SYSTEM
response 204

/products/<imei>/parameters/history

Description

It is desirable to be able to see both the current configuration of a product and it's parts and the historical configuration of the product.

For this reason, all parameters (both product_parameters and part_parameters) are stored in the systems with the dates that they are added and removed and the user who assigned them.

The /parameters/history endpoint can either return:

Full Parameter History

If the user does not include a date in the request the API will return a complete history of all parameters for that unit for all time. This will include:

The date_added field indicates the time at which that parameter moved from pending -> active.
The date_removed field indicates the time at which that parameter moved from active -> removed.
pending parameters have neither date_added nor date_removed set.
expired parameters have date_added and date_removed immediately after each other.

Active parameter set on a given date

If a user includes a date with the GET request then the API will return the active parameter set at the specified date/time. This means it will return the list of parameters as the unit would have "seen them". It will adjust the states of the returned parameters to be current "as it was". It is therefore the case that a parameter which is listed as removed in the system should be returned as active if it was active at the time specified.

Endpoints

    url = "https://smartapi.bboxx.co.uk/v1/products/111010101010101/parameters/history"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    print r.json()
    >>> {
        "status": "success",
        "message": "Full parameter history for #111010101010101 returned successfully",
        "data":
            {
                "part_parameters":
                {
                    '616479':
                    [
                        {
                            'status': 'expired',
                            'modified_by': 'ci.system@bboxx.co.uk',
                            'part_parameter_id': 98,
                            'date_removed': '2016-10-21T11:38:16.961100',
                            'created_at': '2016-10-21T11:38:16.884380',
                            'modified_at': '2016-10-21T11:38:16.961501',
                            'created_by': 'ci.system@bboxx.co.uk',
                            'parameter_type_id': 52,
                            'value': '5',
                            'part_id': 616479,
                            'date_added':
                            '2016-10-21T11:38:16.960878'
                        },
                        {
                            'status': 'removed',
                            'modified_by': 'ci.system@bboxx.co.uk',
                            'part_parameter_id': 99,
                            'date_removed': '2016-10-21T11:38:18.285516',
                            'created_at': '2016-10-21T11:38:16.967994',
                            'modified_at': '2016-10-21T11:38:18.286111',
                            'created_by': 'ci.system@bboxx.co.uk',
                            'parameter_type_id': 52,
                            'value': '6',
                            'part_id': 616479,
                            'date_added': '2016-10-21T11:38:17.888303'
                        },
                        {
                            'status': 'active',
                            'modified_by': 'ci.system@bboxx.co.uk',
                            'part_parameter_id': 100,
                            'date_removed': None,
                            'created_at': '2016-10-21T11:38:18.087947',
                            'modified_at': '2016-10-21T11:38:18.287348',
                            'created_by': 'ci.system@bboxx.co.uk',
                            'parameter_type_id': 52,
                            'value': '7',
                            'part_id': 616479,
                            'date_added': '2016-10-21T11:38:18.285744'
                        }
                    ],
                    '616484': [],
                    '616483': [],
                    '616482': [],
                    '616481': [],
                    '616480': []
                },

                'product_parameters':
                [
                    {
                        'product_imei': '111010101010101',
                        'status': 'active',
                        'modified_by': 'ci.system@bboxx.co.uk',
                        'date_removed': None,
                        'created_at': '2016-10-21T11:36:55.397643',
                        'modified_at': '2016-10-21T11:38:17.590436',
                        'created_by': 'ci.system@bboxx.co.uk',
                        'parameter_type_id': 1,
                        'value': 'True',
                        'date_added': '2016-10-21T11:38:17.589958',
                        'product_parameter_id': 76796
                    },
                    {
                        'product_imei': '111010101010101',
                        'status': 'active',
                        'modified_by': 'ci.system@bboxx.co.uk',
                        'date_removed': None, 'created_at':
                        '2016-10-21T11:36:55.530771',
                        'modified_at': '2016-10-21T11:38:17.636904',
                        'created_by': 'ci.system@bboxx.co.uk',
                        'parameter_type_id': 2,
                        'value': 'False',
                        'date_added': '2016-10-21T11:38:17.636484',
                        'product_parameter_id': 76797
                    },
                    {
                        'product_imei': '111010101010101',
                        'status': 'expired',
                        'modified_by': 'ci.system@bboxx.co.uk',
                        'date_removed': '2016-10-21T11:38:16.995178',
                        'created_at': '2016-10-21T11:38:16.920406',
                        'modified_at': '2016-10-21T11:38:16.995607',
                        'created_by': 'ci.system@bboxx.co.uk',
                        'parameter_type_id': 52,
                        'value': '5',
                        'date_added': '2016-10-21T11:38:16.994943',
                        'product_parameter_id': 76864
                    },
                    {
                        'product_imei': '111010101010101',
                        'status': 'removed',
                        'modified_by': 'ci.system@bboxx.co.uk',
                        'date_removed': '2016-10-21T11:38:18.248536',
                        'created_at': '2016-10-21T11:38:17.004684',
                        'modified_at': '2016-10-21T11:38:18.249128',
                        'created_by': 'ci.system@bboxx.co.uk',
                        'parameter_type_id': 52,
                        'value': '6',
                        'date_added': '2016-10-21T11:38:17.680470',
                        'product_parameter_id': 76865
                    },
                    {
                        'product_imei': '111010101010101',
                        'status': 'active',
                        'modified_by': 'ci.system@bboxx.co.uk',
                        'date_removed': None,
                        'created_at': '2016-10-21T11:38:18.132115',
                        'modified_at': '2016-10-21T11:38:18.250434',
                        'created_by': 'ci.system@bboxx.co.uk',
                        'parameter_type_id': 52,
                        'value': '7',
                        'date_added':
                        '2016-10-21T11:38:18.248753',
                        'product_parameter_id': 76866
                    }
                ]
            }
        }
    }

Endpoint

To view the parameter history of a Product with a given imei make a GET request to /products/<imei>/parameters/history. You may optionally include a date(ISO 8601 format) filter in the payload:

data = json.dumps({"date": "Some date"})

value
endpoint /products/<imei>/parameters/history
method GET
url_params product_imei (str)
response 200
payload date (optional)
permissions OVERVIEW

Response

The format of the data returned by this endpoint is a dictionary where the keys are part_parameters and product_parameters.

The part_parameter dictionary contains integer keys which represent the part_id of a part which belongs to the product. The values linked to the key is a list of dictionaries, each of which represents a single parameter for the product.

The product_parameter dictionary consists of a single list of dictionaries which contains the parameters assigned to the product.

/products/<imei>/connectivity_reliability_rate

Description

For diagnosis of connectivity issues it is desirable to see the connectivity_reliability_rate of a unit

defined as:

connectivity_rate = actual-number-of-connections / expected-number-of-connections

This endpoint calculates the connectivity rate of a unit between the times start and end.

The endpoint assumes that a unit will connect once every four hours and will be pessimistic in it's calculations: ie: it will assume that in a 7 hour period a unit will connect only once.

It is possible (especially due to wake-ups) that a unit will connect more than once every four hours in this case the rate is "capped" at 1.00

Get the reliability rate for the default time range (previous 7 days)

    url = "https://smartapi.bboxx.co.uk/v1/products/111010101010101/connectivity_reliability_rate"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    print r.json()
    >>> {
        "status": "success",
        "message": "Successfully computed product connectivity reliability rate",
        "data": {
            "connectivity_reliability_rate": 0.85
        }
    }

Get the reliability rate for the last month

    url = "https://smartapi.bboxx.co.uk/v1/products/111010101010101/connectivity_reliability_rate"
    data = json.dumps({
        "start": (dt.datetime.utcnow() - dt.timedelta(days=30)).isoformat()
    })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, data=data, headers=headers)

    print r.json()
    >>> {
        "status": "success",
        "message": "Successfully computed product connectivity reliability rate",
        "data": {
            "connectivity_reliability_rate": 0.70
        }
    }

Get the reliability rate for the month before last


    url = "https://smartapi.bboxx.co.uk/v1/products/111010101010101/connectivity_reliability_rate"
    data = json.dumps({
        "start": "2017-01-01 00:00:00"
        "end": "2017-06-01 00:00:00"
    })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, data=data, headers=headers)

    print r.json()
    >>> {
        "status": "success",
        "message": "Successfully computed product connectivity reliability rate",
        "data": {
            "connectivity_reliability_rate": 1.00
        }
    }

Endpoint

To view the connectivity_reliability_rate of a Product with a given imei make a GET request to /products/<imei>/connectivit_reliability_rate. You may optionally include a date(ISO 8601 format) time-range in the payload:

data = json.dumps({"start": "start-date", "end": "end-date"})

value
endpoint /products/<imei>/connectivity_reliability_rate
method GET
url_params product_imei (str)
response 200
payload start, end (optional)
permissions OVERVIEW

Response

The format of the data returned by this endpoint is a dictionary with keys status, message, data.

The data key contains a dictionary with connectivity_reliability_rate:

If there are any formatting errors in requests the API will return error_code 400 and indicate the error in question in the message section of the response

/products/<imei>/available_networks

Description

For diagnosis of connectivity issues it is helpful to be able to see the networks that a unit could connect to, given its SIM type and the country it is in.

This endpoint returns the list of networks a unit could connect to in its current location.

Get the available networks for the unit in Rwanda (country code 635)

    url = "https://smartapi.bboxx.co.uk/v1/products/111010101010101/available_networks?mcc=635"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    print r.json()
    >>> {
        "status": "success",
        "data": {
            'networks': [
                {
                    'created_at': '2016-08-16T13:41:14.431241',
                    'created_by': 'user@bboxx.co.uk',
                    'mcc': 635,
                    'mccmnc': 63514,
                    'mnc': 14,
                    'modified_at': None,
                    'modified_by': None,
                    'name': 'Rwanda Airtel'
                },
                {
                    'created_at': '2016-08-16T13:41:14.431241',
                    'created_by': 'user@bboxx.co.uk',
                    'mcc': 635,
                    'mccmnc': 63510,
                    'mnc': 10,
                    'modified_at': None,
                    'modified_by': None,
                    'name': 'Rwanda MTN'
                }
            ]
        }
    }

Endpoint

To view the available_networks for a Product with a given imei make a GET request to /products/<imei>/available_networks, passing a mobile country code (MCC) value as a query argument.

value
endpoint /products/<imei>/available_networks?mcc=<mcc>
method GET
url_params product_imei (str)
response 200
payload None
permissions OVERVIEW

Response

The format of the data returned by this endpoint is a dictionary with keys status, data, and (optionally) message.

The data key contains an array of Network objects

If there are any formatting errors in requests the API will return error_code 400 and indicate the error in question in the message section of the response

/products/<imei>/command_request

A POST request to this endpoint sends a debug/diagnostic command to an RTC-enabled unit.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/command_request"
    data = json.dumps({"command": "atc 60 AT+CPOL=?;+COPS=?"})
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.post(url=url, headers=headers)

    print r.json()
    >>> {
            "status": "success",
            "message": "command successfully sent",
            "data": {}
    }

This endpoint sends a debug/diagnostic command to an RTC-enabled unit. The imei of the unit is specified in the url.

value
endpoint /products/<imei>/command_request
method POST
url_params product_imei (str)
payload {"command": <command>}
response 200

Command

The body of the POST should be a valid debug/diagnostic command.

/products/<imei>/sync

A POST request to this endpoint instructs an RTC-enabled unit to reply with up to date status and telemetry data.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/sync"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.post(url=url, headers=headers)

    print r.json()
    >>> {
            "status": "success",
            "message": "sync request successfully sent",
            "data": {}
    }

This endpoint instructs an RTC-enabled unit to reply with up to date status and telemetry data. The imei of the unit is specified in the url.

value
endpoint /products/<imei>/sync
method POST
url_params product_imei (str)
payload None
response 200

/products/<imei>/status_update

A POST request to this endpoint sends the latest parameter values to an RTC-enabled unit.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/status_update"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.post(url=url, headers=headers)

    print r.json()
    >>> {
            "status": "success",
            "message": "status update successfully sent",
            "data": {}
    }

This endpoint sends the latest parameter values to an RTC-enabled unit. The imei of the unit is specified in the url.

value
endpoint /products/<imei>/status_update
method POST
url_params product_imei (str)
payload None
response 200

/products/<imei>/rtc_online_status

A POST request to this endpoint sets the online status of an RTC-enabled unit.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/rtc_online_status"
    data = json.dumps({"status": "online"})
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.post(url=url, headers=headers)

    print r.json()
    >>> {
            "status": "success",
            "message": "RTC online status set",
            "data": {}
    }

This endpoint sets the online status of an RTC-enabled unit. The imei of the unit is specified in the url.

value
endpoint /products/<imei>/rtc_online_status
method POST
url_params product_imei (str)
payload {"status": <status>}
response 200

Status

The body of the POST should be a valid status value: 'online' or 'offline'.

/products/<imei>/force_connection

A POST request to this endpoint tells a unit to connect. For an RTC-enabled unit we will send a sync, for others we will send_wakeup.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/force_connection"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.post(url=url, headers=headers)

    print r.json()
    >>> {
            "status": "success",
            "message": "Force connection request sent",
            "data": {}
    }

This endpoint tells a unit to connect. For an RTC-enabled unit we will send a sync, for others we will send_wakeup. The imei of the unit is specified in the url.

value
endpoint /products/<imei>/force_connection
method POST
url_params product_imei (str)
payload None
response 200

/products/<imei>/get_repair

A GET request to this endpoint attempts to retrieve the current repair workflow for the given unit.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/get_repair"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    print r.json()
    >>> {
            "status": "success",
            "message": "Repair found",
            "data": {
                'repair_id': 1,
                'config': {
                    '12v_load_current': 1.0,
                    'usb_load_current': 1.7,
                    'connectivity_timeout': 120,
                    'discharge_voltage': 6.0,
                    'final_state_of_charge': 50,
                    'pass_capacity_mah': 8000
                }
            }
    }

This endpoint attempts to retrieve the current repair workflow for the given unit. If the unit is in IN_REPAIR state, but not currently associated with a repair workflow, a new workflow will be created and its identifier returned.

If the unit is not currently in IN_REPAIR state, an error response (status code 400) will be returned.

value
endpoint /products/<imei>/get_repair
method GET
url_params product_imei (str)
payload None
response 200

The format of the data returned by this endpoint is a dictionary with key status, data, and (optionally) message.

The data key contains a dictionary with key repair_id and (optionally) config. The value associated with the repair_id key is the identifier of the repair workflow. If present, the value of the config key is a dictionary containing configuration values to be used by the client application when communicating with the product under repair (the actual keys and values will vary by product type - the values shown above are just for illustrative purposes).

If there are any formatting errors in requests the API will return error_code 400 and indicate the error in question in the message section of the response

/products/<imei>/suggest_energy_limit

Description

The energy_limit is restricted by the energy_limit_cap, if it is set. Requests will be accepted and the energy_limit truncated if the requested limit is higher than the cap. The endpoint will inform the user of the requested and applied limit, the energy_limit_cap and explicitly state whether the requested limit has been truncated.

If a product has total_accessory_energy set, the endpoint will prevent the energy_limit being altered.

The unit must also be in either: ACTIVATED, MONITORED or IN_REPAIR_SYSTEM.

Endpoint

To suggest an energy limit on a Product with a given imei make a PUT request to /products/<imei>/suggest_energy_limit.

Energy limits are passed in as strings.

data = json.dumps({"energy_limit": "<suggested_energy_limit>"})

value
endpoint /products/<imei>/suggest_energy_limit
method PUT
url_params product_imei (str)
response 200
payload date (optional)
permissions TECHNICAL
    data = {"energy_limit": "<energy_limit>"}
    endpoint = "/products/{}/suggest_energy_limit".format(imei)
    r = self.put(endpoint, data=data, user=user, expected_response=expected_response)

    print(r.json())

    >>>{
        "status": "success",
        "message": message,
        "data": {
            "requested": requested_limit,
            "applied": applied_limit,
            "max_energy_limit": max_energy_limit,
            "min_energy_limit": min_energy_limit,
            "bounded": bounded
        } 200
    }


/products/<imei>/set_dcm_enabled_flag

A PUT request to this endpoint sets dcm_enabled_flag of a product.

    data = {"enabled": True}
    endpoint = "/products/{}/set_dcm_enabled_flag".format(imei)
    r = self.put(endpoint, data=data, user=user, expected_response=expected_response)

    print(r.json())

    >>>{
        "status": "success",
        "message": "Product 866771029508370. DCM Enabled Flag set to True",
        "data": None
    }


This endpoint sets dcm_enabled_flag of products. The imei of the unit is specified in the url.

BP20 devices are DCM enabled by default and cannot be modified using this endpoint. This endpoint is for making other products (e.g. BP50) DCM enabled.

value
endpoint /products/<imei>/set_dcm_enabled_flag
method PUT
url_params product_imei (str)
response 200
payload {"enabled": <enabled>}
permissions TECHNICAL

Enabled

The body of the PUT can either be {"enabled": True} or {"enabled": False}.

/products/<imei>/set_is_payg

A PUT request to this endpoint sets is_payg of a product.

    imei = 'XXYYZZXXYYZZ'
    data = {"is_payg": True}
    endpoint = "/products/{}/set_is_payg".format(imei)
    r = self.put(endpoint, data=data, user=user, expected_response=expected_response)

    print(r.json())

    >>>{
        "status": "success",
        "message": "is_payg for the Product XXYYZZXXYYZZ, has been set to=True",
        "data": None
    }


This endpoint sets is_payg of products. The imei of the unit is specified in the url.

A Product that has been completely paid off by the customer will have is_payg=False and S.S should not try to disable this unit even if it has used up all of its credits.

value
endpoint /products/<imei>/set_is_payg
method PUT
url_params product_imei (str)
response 200
payload {"is_payg": <bool: is the unit Pay As you Go>}
permissions TECHNICAL

Is Pay_As_You_Go?

The body of the PUT can either be {"is_payg": true} or {"is_payg": false}.

/upload_tool_log

A POST request to this endpoint is used to upload a log message from a manufacturing or repair tool to Influx.

    url = "https://smartapi.bboxx.co.uk/v1/upload_tool_log"
    data = json.dumps({
        "time": "2020-11-05T10:25:30Z",
        "message": "{\"serials\": {\"pcb\": \"BX0020-417157-M\", \"battery\": \"BT01090101-012042-0G9-3\", \"product\": \"BX0020-417157-M\"}, \"input_pv\": {\"value\": \"5.150\", \"pass\": true}, \"output_usb\": {\"value\": \"1.183\", \"pass\": true}, \"output_12v\": {\"value\": \"3.285\", \"pass\": true}}",
        "toolname": "bpower20_registration_production",
        "hostname": "CN-REG03",
        "machine_id": "593bfa0c",
        "passed": True,
        "product_imei": "866557056339858",
        "serial_number": "",
        "software_version": "0.3.0",
        "user": "mfg.sunworth@bboxx.co.uk",
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

    r = requests.post(url=url, data=data, headers=headers)

    r
    >>> <Response 201>

    r.json()

    >>> {
        "data": None
        "status": "success",
        "message": "Log uploaded successfully",
    }    

This endpoint uploads a log message from a manufacturing or repair tool to Influx.

The "time", "message" and "toolname" fields must be supplied with every request to this endpoint. The value of "toolname" determines which other fields are allowed

toolname permitted fields
tiger_test_jig_production jig_id, machine_id, user, time, software_version, passed, serial_number
tiger_test_jig_repair jig_id, machine_id, user, software_version, passed, serial_number, product_imei, count
koala_test_jig_production jig_id, machine_id, user, software_version, passed, serial_number, product_imei, hostname, control_board_revision
bpower20_registration_production machine_id, hostname, user, software_version, passed, serial_number, product_imei
bpower50_registration_production machine_id, hostname, user, software_version, passed, serial_number, product_imei

POST

value
endpoint /v1/upload_tool_log
method POST
url_params N/A
query params N/A
body JSON-formatted dictionary with the details of the log entry
permissions SYSTEM
response 201

If there are any formatting errors in requests the API will return error_code 400 and indicate the error in question in the message section of the response

Product Data

Along with the technical data described in the Schema , BBOXX collects telemetry data such as Current, Voltage and Temperature (amongst a range of others) from each unit. This time-series data is held in a separate time-series database.

BBOXX uses InfluxDB as it's time-series database.

Schema

InfluxDB uses measurements, fields and tags to uniquely identify data.

All measurements are stored inside retention policies. A measurement is a logical grouping of streams of incoming data. A field describes a single stream like current, voltage or temperature. The tags identify the unit that the data is generated from.

All data recorded from a unit is held in the relevant field. Some measurements, and some fields are currently only used by certain products.

There are several rentention policies and measurements inside the Bboxx instance of InfluxDB. Below is an overview of some of the fields inside the core measurements.

The telemetry measurement from the telemetry_rp retention policy contains the following fields:

field data-type
ac_current float
ac_voltage float
active_power float
apparent_power float
charge_current float
current float
current_in float
current_out float
dc_load_current float
energy float
pack_current float
panel_voltage float
product_imei integer
pulse_count integer
state_of_charge_percent integer
state_of_charge_wh float
temperature float
usb_current float
voltage float
voltage_cell_1 float
voltage_cell_2 float
voltage_cell_3 float
voltage_cell_4 float

The analysis measurement from the analysis_rp contains the following fields:

field data-type
discharge_ah float
discharge_end integer
discharge_imax float
discharge_vmax float
discharge_vmin float
discharge_wh float
energy_in float
energy_out float
gap_end float
lvd float
state_of_charge float

All products use the telemetry measurement to record data, so we'll be using that in our examples.

Inside telemetry datapoint is tagged with the product_imei. However some measurements have different tags.

Example 1

InfluxDB schema for a single unit storing I, V, T

name: telemetry            fld     fld       fld         tag
-----------------------------------------------------------------
time                     current voltage temperature product_imei

2016-09-02T08:30:42.645Z    1       2         3      013777946874001
2016-09-02T08:40:53.327Z    1       2         3      013777946874001
2016-09-02T08:41:56.348Z    1       2         3      013777946874001
2016-09-02T08:42:35.505Z    1       2         3      013777946874001

For example - a unit has product_imei: 013777946874001 This unit has 3 things being recorded:

The data would therefore be recorded in Influx as follows (see right):

Example 2

New schema for the 'telemetry' measurement with a second unit adding data.

name: telemetry            fld     fld       fld     fld   fld       tag
-------------------------------------------------------------------------------
time                     current voltage temperature c_in c_out  product_imei

2016-09-02T08:30:42.645Z    1       2         3                 013777946874001
2016-09-02T08:40:53.327Z    1       2         3                 013777946874001
2016-09-02T08:41:56.348Z    1       2         3                 013777946874001
2016-09-02T08:42:35.505Z    1       2         3                 013777946874001
2016-08-30T10:05:36.873Z    4       5         6       7     8   013950004127933
2016-08-30T10:06:00.734Z    4       5         6       7     8   013950004127933
2016-08-30T16:43:11.984Z    4       5         6       7     8   013950004127933
2016-08-30T16:43:22.646Z    4       5         6       7     8   013950004127933

A second unit has product_imei: 866771029491460 This unit has 5 things being recorded:

The influx data would therefore be now look like this (see right):

Note that two new fields have been added current_in, and current_out (abbreviated for readability), which are null for unit 4001 but filled for unit 7933. The telemetry measurement can support arbitrary new fields from a unit.

Users can query data relating to each product, specifying fields and tags as desired. See Reading Data for a Product for more information.

Writing Data to Influx

Data should be supplied in the following JSON data structure:

data = {
    "measurement": <measurement_name>,
    "tags": { "tag_name": <value> },
    "fields": {
        "field_name": [ [time, value], [time, value], [time, value] ]
        "field_name": [ [time, value], [time, value], [time, value] ]
        "field_name": [ [time, value], [time, value], [time, value] ]
    },
}

Below is a specific example for storing current, voltage and temperature:

data = {
    "measurement": "telemetry",
    "tags": { "some_tag": "tag_value" },
    "fields": {
        "current": [
            ['2016-09-01', 1.0],
            ['2016-09-02', 2.0],
            ['2016-09-03', 3.0]
        ],
        "voltage": [
            ['2016-09-01', 10],
            ['2016-09-02', 20],
            ['2016-09-03', 30]
        ],
        "temperature": [
            ['2016-09-01', 0.1],
            ['2016-09-02', 0.2],
            ['2016-09-03', 0.3]
        ]
    }
}

Data is written to influx as a list of timestamp/value pairs. The measurement, field and tags are defined in a data structure as shown on the right.

Measurements

A measurement is a logical container for different series. Examples of sensible measurement names could be:

Fields

Each measurement may have many fields. Each field represents a single stream of incoming data. Example of sensible fields could be:

Tags

Values inside a field are differentiated by the tags on each point. Sensible tags could be:

Tags may only contain Uppercase, Lowercase, '_' and '-' characters.

The combination of Measurement/Field/Tag therefore defines a time-series for a single unit.

For example if we wish to see Current and Voltage data for the unit 013777894567 we would look inside:

Writing Data for a Product

Data can be written to a specific product like this - note that the product_imei is automatically written into the tags and does not need to be specified by the user:

    url = "https://smartapi.bboxx.co.uk/v1/products/<imei>/data"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    data = json.dumps({
        "measurement": "telemetry",
        "tags": {"some_tag": "tag_value"},
        "fields": {
            "current": [
                [1472688000000, 1.0],
                [1472774400000, 2.0],
                [1472860800000, 3.0]
            ],
            "voltage": [
                ['2016-09-01T00:00:00Z', 10.0],
                ['2016-09-02 00:00:00', 20.0],
                ['2016-09-03', 30.0]
            ],
            "temperature": [
                ['Thu, September 1st 2016', 0.1],
                ['Fri, September 2nd 2016', 0.2],
                ['Sat, September 3rd 2016', 0.3]
            ]
        }
    })


    r = requests.post(url=url, data=data, headers=headers)

    print r.text
    >>> {
      "staus": "success"
      "message": "9 data-point(s) successfully written to influx",
      "data": null,
    }

Data for a single product data is written using the /v1/products/<imei>/data endpoint.

This endpoint will write data into the database tagged with the product_imei supplied in the endpoint. Users can also specify other tags to be applied to every point in the supplied data by including them in the tags sections of the POST request.

Data is supplied as a dictionary with the measurement, tags and fields specified in the format as shown on the right.

The actual data is supplied as a list of [<timestamp>, <value>] pairs.

The <timestamp> can be any of the following:

POST

value
endpoint /v1/products/<imei>/data
method POST
url_params product_imei (varchar(15))
query params None
body dictionary with data-structure and a list of valid datapoints.
permissions TECHNICAL
response 200

Writing General Data

More general data can be written like this:

    url = "https://smartapi.bboxx.co.uk/v1/products/<imei>/data"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    data = json.dumps({
        "measurement": "analysis",
        "fields": {
            "curve-data": [
                ["2016-01-01T00:01:20", 1],
                ["2016-01-01T00:01:21", 2],
                ["2016-01-01T00:01:22", 3],
                ["2016-01-01T00:01:23", 4],
            ],
        },
        "tags": {
            "analysis-type": "state-of-health",
            "product_imei": "000000000000000"
        }
    })


    r = requests.post(url=url, data=data, headers=headers)

    print r.text
    >>> {
      "staus": "success"
      "message": "4 data-point(s) successfully written to influx",
      "data": null,
    }

POST

value
endpoint /v1/products/<imei>/data
method POST
url_params None
query params None
body Correctly formatted set of datapoints (see right)
permissions TECHNICAL
response 200

Reading data for a Product

Here's an example dataset for a product with imei = 000000000000000

time                 current  product_imei    voltage  temperature
------------------------------------------------------------------
2016-01-01 00:00:00   1.234  000000000000000   14.243   21.345
2016-01-01 04:00:00   2.234  000000000000000   14.723
2016-01-01 08:00:00   3.234  000000000000000   14.826   21.345
2016-01-01 12:00:00   1.234  000000000000000   13.284
2016-01-01 16:00:00   2.345  000000000000000   12.345   21.345
2016-01-01 20:00:00   2.678  000000000000000   12.678
2016-01-02 00:00:00   2.910  000000000000000   12.910   21.910
2016-01-02 04:00:00   2.345  000000000000000   12.345
2016-01-02 08:00:00   2.678  000000000000000   12.678   21.678
2016-01-02 12:00:00   2.910  000000000000000   12.910
2016-01-02 16:00:00   2.345  000000000000000   12.345   21.345
2016-01-02 20:00:00   2.678  000000000000000   12.678
2016-01-03 00:00:00   2.910  000000000000000   12.910   21.910

A GET request with no parameters will return the default query for the product.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000000/data"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)
    print r.json()
    >>> {
    u'status': u'success',
    u'message': u'data retrieved successfully',
    u'data': {
        u'measurement': u'telemetry'},
        u'tags': {u'product_imei': u'000000000000000'},
        u'current': [
            [1.234, u'2016-01-01T00:00:00Z'], [2.234, u'2016-01-01T04:00:00Z'], [3.234, u'2016-01-01T08:00:00Z'], [1.234, u'2016-01-01T12:00:00Z'], [2.345, u'2016-01-01T16:00:00Z'], [2.678, u'2016-01-01T20:00:00Z'], [2.91, u'2016-01-02T00:00:00Z'], [2.345, u'2016-01-02T04:00:00Z'], [2.678, u'2016-01-02T08:00:00Z'], [2.91, u'2016-01-02T12:00:00Z'], [2.345, u'2016-01-02T16:00:00Z'], [2.678, u'2016-01-02T20:00:00Z'], [2.91, u'2016-01-03T00:00:00Z']
        ],
        u'current_in': [
            [0, u'2016-01-01T00:00:00Z'], [0, u'2016-01-01T04:00:00Z'], [0, u'2016-01-01T08:00:00Z'], [0, u'2016-01-01T12:00:00Z'], [0, u'2016-01-01T16:00:00Z'], [0, u'2016-01-01T20:00:00Z'], [0, u'2016-01-02T00:00:00Z'], [0, u'2016-01-02T04:00:00Z'], [0, u'2016-01-02T08:00:00Z'], [0, u'2016-01-02T12:00:00Z'], [0, u'2016-01-02T16:00:00Z'], [0, u'2016-01-02T20:00:00Z'], [0, u'2016-01-03T00:00:00Z']
        ],
        u'current_out': [
            [1.234, u'2016-01-01T00:00:00Z'], [2.234, u'2016-01-01T04:00:00Z'], [3.234, u'2016-01-01T08:00:00Z'], [1.234, u'2016-01-01T12:00:00Z'], [2.345, u'2016-01-01T16:00:00Z'], [2.678, u'2016-01-01T20:00:00Z'], [2.91, u'2016-01-02T00:00:00Z'], [2.345, u'2016-01-02T04:00:00Z'], [2.678, u'2016-01-02T08:00:00Z'], [2.91, u'2016-01-02T12:00:00Z'], [2.345, u'2016-01-02T16:00:00Z'], [2.678, u'2016-01-02T20:00:00Z'], [2.91, u'2016-01-03T00:00:00Z']
        ],
        u'voltage': [
            [14.243, u'2016-01-01T00:00:00Z'], [14.723, u'2016-01-01T04:00:00Z'], [14.826, u'2016-01-01T08:00:00Z'], [13.284, u'2016-01-01T12:00:00Z'], [12.345, u'2016-01-01T16:00:00Z'], [12.678, u'2016-01-01T20:00:00Z'], [12.91, u'2016-01-02T00:00:00Z'], [12.345, u'2016-01-02T04:00:00Z'], [12.678, u'2016-01-02T08:00:00Z'], [12.91, u'2016-01-02T12:00:00Z'], [12.345, u'2016-01-02T16:00:00Z'], [12.678, u'2016-01-02T20:00:00Z'], [12.91, u'2016-01-03T00:00:00Z']
        ],
        u'temperature': [
            [21.345, u'2016-01-01T00:00:00Z'], [None, u'2016-01-01T04:00:00Z'], [21.345, u'2016-01-01T08:00:00Z'], [None, u'2016-01-01T12:00:00Z'], [21.345, u'2016-01-01T16:00:00Z'], [None, u'2016-01-01T20:00:00Z'], [21.91, u'2016-01-02T00:00:00Z'], [None, u'2016-01-02T04:00:00Z'], [21.678, u'2016-01-02T08:00:00Z'], [None, u'2016-01-02T12:00:00Z'], [21.345, u'2016-01-02T16:00:00Z'], [None, u'2016-01-02T20:00:00Z'], [21.91, u'2016-01-03T00:00:00Z']
        ],
}

Any number of parameters can be explicitly specified, the other parameters will be filled with the default options.

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000000/data"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    params = {
        "start": "2016-01-02 23:00:00"
    }

    r = requests.get(url=url, params=params, headers=headers)
    r.json()
    >>> {
        u'status': u'success',
        u'message': u'data retrieved successfully',
        u'data': {
            u'tags': {u'product_imei': u'000000000000000'},
            u'measurement': u'telemetry'}
            u'current': [[2.91, u'2016-01-03T00:00:00Z']],
            u'current_in': [[2.91, u'2016-01-03T00:00:00Z']],
            u'current_out': [[2.91, u'2016-01-03T00:00:00Z']],
            u'voltage': [[12.91, u'2016-01-03T00:00:00Z']],
            u'temperature': [[21.91, u'2016-01-03T00:00:00Z']],
        }

Complex queries can be built using the where clause parameters

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000000/data"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    params = {
        "start": '2016-01-01',
        "end": '2016-01-02',
        "limit": 100,
        "where": "voltage > 14.0"
        "fields": ["current", "temperature"]
    }

    r = requests.get(url=url, params=params, headers=headers)
    r.json()
    >>> {
        u'status': u'success',
        u'message': u'data retrieved successfully',
        u'data': {
            u'measurement': u'telemetry'}
            u'tags': {u'product_imei': u'000000000000000'},
            u'current': [[2.234, u'2016-01-01T04:00:00Z'], [3.234, u'2016-01-01T08:00:00Z']],
            u'temperature': [[None, u'2016-01-01T04:00:00Z'], [21.345, u'2016-01-01T08:00:00Z']],
    }

Note that the query above has return datapoints in "current" and "temperature", where the corresponding voltage values were > 14.0V.

Users can GET data for a particular product using the same rm_data endpoint /v1/products/<imei>/data

As expected a GET request to this endpoint returns data relating to that product.

Data Structure

Provided no errors occured with the request the response will be structured as follows:

{
  "status": "success",
  "message": "data returned successfully",
  "data": <influx data structure>
}

Where <influx data structure> is as follows:

{
  "measurement": <measurement name>,
  "tags": {
    <tagName1>: <tagValue1>,
    <tagName2>: <tagValue2>,     <tagName3>: <tagValue3>,
    etc..
  },
  <fieldName1>: [[<value>, <timestamp>],[<value>, <timestamp>],[<value>, <timestamp>]],
  <fieldName2>: [[<value>, <timestamp>],[<value>, <timestamp>],[<value>, <timestamp>]],
  <fieldName3>: [[<value>, <timestamp>],[<value>, <timestamp>],[<value>, <timestamp>]],
}

NOTE if the get request is asking for device disaggregation data, then the json response will look more like this:

{  "data": [
  {
    "AC0122":0,
    "AC0122_qty":0,
    "LI0011":1.3,
    "LI0011_qty":1,
    "LI0131":0,
    "LI0131_qty": 0,
    "product_imei": "866710037088082",
    "time":"2018-10-18T00:00:12.9Z",
    "unexplained":0.29035031155349844,
    "unexplained_qty":1
  }
 ],
 "message": "data retrieved successfully",
 "status": "success"
}

Parameters

Users can filter the data they received by providing filters in the parameters of the GET request. Each parameter is optional and if not provided will be filled by the default option.

Defaults will be defined separately for each product_type so different product types will return different data structures.

name description default
start start-time 7 days ago
end end-time now()
fields fields to query "*" (all fields)
measurement measurement to query "telemetry"
limit number of data-points to return No limit
where an optional WHERE-clause None
tags JSON dictionary of tags to query "{}" _(an empty JSON dictionary)
ds_interval A downsampling interval to apply to the query None
ds_function The downsampling function to apply with ds_interval mean()

Full Query Examples

If a user queries /v1/products/<imei>/data and includes the following parameters:

Then they can expect to receive all available data from telemetry before 2016-01-01 and now(). Since now() is the default endtime.

A second query with parameters:


{
  start: "2016-01-01",
  end: "2016-02-01",
  limit: 100,
  where: "'voltage' > 14.0",
  fields: ["current", "temperature"]
}

Would return the first 100 datapoints in January where voltage > 14.0V for the unit. Note that since fields is specified as only current and temperature here the data returned are the values of current and temperature where the corresponding voltage was > 14.0,

Tags

Users can filter by specific tags by supplying a JSON formatted dictionary in the parameters like this:

{
  start: "2016-01-01",
  end: "2016-02-01",
  tags: "{tagKey: tagValue, tagKey: tagValue}"
}

Downsampling

Users can downsample data by using the ds_interval and ds_function parameters. These parameters are used to implement the GROUP BY functionality listed HERE in the influxDB documentation.

Users can specifiy a time-range using ds_interval and a function using ds_function and the API will return data which been downsampled into 'ds_interval'' chunks by applying the 'ds_interval' function to datapoints with-in each chunk.
When choosing a function users only need to name the function - do NOT include brackets ().

Available Downsampling Functions

You can find a full list of available functions here

The default downsampling function is mean

Available Time Intervals

Time intervals are specifed as a string in the format: "[number][unit]".
Five minutes would be specified as "5m"
The following units are available:
{
   u (microseconds)
   ms (milliseconds)
   s (seconds)
   m (minutes)
   h (hours)
   d (days)
   w (weeks)
}

Time Interval Examples

Specifying 1 minute intervals
{ds_interval: "1m"}

Specifying 10 d intervals
{ds_interval: "10d"}

Specifying half-second intervals in microseconds
{ds_interval: "500000u"}

Downsample Examples

To compute the 5 minute average of a series:

{
  "ds_interval": "5m"
  "ds_fucntion": "mean"
}

To compute the daily sum of a series:

{
  "ds_interval": "1d"
  "ds_fucntion": "sum"
}

To compute the hourly maximum of a series:

{
  "ds_interval": "1h"
  "ds_fucntion": "max"
}

Part Actions

This sections lists endpoints which can be used to create a new part, perform specific actions on a part or query specific data quickly and simply.

/parts/create_tiger_pcb

A POST request to this endpoint will create a new tiger pcb part on the system

    url = "https://smartapi.bboxx.co.uk/v1/parts/create_tiger_pcb"
    data = json.dumps({"imsi": "213514135171353",
                       "imei": "010101234560005",
                       "device_key": "4ab1ab3ab1ab7ab9ab1ab4ab",
                       "manufacturer": "A Factory"})
    headers = {"Content-Type": "application/json", "Authorization": "Token token=" + A_VALID_TOKEN}

    r = requests.post(url=url, data=data, headers=headers)

    print r.json()
    >>> {"status": "success"
         "message": "new pcb part and sim successfully created",
         "data": {"pcb": {"part_type_id": 44,
                          "properties": {"device_key": "4ab1ab3ab1ab7ab9ab1ab4ab",
                                         "imei": "010101234560005",
                                         "imsi": "213514135171353",
                                         "serial_number": "HB000501-084032-G"},
                          "serial_number": "010101234560005",
                          "manufacturer": "A Factory"},
                  "sim": {"part_type_id": 43,
                          "serial_number": "213514135171353"}},
     }

This endpoint will create a new tiger pcb part on the system

value
endpoint /parts/create_tiger_pcb
method POST
url_params None
payload {"imei": <imei>,
 "imsi": <imsi>,
 "device_key": <device_key>,
 "pcb_part_type_id": <part_type_id> (optional, default=44),
 "sim_part_type_id": <part_id> (optional, default=43),
 "iccid": <iccid> (optional, if given then sim part will be created with this as serial_number, otherwise will be the imsi}
response 200
permissions FACTORY

/parts/create_hyena_pcb

A POST request to this endpoint will create a new hyena pcb part on the system

    url = "https://smartapi.bboxx.co.uk/v1/parts/create_hyena_pcb"
    data = json.dumps({"imsi": "213514135171353",
                       "imei": "010101234560005",
                       "device_key": "4ab1ab3ab1ab7ab9ab1ab4ab",
                       "manufacturer": "A Factory"})
    headers = {"Content-Type": "application/json", "Authorization": "Token token=" + A_VALID_TOKEN}

    r = requests.post(url=url, data=data, headers=headers)

    print r.json()
    >>> {"status": "success"
         "message": "new pcb part and sim successfully created",
         "data": {"pcb": {"part_type_id": 77,
                          "properties": {"device_key": "4ab1ab3ab1ab7ab9ab1ab4ab",
                                         "imei": "010101234560005",
                                         "imsi": "213514135171353",
                                         "serial_number": "HB000501-084032-G"},
                          "serial_number": "010101234560005",
                          "manufacturer": "A Factory"},
                  "sim": {"part_type_id": 43,
                          "serial_number": "213514135171353"}},
     }

This endpoint will create a new hyena pcb part on the system

value
endpoint /parts/create_hyena_pcb
method POST
url_params None
payload {"imei": <imei>,
 "imsi": <imsi>,
 "device_key": <device_key>,
 "pcb_part_type_id": <part_type_id> (optional, default=77),
 "sim_part_type_id": <part_id> (optional, default=43),
 "iccid": <iccid> (optional, if given then sim part will be created with this as serial_number, otherwise will be the imsi}
response 200
permissions FACTORY

/parts/create_koala_pcb

A POST request to this endpoint will create a new koala pcb part on the system

    url = "https://smartapi.bboxx.co.uk/v1/parts/create_koala_pcb"
    data = json.dumps({"imsi": "213514135171353",
                       "imei": "010101234560005",
                       "device_key": "4ab1ab3ab1ab7ab9ab1ab4ab",
                       "manufacturer": "A Factory"})
    headers = {"Content-Type": "application/json", "Authorization": "Token token=" + A_VALID_TOKEN}

    r = requests.post(url=url, data=data, headers=headers)

    print r.json()
    >>> {
        "data":{
            "pcb":{
                "manufacturer":"A Factory",
                "part_type_id":122,
                "properties":{
                    "device_key":"4ab1ab3ab1ab7ab9ab1ab4ab",
                    "erp_code_override":"PA01040102",
                    "iccid":"66685607592181745482",
                    "imei":"010101234560005",
                    "imsi":"213514135171353",
                    "serial_number":"BX0020-013002-R"
                },
                "serial_number":"110932356179789"
            },
            "sim":{
                "part_type_id":43,
                "serial_number":"66685607592181745482"
            }
        },
        "message":"new koala pcb successfully created.",
        "status":"success"
        }

This endpoint will create a new koala pcb part on the system

value
endpoint /parts/create_koala_pcb
method POST
url_params None
payload {"imei": <imei>,
 "imsi": <imsi>,
 "device_key": <device_key>,
 "pcb_part_type_id": <part_type_id> (optional, default=44),
 "sim_part_type_id": <part_id> (optional, default=43),
 "iccid": <iccid> (optional, if given then sim part will be created with this as serial_number, otherwise will be the imsi}
response 201
permissions FACTORY

/parts/create_jackal_pcb

A POST request to this endpoint will create a new jackal pcb part on the system

    url = "https://smartapi.bboxx.co.uk/v1/parts/create_jackal_pcb"
    data = json.dumps({"imsi": "213514135171353",
                       "imei": "010101234560005",
                       "device_key": "4ab1ab3ab1ab7ab9ab1ab4ab",
                       "manufacturer": "A Factory"})
    headers = {"Content-Type": "application/json", "Authorization": "Token token=" + A_VALID_TOKEN}

    r = requests.post(url=url, data=data, headers=headers)

    print r.json()
    >>> {
        'data': {
                'pcb': {
                    'manufacturer': '"A Factory', 
                    'part_type_id': 158, 
                    'properties': {
                                    'device_key': '4ab1ab3ab1ab7ab9ab1ab4ab', 
                                    'erp_code_override': 'PA04010102', 
                                    'iccid': '66685607592181745482', 
                                    'imei': '010101234560005', 
                                    'imsi': '748655857675019'}}, 
                'sim': {
                        'part_type_id': 43, 
                        'serial_number': '66685607592181745482'}},
         'message': 'new jackal pcb successfully created.', 
         'status': 'success'}

This endpoint will create a new jackal pcb part on the system

value
endpoint /parts/create_jackal_pcb
method POST
url_params None
payload {"imei": <imei>,
 "imsi": <imsi>,
 "device_key": <device_key>,
 "pcb_part_type_id": <part_type_id> (optional, default=44),
 "sim_part_type_id": <part_id> (optional, default=43),
 "iccid": <iccid> (optional, if given then sim part will be created with this as serial_number, otherwise will be the imsi}
response 200
permissions FACTORY

Repair Actions

This sections lists endpoints which can be used to perform specific actions on a product repair workflow.

/repairs/<repair_id>/current_state

A GET request to this endpoint retrieves information about the current state of the given workflow.

    url = "https://smartapi.bboxx.co.uk/v1/repairs/000000000000/current_state"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    print r.json()
    >>> {
            "status": "success",
            "message": "Repair found",
            "data": {
                "description": "The test jig indicates that this unit has a faulty PCB. Replace the PCB. Click the button below when this has been done",
                "events": [],
                "ident": "replace_pcb",
                "inputs": [
                    {
                        "data_type": "selection",
                        "ident": "replacement_part_type",
                        "label": "Choose one of these replacement PCB's",
                        "options": [
                            {
                                "label": "BBOXX Home 2 PCB (Tiger 7)",
                                "value": 61
                            },
                            {
                                "label": "BBOXX Home 2 PCB (Tiger 2)",
                                "value": 44
                            },
                            {
                                "label": "BBOXX Home 2 PCB (Tiger 6)",
                                "value": 48
                            }
                        ],
                        "selection_type": "single"}],
                "name": "Replace PCB"
            },
    }

This endpoint retrieves information about the current state of the given workflow.

value
endpoint /repairs/<repair_id>/current_state
method GET
url_params repair_id (int)
payload None
response 200

The format of the data returned by this endpoint is a dictionary with key status, data, and (optionally) message.

The data key contains a dictionary with the following keys:

If there are any formatting errors in requests the API will return error_code 400 and indicate the error in question in the message section of the response

/repairs/<repair_id>/send_inputs

A PUT request to this endpoint is used to submit user input for the current repair workflow state

    url = "https://smartapi.bboxx.co.uk/v1/repairs/000000000000/send_inputs"
    data = json.dumps({
        [
            "voltage": 4.8,
            "serial": "MC0211-999002-1"
        ]
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, data=data, headers=headers)

    print r.json()
    >>> {
            "status": "success",
            "message": "Repair updated",
            "data": {},
    }

This endpoint submits user input for the current repair workflow state.

value
endpoint /repairs/<repair_id>/send_inputs
method PUT
url_params None
payload JSON-formatted dictionary with the details of the user's input (see IRT Input Specifications)
response 200

If there are any formatting errors in requests the API will return error_code 400 and indicate the error in question in the message section of the response

/repairs/<repair_id>/send_events

A PUT request to this endpoint is used to submit a user event notification for the current repair workflow state

    url = "https://smartapi.bboxx.co.uk/v1/repairs/000000000000/send_events"
    data = json.dumps({
        [
            "event": "battery.charged"
        ]
        })
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, data=data, headers=headers)

    print r.json()
    >>> {
            "status": "success",
            "message": "Repair updated",
            "data": {},
    }

This endpoint submits user input for the current repair workflow state.

value
endpoint /repairs/<repair_id>/send_events
method PUT
url_params None
payload JSON-formatted dictionary with a single key identifying the user's event notification (see IRT Event Specifications)
response 200

If there are any formatting errors in requests the API will return error_code 400 and indicate the error in question in the message section of the response

/repairs/<repair_id>/history

A GET request to this endpoint is used to retrieve the repair workflow history state

    url = "https://smartapi.bboxx.co.uk/v1/repairs/000000000000/history"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    print r.json()
    >>> {
            "status": "success",
            "message": "Repair state found",
            "data": [
                {'ident': 'ss_state_check', 'name': 'SMART SOLAR State Check'},
                {'ident': 'usb_diag_test', 'name': 'USB Diagnostic Test'},
                {'ident': 'explain_skip_btb', 'name': 'Skip the Battery Test'},
                {'ident': 'charge_2', 'name': 'Charge'},
                {'ident': 'clean', 'name': 'Clean'},
                {'ident': 'visual_inspection', 'name': 'Visual Inspection'},
                {'ident': 'select_damaged_casing', 'name': 'Select Damaged Casing'}
            ],
    }

This endpoint retrieves the repair workflow history state.

value
endpoint /repairs/<repair_id>/history
method GET
url_params repair_id (int)
payload None
response 200

If there are any formatting errors in requests the API will return error_code 400 and indicate the error in question in the message section of the response

/repairs/list_current_states

A GET request to this endpoint is used to retrieve a list of current repairs and their workflow states

    url = "https://smartapi.bboxx.co.uk/v1/repairs/list_current_states"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    print r.json()
    >>> {
            "status": "success",
            "message": "Repair states found",
            "data": [
                {
                    'created_by': 'test.user@bboxx.co.uk',
                    'product_imei': '864811031004067',
                    'repair_id': 46141,
                    'repair_state_id': 'select_damaged_casing',
                    'repair_state_name': 'Select Damaged Casing'
                },
                {
                    'created_by': 'test.user@bboxx.co.uk',
                    'product_imei': '864811034773775',
                    'repair_id': 46137,
                    'repair_state_id': 'visual_inspection',
                    'repair_state_name': 'Visual Inspection'
                }            
            ],
    }

This endpoint retrieves a list of current repairs and their workflow states.

value
endpoint /repairs/list_current_states
method GET
url_params None
query_params entity_id=entity-id (optional - filter the list by entity)
username=username (optional - filter the list by user)
repair_state=repair-state-id (optional - filter the list by repair state)
payload None
response 200

If there are any formatting errors in requests the API will return error_code 400 and indicate the error in question in the message section of the response

IRT Input Specifications

Each input specification contains three mandatory fields:

"ident" - unique identifier for the input value

"label" - short description of the input value, to be displayed to the user

"data_type" - the input value's type. Currently, the following are supported:

"int" "float" "string" "text" "datetime" "selection"

Each definition may also contain an optional validation rules field:

"validation_rules"


"int" Data Type

Indicates that the required value must be an integer

Validation Rules

The following validation rules may be specified for integers:

Example

{
"ident": "voltage",
"label": "Battery Voltage",
"data_type": "int",
"validation_rules": {"min": 3, "max": 7}
}

The value entered by the user would be submitted to the send_inputs endpoint like this:

{
"voltage": 4
}


"float" Data Type

Indicates that the required value must be a floating point number

Validation Rules

The following validation rules may be specified for floats:

Example

{
"ident": "voltage",
"label": "Battery Voltage",
"data_type": "float",
"validation_rules": {"min": 3.5, "max": 7.5}
}

The value entered by the user would be submitted to the send_inputs endpoint like this:

{
"voltage": 4.8
}


"string" Data Type

Indicates that the required value must be a string (intended for use with short strings, probably input via a single line text field)

Validation Rules

The following validation rules may be specified for strings:

Example

{
"ident": "serial",
"label": "Serial Number",
"data_type": "string",
"validation_rules": {"minlength": 10, "maxlength": 15}
}

The value entered by the user would be submitted to the send_inputs endpoint like this:

{
"serial": "MC0211-999002-1"
}


"text" Data Type

Indicates that the required value must be text (intended for use with long strings, probably input via a multi-line text area field)

Validation Rules

The following validation rules may be specified for text:

Example

{
"ident": "termination_reason",
"label": "Termination Reason",
"data_type": "text",
"validation_rules": {"minlength": 10}
}

The value entered by the user would be submitted to the send_inputs endpoint like this:

{
"termination_reason": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
}


"datetime" Data Type

Indicates that the required value must be a date/time string

Validation Rules

There are no validation rules for date/times. The acceptable formats are %H:%M:%S, %Y-%m-%d and %Y-%m-%dT%H:%M:%SZ

Example

{
"ident": "refurb_date",
"label": "Refurbishment Date",
"data_type": "datetime"
}

The value entered by the user would be submitted to the send_inputs endpoint like this:

{
"refurb_date": "2018-03-30"
}


"selection" Data Type

Indicates that the required value must be selected from a list. This data type is specified by 2 further fields:

"selection_type": Either "single" (indicating that the user can only select one value from the list) or "multi" (indicating that multiple values can be selected).

"options": An array of dictionary objects. Each dictionary object has 2 members:

Validation Rules

There are no validation rules for selection data types.

Example

Selection type "single"

{
"ident": "replacement_part_type",
"label": "Choose one of these replacement PCB's",
"data_type": "selection",
"selection_type": "single",
"options": [
{
"label": "BBOXX Home 2 PCB (Tiger 7)",
"value": 61
},
{
"label": "BBOXX Home 2 PCB (Tiger 2)",
"value": 44
},
{
"label": "BBOXX Home 2 PCB (Tiger 6)",
"value": 48
}
]
}

The value selected by the user would be submitted to the send_inputs endpoint like this:

{
"replacement_part_type": 44
}

Selection type "multi"

{
"ident": "u'internal_inspection_result",
"label": "Internal Inspection Result",
"data_type": "selection",
"selection_type": "multi",
"options": [
{
"label": "Home 2 Button Cap",
"value": 69
},
{
"label": "Light Pipes",
"value": 12
},
{
"label": "Battery PCB Cable",
"value": 15
},
{
"label": "BBOXX Home 2 (Tiger) Battery Cable",
"value": 62
}
]
}

The value(s) selected by the user would be submitted to the send_inputs endpoint like this:

{
"internal_inspection_result": [12, 62]
}

IRT Event Specifications

Each event specification contains two mandatory fields:

"ident" - unique identifier for the event

"label" - short description of the event, to be displayed to the user

Example

{
"ident": "battery.charged",
"label": "Battery Charged",
}

The value entered by the user would be submitted to the send_event endpoint like this:

{
"event": "battery.charged"
}

RTC Dead Letter Actions

This sections lists endpoints that can be used to perform actions on RTC Dead Letter messages.

/rtc_import_mo_dead_letters

A POST request to this endpoint instructs SMART Solar to copy any RTC dead letter messages from the RTC-MO.Dead-Letter queue to the database to enable examination and further processing.

    url = "https://smartapi.bboxx.co.uk/v1/rtc_import_mo_dead_letters"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.post(url=url, headers=headers)

    print r.json()
    >>> {
            "status": "success",
            "message": "MO dead letters imported",
            "data": {}
    }

This endpoint instructs SMART Solar to copy any RTC dead letter messages from the RTC-MO.Dead-Letter queue to the database to enable examination and further processing.

value
endpoint /rtc_import_mo_dead_letters
method POST
url_params None
payload None
response 200

/rtc_import_mt_reply_dead_letters

A POST request to this endpoint instructs SMART Solar to copy any RTC dead letter messages from the RTC-MT.Reply.Dead-Letter queue to the database to enable examination and further processing.

    url = "https://smartapi.bboxx.co.uk/v1/rtc_import_mt_reply_dead_letters"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.post(url=url, headers=headers)

    print r.json()
    >>> {
            "status": "success",
            "message": "MT Reply dead letters imported",
            "data": {}
    }

This endpoint instructs SMART Solar to copy any RTC dead letter messages from the RTC-MT.Reply.Dead-Letter queue to the database to enable examination and further processing.

value
endpoint /rtc_import_mt_reply_dead_letters
method POST
url_params None
payload None
response 200

/rtc_dead_letters/<rtc_dead_letter_id>/replay

A PUT request to this endpoint replays an RTC dead letter message.

    url = "https://smartapi.bboxx.co.uk/v1/rtc_dead_letters/1/replay"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, headers=headers)

    print r.json()
    >>> {
        "status": "success", 
        "message": "Dead letter message replayed", 
        "data": None
    }

This endpoint replays an RTC dead letter message. The id of the message to be replayed is specified in the url.

value
endpoint /rtc_dead_letters/<rtc_dead_letter_id>/replay
method PUT
url_params rtc_dead_letter_id (int)
payload None
response 200

/rtc_dead_letters/<rtc_dead_letter_id>/discard

A PUT request to this endpoint marks an RTC dead letter message as discarded, indicating that it is not to be processed further.

    url = "https://smartapi.bboxx.co.uk/v1/rtc_dead_letters/1/discard"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, headers=headers)

    print r.json()
    >>> {
        "status": "success", 
        "message": "Dead letter message discarded", 
        "data": None
    }

This endpoint marks an RTC dead letter message as discarded, indicating that it is not to be processed further. The id of the message to be replayed is specified in the url.

value
endpoint /rtc_dead_letters/<rtc_dead_letter_id>/discard
method PUT
url_params rtc_dead_letter_id (int)
payload None
response 200

/rtc_dead_letters/<rtc_dead_letter_id>/decode

A GET request to this endpoint returns the contents of a RTC dead letter message ready for display to a user.

    url = "https://smartapi.bboxx.co.uk/v1/rtc_dead_letters/1/decode"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, headers=headers)

    print r.json()
    >>> {
        "status": "success", 
        "message": "Dead letter message decoded", 
        "data": "Decoded message: [4L, [[1518543688L, u'Charger sn=HQ17048RPII pid=a04c'], [1518543691L, u'Above RV']]]"
    }

This endpoint returns the contents of a RTC dead letter message ready for display to a user.

value
endpoint /rtc_dead_letters/<rtc_dead_letter_id>/decode
method GET
url_params rtc_dead_letter_id (int)
payload None
response 200

Custom Endpoints

This section lists custom endpoints available to users for returning information from the API and performing actions that are not specific to a Product.

/home

url = "https://smartapi.bboxx.co.uk/v1/home"
r = requests.get(url)

print r
>>> <Response 200> 

print r.text
>>> "Welcome to the SMARTSolar API: 2016-08-09T10:14:48.318496"

Description

The /home endpoint provides a quick way to confirm that the endpoint is up and running. A simple GET or POST request will generate a 200 response if the API is running.

The endpoint does not require authentication and can also be access from a standard web-browser:
https://smartapi.bboxx.co.uk/v1/home

The response will also return (in plain text) Welcome to the SMARTSolar API: <timestamp>.

/auth/login

A simple POST request with correct details yields the following response:

    url = 'https://smartapi.bboxx.co.uk/v1/auth/login'
    fields = {
        "username": <username>,
        "password": <password>
    }

    r = requests.post(url, data=fields)

    r.json()
    >>> {
        "status": "success",
        "message": {
            "login_successful": {
                "username": "test.user@bboxx.co.uk",
                "entity_id": 1,
                "display_name": "T User",
                "name": "",
                "user_product_visibility": "GLOBAL",
                "hub_id": None,
                "shop_id": None,
                "API_token": "sRtBFThPFIpgKY2sYkaSHFbo1hosg2NvCP4PmBIxfGQ62VS6zrjFT6dr1qDLQGz",
                "token_expiry": "Mon, 01 Aug 2016 17:05:11 GMT",
                "permissions": "SYSTEM"
            }
        }
    }

This is the endpoint used to generate a token. For a full explanation see Authentication and Permissions.

value
endpoint /auth/login
method(s) POST
permissions N/A
params N/A
payload username and password (unformatted)
response 200

/auth/validate_user

A simple GET request with a valid username yields the following response:

    url = 'https://smartapi.bboxx.co.uk/v1/auth/validate_user?username=a-valid-user@bboxx.co.uk'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    r.json()
    >>> {
        "status": "success",
        "message": "Successfully checked the username a-valid-user@bboxx.co.uk",
        "data": "True" 
        }
    }

A GET request with an invalid username yields the following response

    url = 'https://smartapi.bboxx.co.uk/v1/auth/validate_user?username=not_a_real_user@bboxx.co.uk'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    r.json()
    >>> {
        "status": "success",
        "message": "Successfully checked the username not_a_real_user@bboxx.co.uk",
        "data": "False" 
        }
    }

params may also be used:

    url = 'https://smartapi.bboxx.co.uk/v1/auth/validate_user'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    params = {
        "username": "not_a_real_user@bboxx.co.uk"
    }

    r = requests.get(url=url, params=params, headers=headers)

    r.json()
    >>> {
        "status": "success",
        "message": "Successfully checked the username not_a_real_user@bboxx.co.uk",
        "data": "False" 
        }
    }

This endpoint can be called by users with SYSTEM privileges to validate whether a username is valid.

If a username is valid the response_code will be 200 and the payload in r.json()["data"] will be True.

If a username is invalid the response_code will still be 200 but the payload in r.json()["data"] will be False

value
endpoint /auth/validate_user
method(s) GET
permissions SYSTEM
params username (str)
payload N/A
response 200

/v1/current_enable_status

A GET request to this endpoint will return the enable status of all units so that the ERP can sync the unit status

url = "https://smartapi.bboxx.co.uk/v1/current_enable_status?page=5&results_per_page=3"


headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=A_VALID_TOKEN'}

response = requests.get(url=url, headers=headers)

print(response.json())
    >>> {
    "data": [
        {
            "current_enable_state": "enabled",
            "current_state_type": 5,
            "date": "2015-06-04T10:59:30",
            "dcm_enabled_flag": False,
            "entity": "BBOXX Capital Kenya",
            "entity_id": 4,
            "hardware_type": "BB17SMART_v1",
            "prev_enable_state": "disabled",
            "product_imei": "test-77006985814",
            "product_type_id": 1,
            "serial_number": "BB17SMART-2014_MAY21-test",
            "total_accessory_energy": None,
            "user": "test@bboxx.co.uk",
        },
        {
            "current_enable_state": "enabled",
            "current_state_type": 5,
            "date": "2015-06-04T10:59:31",
            "dcm_enabled_flag": False,
            "entity": "BBOXX Capital Kenya",
            "entity_id": 4,
            "hardware_type": "BB17SMART_v2",
            "prev_enable_state": "disabled",
            "product_imei": "test-49004970581",
            "product_type_id": 2,
            "serial_number": "BB17SMART-140710-test",
            "total_accessory_energy": None,
            "user": "test@bboxx.co.uk",
        },
        {
            "current_enable_state": "enabled",
            "current_state_type": 5,
            "date": "2015-06-04T10:59:48",
            "dcm_enabled_flag": False,
            "entity": "BBOXX Capital Kenya",
            "entity_id": 4,
            "hardware_type": "BB17SMART_v2",
            "prev_enable_state": "disabled",
            "product_imei": "test-50004183746",
            "product_type_id": 2,
            "serial_number": "BB17SMART-150127-test",
            "total_accessory_energy": None,
            "user": "test@bboxx.co.uk",
        },
    ],
    "message": "enable_histories retrieved",
    "status": "success",
}

This endpoint will return the enable status of all units so that the ERP can sync the unit status

The ERP is concerned about units getting out of sync with SMARTSolar so once every two hours they try to sync all unit statuses. Initially this endpoint only returned the enable_state but it's functionality has expanded over time.

value
endpoint /v1/current_enable_status
method GET
url_params page , results_per_page
response 200
permissions FACTORY

/auth/validate_user_password

A simple GET request with a valid username/password combination yields the following response:

    url = 'https://smartapi.bboxx.co.uk/v1/auth/validate_user_and_password?username=a-valid-user@bboxx.co.uk&password=a-valid-password'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    r.json()
    >>> {
        "status": "success",
        "message": "Successfully checked the username a-valid-user@bboxx.co.uk with it's password",
        "data": "True" 
        }
    }

A GET request with an invalid username/password combination yields the following response

    url = 'https://smartapi.bboxx.co.uk/v1/auth/validate_user?username=not_a_real_user@bboxx.co.uk&password=not-a-valid-password'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    r.json()
    >>> {
        "status": "success",
        "message": "Successfully checked the username not_a_real_user@bboxx.co.uk with it's password",
        "data": "False" 
        }
    }

params may also be used:

    url = 'https://smartapi.bboxx.co.uk/v1/auth/validate_user_and_password'
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    params = {
        "username": "not_a_real_user@bboxx.co.uk",
        "password": "not_a_real_pass",
    }

    r = requests.get(url=url, params=params, headers=headers)

    r.json()
    >>> {
        "status": "success",
        "message": "Successfully checked the username not_a_real_user@bboxx.co.uk with it's password",
        "data": "False" 
        }
    }

This endpoint can be called by users with SYSTEM privileges to validate whether a username is valid.

If the username/password combination is valid the response_code will be 200 and the payload in "data" will be "True" If the username/password combination is invalid the response_code will still be 200 but the payload in "data" will be False

value
endpoint /auth/validate_user_and_password
method(s) GET
permissions SYSTEM
params username (str) password (str)
payload N/A
response 200

/dashboard2

A plain GET request returns a json structure as follows:

url = "https://smartapi.bboxx.co.uk/v1/dashboard2"
headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

r = requests.get(url=url, headers=header)

r.json()
>>> {
    "data": [
        {
            "product_imei": "000000000000000",
            "serial_number": "BB17SMART-150127-0608",
            "imsi": "204040000000000",
            "hardware_type": "BB17SMART_v2",
            "entities": [{
                "entity_id": 1, 
                "name": "A Test Entity",
                "bboxx_company_flag": True,
                "financier": None,
                "tariff": "A Test Tariff"
                "created_at": "2015-02-11 12:24:29.993914",
                "created_by": "test.user@bboxx.co.uk",
                "modified_at": "2015-04-13 10:42:29",
            }],
            "hub_id": 2,
            "shop_id": None,
            "location_date": "2016-08-02T19:38:56",
            "alerts": [None],
            "software_lock": None,
            "pending_software_created_at": None,
            "state": "activated",
            "state_date": "2015-08-18T14:05:08",
            "recent_connection": "2016-08-02T19:38:56",
            "latitude": "-0.400234",
            "longitude": "34.599241",
            "error_radius": 69583,
            "capacity_limit": "7",
            "current_enable_flag": True,
            "desired_enable_flag": True,
            "current_tamper_flag": False,
            "desired_tamper_flag": False,
            "notes": [None],
            "software": "2.16"
            "pending_software": None,
            "created_at": "2015-04-16T02:09:55",
            "created_by": "test.user@bboxx.co.uk",
        }, 
        {
            "product_imei": "222222222222222",
            "serial_number": "BB17SMART-150127-0608",
            "imsi": "204042222222222",
            "hardware_type": "BB17SMART_v2",
            "entities": [{
                "entity_id": 1, 
                "name": "A Test Entity",
                "bboxx_company_flag": True,
                "financier": None,
                "tariff": "A Test Tariff"
                "created_at": "2015-02-11 12:24:29.993914",
                "created_by": "test.user@bboxx.co.uk",
                "modified_at": "2015-04-13 10:42:29",
            }],
            "hub_id": 2,
            "shop_id": None,
            "location_date": "2016-08-02T19:38:56",
            "alerts": [None],
            "software_lock": None,
            "pending_software_created_at": None,
            "state": "activated",
            "state_date": "2015-08-18T14:05:08",
            "recent_connection": "2016-08-02T19:38:56",
            "latitude": "-0.400234",
            "longitude": "34.599241",
            "error_radius": 69583,
            "capacity_limit": "7",
            "current_enable_flag": True,
            "desired_enable_flag": True,
            "current_tamper_flag": False,
            "desired_tamper_flag": False,
            "notes": [None],
            "software": "2.16"
            "pending_software": None,
            "created_at": "2015-04-16T02:09:55",
            "created_by": "test.user@bboxx.co.uk",
        }, 
    ]
    "num_results": 2
    "num_results_filtered": 2
}

/dashboard2 supports standard Flask-Restless filtering, for example:


This endpoint is used to return a collection of useful data about a product (or products) in a format that is helpful.

value
endpoint /dashboard2
method GET
params See Query Format and Filtering
payload N/A
response 200

Querying and Filtering

A single product can be queried as follows:

url = "https://smartapi.bboxx.co.uk/v1/dashboard2"
headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

params = {
    "q": json.dumps({
        "filters": [
            {"name": "product_imei", "op": "eq", "val": "866771029513065"}
        ]
    })
}
r = requests.get(url=url, params=params, headers=get_headers())
print r
>>> <Response 200>

print r.json()
>>> {
    "num_results": 1,
    "num_results_filtered": 1
    "data": [
        {
            "product_imei": "866771029513065",
            "imsi": "214074203094552",
            "hardware_type": "Hub",
            "serial_number": "HUB-10",
            "capacity_limit": "0.0",
            "current_enable_flag": True,
            "desired_enable_flag": True,
            "current_tamper_flag": True,
            "desired_tamper_flag": True,
            "entities": [{
                "entity_id": 31, 
                "name": "Angaza Design", 
                "bboxx_company_flag": False,
                "financier": None,
                "tariff": "WV-695 - Vodafone Global- ROWT3 1MB"
                "created_at": "2015-09-22T09:01:58.170953",
                "created_by": "d.mclean@bboxx.co.uk",
            }],
            "shop_id": None,
            "hub_id": None,
            "recent_connection": "2016-08-03T14:15:49",
            "location_date": "2016-08-03T14:15:49",
            "latitude": "37.783256",
            "longitude": "-122.404417",
            "error_radius": 1251,
            "alerts": [None],
            "state": "activated",
            "state_date": "2016-07-14T22:03:09",
            "software": "hub-stc-4"
            "software_lock": None,
            "pending_software": None,
            "pending_software_created_at": None,
            "notes": [None],
            "created_at": "2016-06-30T16:17:56",
            "created_by": "r.software@bboxx.co.uk",
            "modified_at": None,
        }
    ],
}

The /dashboard2 endpoint follows the Flask-Restless query format but with a few caveats.

Querying a single product follows the expected pattern.
"filters": [{"name": "entities", "op": "eq", "val": "A Test Entity"}]

Entities

url = "https://smartapi.bboxx.co.uk/v1/dashboard2"
headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}


params = {
    "q": json.dumps({
        "filters": [
            {"name": "entities", "op": "=", "val": "BBOXX Engineering"}
        ]
    })
}
r = requests.get(url=url, params=params, headers=headers)

Querying entities deviates from the expected pattern slightly.

Rather than "name": "entity" you must instead specify "name": "entities"

In addition the value must be the name of an entity rather than an entity_id.

For example:
"filters": [{"name": "entities", "op": "eq", "val": "A Test Entity"}]

/alerts/<alert_id>/dismiss

A PUT request to this endpoint dismisses an alert.

    url = 'https://smartapi.bboxx.co.uk/v1/alerts/<alert_id>/dismiss'
    data = json.dumps({
        "dismissal_reason":"reason for dismissal", 
        "extra_info": "extra information about dismissal", 
        "repair_id":<repair_id>})
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.put(url=url, data=data headers=headers)

    print r.json()
    >>> {
        "status": "success", 
        "message": "Alert #{alert_id} has been dismissed", 
        "data": None
    }

This endpoint is used to dismiss an alert.

value
endpoint /alerts/<alert_id>/dismiss
method PUT
url_params alert_id (int)
payload {
"dismissal_reason":"reason for dismissal", (optional)
 "extra_info": "extra information about dismissal," (optional)
 "repair_id":<repair_id> (optional)
}
response 200

Notifications (Web Hooks)

Receiving Notifications from the API

It's often desirable to receive notifcations about changes in the system rather than repeatedly polling the API to check for changes.

BBOXX supports this functionality in the form of Notifications or "Webhooks". Users can opt to receive an HTTP POST request containing any updated data at the point at which any change is detected in the system.

Users can subscribe to different channels after which new data published into that channel will be sent, via HTTP, to the endpoint that the user specified in the subscription stage. The user can then handle the incoming data as they wish.

BBOXX supports HTTP and HTTPS endpoints and includes a signature in each POST request that a user can use to confirm the authenticity of the request and its data.

Channels

To view a list of available channels, send a GET request to /v1/channels.

    url = "https://smartapi.bboxx.co.uk/v1/channels"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    print r
    >>> <Response [200]> 

    print r.text
    >>> {
        'total_pages': 1, 
        'objects': [{
            'name': 'product-status', 
            'created_at': '2016-11-25T10:51:30.077685', 
            'created_by': 'd.mclean@bboxx.co.uk'
            'modified_at': None, 
            'modified_by': None, 
        }], 
        'num_results': 1, 
        'page': 1
    }

Data is separated into Channels so that users can receive only the data that they are interested in.

The current list of possible channels is:

Name data published into this channel
product-status enabled status, product state (ACTIVATED/MONITORED etc.), user (making the change)
product-alert updates to SMART Solar alert data

Users can view a list of available channels by sending a GET request to /v1/channels

Users can view the possible contents and format of the data sent in the channel below:

Subscribing to a Channel

An example of how to subscribe to the product-status channel.

    url = "https://smartapi.bboxx.co.uk/v1/channels/product-status/subscribe"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    data = json.dumps({
        "url": "http://example_domain/example_endpoint",
    })

    r = requests.post(url=url, data=data, headers=headers)

    print r
    >>> <Response [201]> 

    print r.text
    >>> {
        'status': 'success', 
        'message': "You have subscribed to the 'product-status' channel with the url: 'test_url'", 
        'data': {
            'url': 'http://example_domain/example_endpoint', 
            'channel_name': 'product-status', 
            'key': 'n9QgxA1GO0bzBVontkWkWg=='
        }
    }

    key = r.json()["data"]["key"]

    print "THIS IS MY SECRET KEY: {} ".format(key)
    print "I SHOULD STORE IT SAFELY SINCE I CANNOT RETRIEVE IT LATER"

Note the secret key that is returned inside the payload of the response - this key is required in order to verify the signature that BBOXX sends with each request. You should store it in a secure place as it will not be resent after the first subscription request.

To receive messages from a channel, users must first setup a suitable endpoint that can receive and process the POST request and then subscribe that endpoint to the desired channel.

To subscribe, send a POST request to /v1/channels/<channel_name>/subscribe with a JSON formated dictionary containing the endpoint url sent in the payload of the request - see right for an example subscription request.

You may only subscribe one url to each channel.

Unsubscribing from a Channel

An example of how to un-subscribe from the product-status channel.

    url = "https://smartapi.bboxx.co.uk/v1/channels/product-status/unsubscribe"
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    data = json.dumps({
        "url": "http://example_domain/example_endpoint",
    })

    r = requests.post(url=url, data=data, headers=headers)

    print r
    >>> <Response [200]> 

    print r.text
    >>> {
        'status': 'success', 
        'message': "You have unsubscribed from the 'product-status' channel with the url: 'http://example_domain/example_endpoint'", 
        'data': None
    }

If a user no longer wishes to receive notifications from a particular channel they can unsubscribe from that channel by sending a POST request to /v1/channels/<channel_name>/unsubscribe with a JSON-formatted dictionary in the payload, containing the url that they wish to remove..

POST

value
endpoint /v1/channels/<channel_name>/unsubscribe
method POST
url_params channel_name (str)
query params N/A
body url (str) - The endpoint that you wish to unsubscribe
permissions ADMIN
response_code 200

A successful request will result in a 200 response code. In addition the response will confirm the channel that the user unsubscribed from.

Receiving Notifications

Having successfully subscribed to a channel, the subscribed endpoint will receive HTTP POST requests whenever data relevant to that channel is changed.

The format of the request will be as follows:

Headers

{
  'Content-Type': 'application/json',
  'X-BBOXX-Signature': <signature>,
}

Payload

{
  'channel': <channel>,
  'timestamp': <timestamp>,
  'data': <data>,
}

Channel: confirms the name of the channel.
Timestamp: gives the time that the message is created, it is theoretically possible for messages to arrive out of order so this can be used to reject messages that are received in the incorrect order.
Data: A dictionary containing the updated information in the channel.

Channel Data

The possible contents of data in the notification for each channel is listed here: The time that the change occured is held in the timestamp that is sent with the request.

product-status

key value type options
state int [1-9]
enabled_status str "enabled", "pending_enabled", "pending_disabled", "disabled"
user str <username> - user that made the change

product-alert

key value type options
alert_id int unique identifier for this alert (any subsequent updates to this alert will have the same value here)
product_imei str the IMEI of the product associated with the alert
alert_type_id int identifies the type of the alert
start_time datetime-str "2016-01-01 00:00:00" - when the alert was raised
dismissed_at datetime-str "2016-01-01 00:00:00" - when the alert was dismissed (will be null if the alert is still active)
dismissed_by str <username> - user that made the change (will be null if the alert is still active)
dismissal_reason str the reason for the alert dismissal (will be null if the alert is still active)
repair_id int identifies the repair assicated with the alert (may be null)
extra_info str extra details about the alert (may be null)
customer_called_date datetime-str when the customer was called to discuss the alert (may be null)

Authenticating BBOXX Notifications

An example of how to authenticate a request using the secret-key (supplied when a user subscribes to a channel)


import hmac
import json
from hashlib import sha1

# Payload is a json string
payload = request.data

# Url is known
url = "http://example_domain/example_endpoint"

# The string is the json-dumped payload with the url appended
raw = payload + url

# The key is returned to the user when they subscribe to the channel.
key = "VERY-SECRET-KEY"

# Get the hash using HMAC-SHA1
hashed = hmac.new(key, raw, sha1)

# Get the signature
signature = hashed.digest().encode("base64").rstrip('\n')

print signature
>>> ypX0AaZT1FOnbHI5hLxQVK+sE+w=

# Compare to the signature in the request headers
if signature != request.headers["X-BBOXX-Signature"]:
    print "THIS REQUEST IS NOT AUTHENTIC"
    return

The notifications system supports both HTTP and HTTPS endpoints. In addition users can use the secret key - supplied when a new subscription is successfully made - to verify that an incoming notification is genuine.

BBOXX notifications are signed with a signature in the header: X-BBOXX-Signature.
The signature is generated using HMAC-SHA1 in the following manner.

  1. Take the payload (a JSON string)
  2. Append to the payload the exact URL that the request is being sent to
  3. Create a binary hash of this using HMAC-SHA1, the payload and the secret.
  4. Encode the binary hash using Base64 Encoding

Users can therefore verify that a request is genuine by taking the received request, performing the same proceedure and matching the result again the X-BBOXX-Signature in the headers of the request.

Please note that the exact url supplied to the API is used to generate the hash and any deviations, such as spaces, trailing slashes etc... will return an incorrect signature.

DCM - Device Credit Management

The section lists information about the SMARTSolar DCM (Device Credit Management) Service. Including how DCM works and details of the various API endpoints and tables that are provided to interact with DCM Enabled Units.

What is DCM?

DCM is a new way for SMARTSolar to control when a unit is enabled or disabled. Historically, all BBOXX units operated in "Server Credit Mode". When a customer pays, BBOXX servers /enable the unit and when a customer rus out of credit BBOXX Servers disable the unit again.

This system was simple but has a significant flaw: if the unit is placed in an area of bad signal, messages cannot reach the unit and the state of the unit cannot be changed. This is a particular problem for units that are currently enabled and cannot be disabled since they provide free energy to our customers.

The new DCM service allows BBOXX to add "credit" to a unit. The unit will keep a record of the remaining Balance and when the Balance reaches 0 the unit will disable itself automatically, regardless of connectivity.

Credit can be added and removed from the unit and the unit can be "zero'd" meaning that the unit sets it's own balance to 0 and returns the final_balance back to SMARTSolar.

The Balance on a unit can never go below 0. If a user attempts to remove more credit than the unit has remaining in the Balance then the unit will accept this request but set the balance the 0.

The unit will periodically update SMARTSolar with it's current Balance and the expected_expiry of that Balance.

How does DCM Work?

The DCM API can be used to add credit, remove credit or zero a unit. SMARTSolar will receive these payment_commands and update the unit each time a new payment_command is received. SMARTSolar will receive confirmation from the unit that it has received each payment_command. If confirmation is not received SMARTSolar will periodically retry to update the unit eventually falling back to SMS messages if GSM communication is not available.

SMARTSolar will retain a history of all of the payment-commands added to each unit.

PaymentCommands

Credit is managed using the payment_command table and the dedicated /products/<imei>/add_payment_command endpoint.

A payment_command has:

There are 3 possible categories:

Additionally if a unit does not respond to a zero-command it is possible to force-reset a unit using the dedicated /force_reset endpoint.

Users can add as many payment_commands as they like with the following restrictions:

Balance

The unit will keep a record of it's own Balance in memory. Periodically the unit will update SMARTSolar with it's Balance. SMARTSolar will keep the most recent Balance in the Balance table and log a history of Balances in Influx. Whenever a Balance is uploaded from a unit, SMARTSolar will calculate and store the expected_expiry of that Balance which is the date and time that we expect that unit to swtich-off (assuming no further payment-commands are added).

The Balance Balance table in SMARTSolar is updated whenever a unit receives a new payment_command. Additionally the unit will regularly update SMARTSolar with it's current Balance if it has a good GSM connection.

Note that the purpose of DCM is to overcome issues of poor connectivity which means that, by nature, we expect many DCM units to have poor connectivity and therefore have out-of-date Balance values!

Zeroing a Unit

Sometimes it's necessary to return all the remaining credit on a unit and set the Balance to 0. This is acheived using a specific payment_command called a zero-command. A zero-command is a payment_command with: * category: zero-command * value:0

When a zero-command is added SMARTSolar forwards the zero-command along with all outstanding payment-commands to the unit. When the unit receives the zero-command it will update it's Balance with the outstanding payment-commands then immediately set it's Balance to 0 and return the FinalBalance to SMARTSolar.

When SMARTSolar receives the FinalBalance it will store the result in the FinalBalance table and then VOID all previous payment_commands.

Zero-ing is an asynchronous process. The initial response to the zero-command is immediate but the FinalBalance is updated in a separate message at a later time often much later.

Voiding Commands

After a zero-command (or force-reset) all previous payment-commands for the unit have VOID set to True. This allows SMARTSolar to ignore these commands and treat the unit as though it has been completely reset without losing the history of the payment_commands that have been supplied. You can see which commands are VOID by accessing the "void" column (boolean) of the payment_command table.

Final Balance

After receiving a zero-command the unit will return it's FinalBalance to SMARTSolar. SMARTSolar will store the FinalBalance of the unit along with the payment_command_id of the associated zero-command. SMARTSolar will Publish the FinalBalance into the 'dcm' pubsub channel where any external serivce who has subscribed to the dcm channel can receive the FinalBalance and return it to the customer's account.

Force-Reset

In order to receive and process a zero-command the unit must be working correctly. If a unit is damaged or cannot receive messages from SMARTSolar it will not process the zero-command. In the event that a unit cannot process a zero-command but we still need to zero the unit it is possible to Force-Reset the unit. This action attempts to remove as much credit as possible from a unit without connecting to it based on known information in SMARTSolar.

A user can force-reset a unit using the dedicated /force_reset endpoint.

When a unit is Force-Reset SMARTSolar will synchronously remove credit from the device and return it in the response to the /force_reset API request.

SMARTSolar will return two values in response to a /force_reset: { "status": "success", "data": { "outstanding_payments": <int> # (sum of all payment not yet acknowledged by the unit) "last_known_balance": <int> # (the last balance recorded by the unit (can be None) }, "message": "Product #111222333444555 has been Force-Reset" }

A /force_reset request will VOID all previously payment_commands and zero the Balance in SMARTSolar for that unit.

DCM API Examples

Adding Credit

To add credit to a unit, send a payment_command with category: payment and value > 0.

Here is an example request to add 10 credit to a device:

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/add_payment_command"
    data = {
            "value": 10,
            "transaction_id": 'eda4997b-8efa-4ec7-8496-8c6f38ddb579',
            "category": 'payment'
        }
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.post(url=url, json=data, headers=headers)

    print r.json()
    >>> {
        "status": "success",
        "message": "new payment_command added to product #000000000000",
        "data": None,
    }
value
endpoint /products/<imei>/add_payment_command
method POST
url_params product_imei (str)
payload {"value": 10,
 "category": 'payment',
 "transaction_id": <tx_id>}
response 201

Removing Credit

To remove credit from the device you must add a new payment_command with category: bad_payment and value < 0.

A unit's Balance can never be negative. Requests which attempt to remove more credit than has ever been added to a device will be rejected. Requests which remove more credit than there is Balance remaining will be accepted but the Balance will be floored at 0.

For example:

payment: +10          | Balance: +10
< 7 credit used >     | Balance: +3
bad_payment: -20      | Rejected! (-20 is more than has ever been added (+10))
bad_payment: -5       | Balance: 0 (request accepted but Balance cant be < 0)

Here is an example request to remove 10 credit from a unit:

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/add_payment_command"
    data = {
            "value": -10,
            "transaction_id": 'eda4997b-8efa-4ec7-8496-8c6f38ddb579',
            "category": 'bad-payment'
        }
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.post(url=url, json=data, headers=headers)

    print r.json()
    >>> {
        "status": "success",
        "message": "new payment_command added to product #000000000000",
        "data": None,
    }
value
endpoint /products/<imei>/add_payment_command
method POST
url_params product_imei (str)
payload {"value": -10,
 "category": "bad-payment",
 "transaction_id": <tx_id>}
response 201

Zero-ing a unit

To zero a unit you must add a new payment_command with category: zero-command and value: 0.

Here is an example request to zero and unit:

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/add_payment_command"
    data = {
            "value": 0,
            "transaction_id": 'eda4997b-8efa-4ec7-8496-8c6f38ddb579',
            "category": 'zero-command'
        }
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.post(url=url, json=data, headers=headers)

    print r.json()
    >>> {
        "status": "success",
        "message": "new payment_command added to product #000000000000",
        "data": None,
    }
value
endpoint /products/<imei>/add_payment_command
method POST
url_params product_imei (str)
payload {"value": 0,
 "category": "zero-command",
 "transaction_id": <tx_id>}
response 201

Force-Reseting a unit.

To force-reset a unit you must use the dedicated /force_reset endpoint. This endpoint still requires a transaction_id to prevent duplicate force-reset messages.

Here is an example request to force-reset a unit:

    url = "https://smartapi.bboxx.co.uk/v1/products/000000000000/force_reset"
    data = {"transaction_id": 'eda4997b-8efa-4ec7-8496-8c6f38ddb579'}
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.post(url=url, json=data, headers=headers)

    print r.json()
    >>> {
        "status": "success",
        "message": "Product #111222333444555 has been Force-Reset",
        "data": {
            "outstanding_payments": 250
            "last_known_balance": 58
        }
    }
value
endpoint /products/<imei>/force_reset
method POST
url_params product_imei (str)
payload {"transaction_id": <tx_id>}
response 201

Querying PaymentCommands

See the PaymentCommand table.

Querying Balances and expected_expiry

See the Balance table.

Querying FinalBalances

See the FinalBalance table.

Using The API

This section contains general information about using the API including authentication, query formats and error codes as well as more general information about the BBOXX Units and the information that is accessible from the API.

Authentication and Permissions

Authentication for any request is made by added a valid token to the headers as follows:

{'Content-Type': 'application/json', 'Authorization': 'Token token=' + <TOKEN-GOES-HERE>}

The token is a random 64-char string.

Generating a Valid Token (Logging in)

    url = 'https://smartapi.bboxx.co.uk/v1/auth/login'
    fields = {
        "username": <username>,
        "password": <password>
    }

    r = requests.post(url, data=fields)

    token = r.json()["message"]["login_successful"]["API_token"]

    print token
    >>> "sRtBFThPFIpgKY2sYkaSHFbo1hosg2NvCP4PmBIxfGQ62VS6zrjFT6dr1qDLQGz"

To generate a valid token a user should send a POST reqest to /auth/login with their username and password.

A valid token will be sent in response if the username and passworod are correct.

The Full /auth/login Response


    url = 'https://smartapi.bboxx.co.uk/v1/auth/login'
    fields = {
        "username": <username>,
        "password": <password>
    }

    r = requests.post(url, data=fields)
    r.json()
    >>> {
        "status": "success",
        "message": {
            "login_successful": {
                "username": "test.user@bboxx.co.uk",
                "entity_id": 1,
                "display_name": "T User",
                "name": "",
                "user_product_visibility": "GLOBAL",
                "hub_id": None,
                "shop_id": None,
                "API_token": "sRtBFThPFIpgKY2sYkaSHFbo1hosg2NvCP4PmBIxfGQ62VS6zrjFT6dr1qDLQGz",
                "token_expiry": "Mon, 01 Aug 2016 17:05:11 GMT",
                "permissions": "SYSTEM"
            }
        }
    }

A succcesful call to /auth/login will return general information about the user as well as the token including amongst other things expiry of the token and the permissions and scope that the user has.

You can view r.json() to see the full response object.

Token Expiry

The token will expire after 3 hours.

After each successful request made using the token, the expiry time will be extended, thus a token will only expire after 3 hours without use.

If the token expires the user should simply login again as above to generate a new valid token.

A basic authentication routine

    def login():
        url = 'https://smartapi.bboxx.co.uk/v1/auth/login'
        fields = {
            "username": <username>,
            "password": <password>
        }

        r = requests.post(url, data=fields)

        token = r.json()["message"]["login_successful"]["API_token"]
        headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + token}

        return headers

A basic authentication routine would therefore do the following:

This strategy is effective but inefficient as a new token would be generated for each and every request and the login process can be slow.

This is particularly bad if multiple requests are being made such as enabling/disabling a full portfolio products or applying a mass-update.

An Efficient authentication routine

The following three functions could be used to generate a valid token without repeatedly called /auth/login

def login():
    url = 'https://smartapi.bboxx.co.uk/v1/auth/login'
    fields = {
        "username": <username>,
        "password": <password>
    }
    r = requests.post(url, data=fields)

    token = r.json()["message"]["login_successful"]["API_token"]
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + token}

    write_token_to_file(r.json(), headers)

    return headers


def write_token_to_file(data, headers):
    expiry = data["message"]["login_successful"]["token_expiry"]

    with open('token.json', 'w') as token_file:
        json.dump({'headers': headers, 'expiry': expiry}, token_file)


def get_headers():

    if os.path.exists('token.json'):

        with open('token.json') as token_file:
            data = json.load(token_file)

            expiry = dateutil.parser.parse(data['expiry']).replace(tzinfo=None)

            # If it's expired, make a new one.
            if expiry < (dt.datetime.utcnow() - dt.timedelta(minutes=10)):
                return login()
            else:  # Else return the one in the file.
                return data['headers']

    else:
        return login()

Usage would then be as follows:

url = "https://smartapi.bboxx.co.uk/v1/endpoint"
data = json.dumps(data)
headers = get_headers()

r = requests.get(url=url, data=data, headers=headers)

To avoid the inefficiencies described above a more complex routine should be developed:

This strategy is much preferable.

Code snippets demonstrating this routine are shown to the right.

There are of course a number of other possible strategies for avoiding repeated calls to /auth/login this is simply a suggestion.

Permissions and Scope

The SMARTSolarAPI restricts access to data and products in two orthogonal "layers". These layers define:

Thus a user may be given read-only access to every product in a portfolio or full permissions but only on a subset of units.

We name these two layers PERMISSIONS and SCOPE.

Permissions

There are 5 levels of permission that a user can have. These permissions are "heirachical" - each successive permissions level can do everything the lower level can do plus some extra functionality.

These permissions in ascending order are:

Scope

Users can have either GLOBAL or ENTITY scope, that is, they can either see ALL units or see only units assigned to the entity that they belong. What each user can do to the units visible to them is defined by PERMISSIONS above.

Units connecting to the System

A Unit will connect to the system in 3 ways.

RM_DATA

The /rm_data endpoint handles telemetry data (voltage, current, temperature and others).

The unit will only ever POST to this endpoint, this is the unit uploading its stored metric data to the influx database. The unit will attempt to POST metric data once every four hours. If the POST is successful the uploaded data is no longer stored on the unit. If the POST fails then the unit will continue to store its data until a successful POST is made.

RC_DATA

The /rc_data endpoint handles all other unit information (location, software, enable_status, tamper_status etc.).

A unit will GET from rc_data in order to download new settings and statuses. A unit will POST to rc_data to inform the system of its current status, software, location etc...

The unit will always perform a POST immediately followed by a GET once every 4 hours.

POST

The unit sends its current status up to the system which then updates the status of the unit. This request causes the change from pending_enabled to enabled etc. This request will also inform the system of the current firmware on the unit.

GET

The unit receives any instructions from the system which could include instructions to update the software, change the power settings (capacity limit) or enabled_status.

Pending Changes

In order for any change made in the system to take effect on the unit the unit must first make the GET connection listed above. Since these connections happen once every four hours (or more if signal is bad) there can be a significant time delay between setting the change via the API or web interface and that change coming into effect on the unit.

To reflect this most changes will be listed in the system as pending immediately after they are set and remain pending until the unit makes a connection.

Units can be forced to connect early by using the WakeUp-SMS feature. See those docs for more details.

Meta Data

All records in the SMARTSolar Database have "meta-data" associated with them. This data includes:

These fields are always set by the system and should not be set by the user. They can be queried as usual using the normal query syntax.

A request like this:

    url = 'https://smartapi.bboxx.co.uk/v1/product_types'
    data = {
        "name": "Test Product Type",
        "erp_code": "XX0005",
    }
    headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.post(url=url, data=data, headers=headers)

Would therefore give a response like this:

>>> {
        u'product_type_id': 19
        u'name': u'Test Product Type',
        u'erp_code': u'XX0005',
        u'created_at': u'2016-07-28T08:43:09.501636',
        u'created_by': u'u.celery@bboxx.co.uk',
        u'modified_at': None,
    }

Note that product_type_id and all of the rest of the meta-data have been set correctly

<table_name>_id

Every record has an integer identifier. This is the primary key for that record and is therefore unique. The identifier for any given table is <table_name>_id for example:

Table Primary Key
amomaly anomaly_id
software_version_type software_version_type_id

The id is assigned by the system automatically during any POST request and should not be specified by the user.

There is one exception to this. The Product table uses imei (a 15 char string) as the primary key. It does not have a product_id field.

created_at

Every record has a created_at column which is a millisecond-precision timestamp in ISO8601 format (YYYY-MM-DD HH:MM:SS.mmmm). created_at specifies the time at which the record is inserted into the database and is set by the system. If created_at is specified by the user it is ignored.

All times are UTC with no timezone information.

created_by

Every record has a created_by column which is the username of the user responsible for creating the record. created_by is set by the system, if created_at is specified by the user it is ignored and replaced with the username associated which the token provided in the headers.

modified_at

Every record has a modified_at column which is a millisecond-precision timestamp in ISO8601 format (YYYY-MM-DD HH:MM:SS.mmmm).

modified_at specifies the last time that an column in that record was altered and is set by the system. If modified_at is specified by the user it is ignored.

Query Format and Filtering

The filters can be applied using the q query parameter as follows:

url = "https://smartapi.bboxx.co.uk/v1/products"
params = {
    "q": json.dumps({
        "filters": filters,
        "limit": limit,
        "offset": offset,
        "group_by": group_by,
        "order_by": order_by,
        "single": True
    })
}
headers = {'Content-Type': 'application/json', 'Authorization': 'Token token=' + token}

r = requests.get(url, params, headers)

Where each mapping is optional. A brief example of each mapping is shown here, full details can be seen below:

filters = [
    {"name": "product_imei", "op": "eq", "val": "013777894687"},
    {"name": "product_type_id", "op": "lt", "val": 3}
]

limit = 100

offset = 10

group_by = [
    {"field": "product_type_id"},
    {"field": "hub_id"},
    {"field": "shop_id"},
]

order_by = [
    {"field": "created_at", "direction": "asc"},
    {"field": "capacity_limit", "direction": "desc"}
]

single = True/False

Filtering of requests is made via the query parameter. The query parameter q must be a JSON string. It can have the following mappings, all of which are optional:

Filters

Filters are a list of objects of one of the following forms:

{"name": <fieldname>, "op": <operatorname>, "val": <argument>}

or:

{"name": <fieldname>, "op": <operatorname>, "field": <fieldname>}

Some examples of each operator used inside the filters dictionary

# EQUALS
{"name": "product_imei", "op": "==", "val": "013777894687"}
{"name": "product_imei", "op": "eq", "val": "013777894687"}
{"name": "product_imei", "op": "equals", "val": "013777894687"}
{"name": "product_imei", "op": "equals_to", "fieldname": "current_tamper_flag"}

# NOT EQUALS
{"name": "enabled_flag", "op": "!=", "val": "013777894687"}
{"name": "enabled_flag", "op": "neq", "val": "013777894687"}
{"name": "enabled_flag", "op": "does_not_equal", "val": "013777894687"}
{"name": "enabled_flag", "op": "not_equal_to", "val": "013777894687"}

# GREATER THAN
{"name": "capacity_limit", "op": ">", "val": 15}
{"name": "capacity_limit", "op": "gt", "val": 15}

# GREATHER THAN OR EQUAL TO
{"name": "capacity_limit", "op": ">=", "val": 15}
{"name": "capacity_limit", "op": "ge", "val": 15}
{"name": "capacity_limit", "op": "gte", "val": 15}
{"name": "capacity_limit", "op": "geq", "val": 15}

# LESS THAN
{"name": "capacity_limit", "op": "<", "val": 15}
{"name": "capacity_limit", "op": "lt", "val": 15}

# IN
{"name": "product_imei", "op": "in", "val": [1,2,5]}

# IS NULL
{"name": "software_lock", "op": "is_null", "val": ""}

# IS NOT NULL
{"name": "software_lock", "op": "is_not_null", "val": ""}

Operators

The operator strings recognized by the API incude:

Operator Alternative string Meaning
== eq, equals, equals_to equals
!= neq, does_not_equal, not_equal_to does not equal
> gt strictly greater than
< lt strictly less than
>= ge, gte, geq greater than or equal to
<= le, lte, leq less than or equal to
in contained with-in the list supplied. val can be specified or a filter
not_in not contained with-in the list supplied. val can be specified or a filter
is_null is NULL
is_not_null is not NULL
like case-sensitive string matching
ilike case-insensitive string matching
has True if a single related field matches a value in the supplied list. val can be specified or a query.
any True if any related field matches a value in the supplied list. val can be specified or a query.

In the first form, <operatorname> is one of the strings described in the Operators section, the first <fieldname> is the name of the field of the model to which to apply the operator, <argument> is a value to be used as the second argument to the given operator. In the second form, the second <fieldname> is the field of the model that should be used as the second argument to the operator.

<fieldname> may alternately specify a field on a related model, if it is a string of the form <relationname>__<fieldname>.

If the field name is the name of a relation and the operator is "has" or "any", the "val" argument can be a dictionary with the arguments representing another filter to be applied as the argument for "has" or "any".

The returned list of matching instances will include only those instances that satisfy all of the given filters.

Filter objects can also be arbitrary Boolean formulas. For example:

{"or": [<filterobject>, {"and": [<filterobject>, ...]}, ...]}

If a filter is poorly formatted (for example, op is set to '==' but val is not set), the server responds with 400 Bad Request.

Limit

params = {
    "q": json.dumps({
        "limit": 5
    })
}

A positive integer which specifies the maximum number of objects to return.

Offset

params = {
    "q": json.dumps({
        "offset": 10
    })
}

A positive integer which specifies the offset into the result set of the returned list of instances.

Order By

params = {
    "q": json.dumps({
        "order_by": [{"field": "created_at", "direction": "asc"}]
    })
}

A list of objects of the form:

{"field": <fieldname>, "direction": <directionname>}

Where <fieldname> is a string corresponding to the name of a field of the requested model and <directionname> is either "asc" or "desc".

<fieldname> may alternately specify a field on a related model, if it is a string of the form <relationname>__<fieldname>.

Group By

params = {
    "q": json.dumps({
        "group_by": [
            {"field": product_imei},
            {"field": product_entity_linker__anomaly_id}
        ]
    })
}

A list of objects of the form:

{"field": <fieldname>}

Where <fieldname> is a string corresponding to the name of a field of the requested model.

<fieldname> may alternately specify a field on a related model, if it is a string of the form <relationname>__<fieldname>.

Single

params = {
    "q": json.dumps({
        "single": True
    })
}

A Boolean representing whether a single result is expected as a result of the search. If this is true and either no results or multiple results meet the criteria of the search, the server responds with an error message.

Errors

The SMARTSolar API uses the following response codes:

Error Code Meaning
400 Bad Request -- Please check your request for errors
401 Unauthorized -- Your token is invalid or not present
403 Forbidden -- Your user is not allowed to access this resource. If you believe you should have permission please contact support@bboxx.co.uk
404 Not Found -- The specified resource could not be found
405 Method Not Allowed -- The method is not allowed at this endpoint
500 Internal Server Error -- We had a problem with our server. Please contact d.mclean@bboxx.co.uk with exact details of your request.
503 Service Unavailable -- We're temporarially offline for maintanance. Please try again later.

Internationalization

    url = "https://smartapi.bboxx.co.uk/v1/repairs/000000000000/current_state"
    headers = {'Content-Type': 'application/json', 'Accept-Language': 'fr', 'Authorization': 'Token token=' + A_VALID_TOKEN}

    r = requests.get(url=url, headers=headers)

    print r.json()
    >>> {
            "status": "success",
            "message": "Repair found",
            "data": {
                "description": "Le gabarit de test indique que cette unité a une carte de circuit imprimé défectueuse. Remplacer le PCB. Cliquez sur le bouton ci-dessous lorsque cela a été fait",
                "events": [],
                "ident": "replace_pcb",
                "inputs": [
                    {
                        "data_type": "selection",
                        "ident": "replacement_part_type",
                        "label": "Choisissez l'un de ces PCB de remplacement",
                        "options": [
                            {
                                "label": "BBOXX Home 2 PCB (Tiger 7)",
                                "value": 61
                            },
                            {
                                "label": "BBOXX Home 2 PCB (Tiger 2)",
                                "value": 44
                            },
                            {
                                "label": "BBOXX Home 2 PCB (Tiger 6)",
                                "value": 48
                            }
                        ],
                        "selection_type": "single"}],
                "name": "Remplacer le PCB"
            },
    }

Some parts of SMART Solar now support multiple languages. The API client can specify its preferred language using the Accept-Language request HTTP header. Currently the only languages supported are English (language code 'en') and French (language code 'fr').

The default language is English, used when the Accept-Language header is omitted. The example on the right demonstrates the use of the Accept-Language header when French is the desired response language: