Introduction
Welcome to Dividia ScaleWatcher API documentation! This API allows you to seamlessly search and retrieve information from the ScaleWatcher platform. With powerful search capabilities, you can quickly access data related to transactions, events, alerts and more.
Whether you’re integrating ScaleWatcher’s features into your application or building custom workflows, this API provides a simple, programmatic way to access the platform’s rich data.
Key Features:
- Advanced Search: Perform detailed and refined searches across various data types.
- Flexible Filtering: Narrow down your results with custom filters based on your requirements.
- Real-Time Access: Get up-to-date data directly from the ScaleWatcher platform for seamless integration.
This documentation will guide you through the authentication process, available endpoints, and response formats so you can easily interact with the API and leverage the full potential of the ScaleWatcher platform.
Authentication
Overview
To use Dividia’s ScaleWatcher API, you must authenticate using an API token and a site serial number. The API token verifies your identity, and the site serial number ensures you have access to the specific site’s data.
Prerequisite
Ensure that the site you wish to access has availed of an API Plan. If not, please contact support to discuss about our API Plan offerings.
Steps to Authenticate:
- Obtain an API Token:
If you don’t already have an API token, contact support to create an account and request API access. You will receive your unique token along with the list of sites (and their serial numbers) you were given access to via email after your request is processed.
* if you are a site admin, you may regenerate a new token within ScaleWatcher Cloud interface, if not, please contact your site’s admin to request for a new token - Include the Token and Serial in API Requests:
Add the API token in the Authorization header as a Bearer token and the site serial number as a query parameter in the request URL.
import axios from 'axios'; const url = 'https://api.cloud.dividia.net/sw/api/endpoint'; const serial = 'SITE_SERIAL_NUMBER'; const token = 'YOUR_API_TOKEN'; axios.get(`${url}?serial=${serial}`, { headers: { 'Authorization': `Bearer ${token}` } }) .then(response => { console.log(response.data); }) .catch(error => { console.error('Error:', error.response.status); })
Rate Limits
To ensure optimal performance and fair usage of the API, we impose the following rate limits:
Type | Description |
Duplicate Requests | If a new request is received while a previous request with identical parameters has not yet completed, it will be rejected to prevent unnecessary load on the system. |
IP-based | A maximum of 60 API calls per 60 seconds is allowed from the same IP address regardless of which endpoint or parameter was provided. |
Serial-based | A maximum of 60 API calls per 60 seconds is allowed from the same site serial number regardless of which endpoint or parameter was provided. |
Subscription Plan Limit | Depending on your subscription plan, the API rate limit may differ. Please refer to your subscription agreement for the corresponding limit. |
If you exceed any of these limits, you will receive an error message indicating the rate limit has been exceeded, and you will need to wait until the window resets before making further requests.
Error Types
In the event of an error occurring during an API request, an error object will be returned. This object contains the following key fields:
- code: A numerical code representing the type of error that occurred.
- type: A brief identifier or label for the error, which helps categorize the issue.
- message: A human-readable description of the error, which provides helpful information or a tip to assist in troubleshooting the cause of the issue.
Code | Type | Description |
200 | Success | Successful API call |
400 | BadRequest | Invalid parameters |
401 | UnauthorizedAccess | Unauthorized access |
403 | ForbiddenRequest | Forbidden access |
404 | NotFound | Resource not found |
413 | PayloadTooLarge | Payload too large |
429 | TooManyRequests | Too many requests |
500 | InternalServerError | Unexpected error occurred |
Common Parameters and Responses
Parameters
Name | Type | Attributes | Description |
serial | integer | required | site/location serial number |
orderBy | string | optional | sort list by the given field name, available options are the same as the api parameters |
orderDir | string | optional options: asc, desc | sorting direction |
page | integer | optional | page number for pagination |
pageSize | integer | optional default: 50000 | maximum items to be returned |
Response
Name | Type | Description |
page | integer | current page number in the paginated results |
pagesize | integer | maximum number of items per page |
total | integer | total number of items in the dataset |
count | integer | number of items returned in the current page |
data | array | actual records or results for the current page (see individual APIs for api-specific fields) |
error | object | if the request encounters an error, only this value is returned which contains the error code, type and message, if there are no errors, this will not be returned |
Endpoints
/sw/api/alerts
Description: Search for ScaleWatcher transaction alerts
Parameters
const url = 'https://api.cloud.dividia.net/sw/api/alerts?serial=6000&transactionId=2936037&includeActivities=1' axios.get(url, { headers: {'Authorization': `Bearer ${YOUR_API_TOKEN}`} }).then(response => { console.log(response.data })
Name | Type | Attributes | Description |
serial | integer | required | site/location serial number |
id | integer | optional | alert id |
name | string | optional | alert type/name |
transactionId | integer | optional | id of the transaction where the alert belongs to |
status | string | optional | alert status |
flagged | boolean | optional options: 0, 1 | search if an alert is already past due |
date | date | optional format: yyyy-mm-dd | alert date |
startDate | date | optional format: yyyy-mm-dd | get alerts where date is on or after the specified date |
endDate | date | optional format: yyyy-mm-dd | get alerts where date is on or before the specified date |
hasComment | boolean | optional options: 0, 1 | searches for alerts with comments |
comment | string | optional | searches for alerts that contains the supplied comment value |
priority | string | optional options: low, medium, high | alert priority |
assignedId | integer | optional | id of assigned user |
assignee | string | optional | name of assigned user |
scale | integer | optional | onsite scale |
includeActivities | boolean | optional options: 0, 1 | include list of activities per alert |
Return
{ "page": 1, "pagesize": 50000, "total": 1, "count": 1, "data": [ { "id": 468043, "sName": "AlertValveDataFail", "bTransaction": 2936037, "sStatus": "inprogress", "fFlagged": 0, "bSerial": 6000, "bAssignedId": 0, "sAssignedUser": null, "sData": { "input": 1 }, "sImages": [ "https://api.cloud.dividia.net/uploads/scalewatcher/api/6000/2024/09/06/ValveDataFail_2024-09-06T19-08-54Z_1.jpg" ], "dTimestamp": "2024-09-06T14:08:54.000Z", "sPriority": "Medium", "tzOffset": -5, "bScale": 13, "activities": [ { "id": 120538, "bAlertId": 468043, "bUserId": 1, "sUser": "Admin Dividia", "dTimestamp": "2024-09-18T13:04:40.000Z", "sComment": "", "sAction": "status changed to: assigned" } ] } ] }
Name | Type | Description |
id | integer | alert id |
sName | string | alert type/name |
bTransaction | integer | id of related transaction |
sStatus | string | alert status |
fFlagged | boolean | a return value of "1" signifies that the alert is already past due |
bSerial | integer | site/location serial number |
bAssignedId | integer | id of assigned user |
sAssignedUser | string | name of assigned user |
sData | object | key-value data provided by DVR |
sImages | array | array of image urls |
dTimestamp | timestamp | date and time the alert happened, value is based on DVRs timezone (see tzOffset) |
sPriority | string | alert priority |
tzOffset | integer | DVR timezone offset |
bScale | integer | onsite scale |
activities | array | list of activities associated with this alert |
/sw/api/events
Description: Search for ScaleWatcher transaction events
Parameters
const url = 'https://api.cloud.dividia.net/sw/api/events?serial=6000&transactionId=2936037' axios.get(url, { headers: {'Authorization': `Bearer ${YOUR_API_TOKEN}`} }).then(response => { console.log(response.data })
Name | Type | Attributes | Description |
serial | integer | required | site/location serial number |
id | integer | optional | event id |
name | string | optional | event type/name |
transactionId | integer | optional | id of the transaction where the event belongs to |
ticket | integer | optional | event ticket id |
date | date | optional format: yyyy-mm-dd | event date |
startDate | date | optional format: yyyy-mm-dd | get events where date is on or after the specified date |
endDate | date | optional format: yyyy-mm-dd | get events where date is on or before the specified date |
Return
{ "page": 1, "pagesize": 50000, "total": 1, "count": 1, "data": [ { "id": 6893440, "sName": "AlertValveDataFail", "bTransaction": 2936037, "bTicket": null, "bSerial": 6000, "sData": { "input": 1 }, "sImages": [ "https://api.cloud.dividia.net/uploads/scalewatcher/api/6000/2024/09/06/ValveDataFail_2024-09-06T19-08-54Z_1.jpg" ], "dTimestamp": "2024-09-06T14:08:54.000Z", "tzOffset": -5 } ] }
Name | Type | Description |
id | integer | event id |
sName | string | event type/name |
bTransaction | integer | id of related transaction |
bTicket | integer | ticket number |
bSerial | integer | site/location serial number |
sData | object | key-value data provided by DVR |
sImages | array | array of image urls |
dTimestamp | timestamp | date and time the event happened, value is based on DVRs timezone (see tzOffset) |
tzOffset | integer | DVR timezone offset |
/sw/api/events/tickets
Description: Search for ScaleWatcher transaction events based on ticket details
Parameters
const url = 'https://api.cloud.dividia.net/sw/api/events/tickets?serial=6000&ticket=1000&customer=Command Alkon' axios.get(url, { headers: {'Authorization': `Bearer ${YOUR_API_TOKEN}`} }).then(response => { console.log(response.data })
Name | Type | Attributes | Description |
serial | integer | required | site/location serial number |
* ticket key * | string | optional | * ticket key * can be any key from a scale ticket the value will be searched against the provided input (see sData.ticket in returned data for en example of key-value pairs) |
Return
{ "page": 1, "pagesize": 50000, "total": 1, "count": 1, "data": [ { "id": 6893535, "bTransaction": 2936054, "bTicket": "1000", "bSerial": 6000, "tzOffset": -6, "sData": { "ticket": { "customer": "Customer: Command Alkon", "status": "Z", "weight": "76000 LB", "autoid": "ABC1234", "carrier": "Carrier: Dividia Tech.", "locationid": "Location: 4400", "uniqueid": "1588693466", "time": "15:44:26", "date": "02/02/2024", "truck": "1234", "ticket": "1000" }, "number": "1000" }, "sImages": [], "dTimestamp": "2024-02-02T07:41:50.000Z" } ] }
Name | Type | Description |
id | integer | event id |
bTransaction | integer | id of related transaction |
bTicket | integer | ticket number |
bSerial | integer | site/location serial number |
sData | object | key-value data provided by DVR |
sImages | array | array of image urls |
dTimestamp | timestamp | date and time the event happened, value is based on DVRs timezone (see tzOffset) |
tzOffset | integer | DVR timezone offset |
/sw/api/transactions
Description: Search for ScaleWatcher transactions
Parameters
const url = 'https://api.cloud.dividia.net/sw/api/transactions?serial=6000&id=2936037&includeEvents=1&includeAlerts=1' axios.get(url, { headers: {'Authorization': `Bearer ${YOUR_API_TOKEN}`} }).then(response => { console.log(response.data })
Name | Type | Attributes | Description |
serial | integer | required | site/location serial number |
id | integer | optional | transaction id |
scale | integer | optional | onsite scale |
lpn | string | optional | vehicle license plate |
truck | string | optional | truck identifier |
ticket | integer | optional | transaction ticket id |
date | date | optional format: yyyy-mm-dd | transaction date |
startDate | date | optional format: yyyy-mm-dd | get transactions where date is on or after the specified date |
endDate | date | optional format: yyyy-mm-dd | get transactions where date is on or before the specified date |
tag | string | optional | vehicle tag |
incomplete | boolean | optional options: 0, 1 | searches for transactions that are considered as incomplete (did not have required events) |
includeEvents | boolean | optional options: 0, 1 | include list of events per transaction |
includeAlerts | boolean | optional options: 0, 1 | include list of alerts per transaction |
Return
{ "page": 1, "pagesize": 50000, "total": 1, "count": 1, "data": [ { "id": 2936037, "bSerial": 6000, "bScale": 13, "dTimestamp": "2024-09-06T14:08:54.000Z", "dStart": "2024-09-06T14:08:54.000Z", "dEnd": "2024-09-06T14:08:54.000Z", "tzOffset": -5, "sLpn": "", "sTruck": null, "bTicket": null, "bFacilityDuration": 0, "bLoadDuration": 0, "bWaitDuration": 0, "fHidden": 0, "sTag": "", "events": [], "alerts": [] } ] }
Name | Type | Description |
id | integer | transaction id |
bSerial | integer | site/location serial number |
bScale | integer | onsite scale |
dTimestamp | timestamp | date and time the transaction happened, value is based on DVRs timezone (see tzOffset) |
dStart | timestamp | date and time the first transaction event happened, value is based on DVRs timezone (see tzOffset) |
dEnd | timestamp | date and time the last transaction event happened, value is based on DVRs timezone (see tzOffset) |
tzOffset | integer | DVR timezone offset |
sLpn | string | vehicle license plate number |
sTruck | string | truck identifier |
bTicket | integer | transaction ticket number |
bFacilityDuration | integer | facility duration in seconds |
bLoadDuration | integer | load duration in seconds |
bWaitDuration | integer | wait duration in seconds |
fHidden | boolean | a return value of "1" signifies an incomplete transaction (did not meet the required events to be considered as a completed transaction) |
sTag | string | vehicle tag |
events | array | list of events associated with this transaction (see /events api for detailed return values) |
alerts | array | list of alerts associated with this transaction (see /alerts api for detailed return values) |
/sw/api/transactions/stats
Description: Get average, min and max statistics for the searched ScaleWatcher transactions
Parameters
const url = 'https://api.cloud.dividia.net/sw/api/transactions/stats?serial=6000&startDate=2024-06-03&endDate=2024-06-04&interval=daily' axios.get(url, { headers: {'Authorization': `Bearer ${YOUR_API_TOKEN}`} }).then(response => { console.log(response.data })
Name | Type | Attributes | Description |
serial | integer | required | site/location serial number |
id | integer | optional | transaction id |
scale | integer | optional | onsite scale |
lpn | string | optional | vehicle license plate |
truck | string | optional | truck identifier |
ticket | integer | optional | transaction ticket id |
date | date | optional format: yyyy-mm-dd | transaction date |
startDate | date | optional format: yyyy-mm-dd | get transactions where date is on or after the specified date |
endDate | date | optional format: yyyy-mm-dd | get transactions where date is on or before the specified date |
tag | string | optional | vehicle tag |
interval | string | optional options: daily, hourly | group returned data based on interval, if none is provided, stats value is based on all matching results |
Return
{ "data": [ { "bCount": 15, "bFacilityMin": 921, "bFacilityMax": 2428, "bFacilityAvg": 1696, "bLoadMin": 0, "bLoadMax": 1571, "bLoadAvg": 514, "bWaitMin": 0, "bWaitMax": 1840, "bWaitAvg": 632, "dDate": "2024-06-03" }, { "bCount": 27, "bFacilityMin": 832, "bFacilityMax": 5705, "bFacilityAvg": 1642, "bLoadMin": 0, "bLoadMax": 1593, "bLoadAvg": 417, "bWaitMin": 0, "bWaitMax": 2684, "bWaitAvg": 475, "dDate": "2024-06-04" } ] }
Name | Type | Description |
bCount | integer | number of transactions in the group set |
bFacilityMin | integer | minimum facility duration in seconds |
bFacilityMax | integer | maximum facility duration in seconds |
bFacilityAvg | integer | average facility duration in seconds |
bLoadMin | integer | minimum load duration in seconds |
bLoadMax | integer | maximum load duration in seconds |
bLoadAvg | integer | average load duration in seconds |
bWaitMin | integer | minimum wait duration in seconds |
bWaitMax | integer | maximum wait duration in seconds |
bWaitAvg | integer | average wait duration in seconds |
dDate | date | if interval param is set to "daily", dDate is returned |
dHour | string | a 2-digit string representation of hour if interval param is set to "hourly", dHour is returned |
/sw/api/users
Description: Search for ScaleWatcher users
Parameters
const url = 'https://api.cloud.dividia.net/sw/api/users?serial=6000&id=102' axios.get(url, { headers: {'Authorization': `Bearer ${YOUR_API_TOKEN}`} }).then(response => { console.log(response.data })
Name | Type | Attributes | Description |
serial | integer | required | site/location serial number |
id | integer | optional | user id |
string | optional | user's email address | |
name | string | optional | searches for user names that starts with the given value |
startDate | date | optional | searches for users where created date is greater than or equal to provided value |
hasAdminRights | boolean | optional | searches for users with admin rights |
hasApiRights | boolean | optional | searches for users that has api access to the given site's serial number |
Return
{ "page": 1, "pagesize": 50000, "total": 1, "count": 1, "data": [ { "id": 102, "sEmail": "test@dividia.test", "sName": "API Test User", "createdAt": "2025-02-24T14:51:00.000Z", "hasAdminRights": 0, "hasApiRights": 1, "dLastActive": "2025-03-07T02:43:58.000Z" } ] }
Name | Type | Description |
id | integer | user id |
sEmail | string | user's email address |
sName | string | user's full name |
createdAt | timestamp | date and time when user account was created |
hasAdminRights | boolean | a return value of "1" signifies that the user has admin rights |
hasApiRights | boolean | a return value of "1" signifies that the user has api rights to the given site serial |
dLastActive | timestamp | date and time when user last interacted with ScaleWatcher Cloud |
Terms of Use
By using Dividia’s API, you agree to the following terms of use:
Permitted Use:
You may only use the API to access and integrate data from Dividia’s services for your own legitimate business purposes, in accordance with our documentation and applicable laws.
Authentication:
You must use valid API credentials to access the API, and are responsible for maintaining the security of your credentials.
Rate Limits:
You must adhere to our established API rate limits to prevent excessive usage and ensure fair access for all users. Exceeding these limits may result in temporary or permanent suspension of access.
Data Privacy:
You must handle any data obtained through the API with the utmost care, complying with all relevant privacy laws and regulations when processing user information.
Prohibited Uses:
You may not use the API for any illegal or malicious purposes, including scraping, spamming, or unauthorized access to data.
Service Availability:
We strive to maintain API uptime, but we do not guarantee uninterrupted service. Scheduled maintenance or unexpected downtime may occur.
Modification and Termination:
Dividia reserves the right to modify or terminate API access at any time, without prior notice, for any reason, including violation of these terms.
Indemnification:
You agree to indemnify and hold Dividia harmless from any claims arising from your use of the API.
Governing Law:
These terms are governed by and construed in accordance with the laws of the State of Texas, United States of America. Any disputes arising from these terms shall be resolved in the courts located in Fort Worth, Texas.
By accessing and using the API, you acknowledge that you have read and agree to these terms of use.