Netsuite Integration Guide
To bring Arlyn UpScale weight readings into NetSuite, use a bridge program between the scale and NetSuite. The bridge either requests a reading with GET or receives a JSON push from the scale. It then checks the reading, maps the values and sends them to NetSuite using NetSuite authentication.
A bridge is simply a program running on a computer that can communicate with both systems. On your local network, it exchanges weight data with UpScale through Ethernet or Wi-Fi. It uses a separate HTTPS connection to send the resulting record to NetSuite. This keeps the scale’s connection separate from NetSuite’s login and record-creation requirements.
The walkthrough below follows that bridge route from the first connection to a saved record. You can use the records for inventory receipts, work order completions, quality-control checks or shipping and packing. The example creates a custom Scale Reading record; your integration can then link that record to the appropriate NetSuite transaction.
For the scale’s general network setup and supported commands, use the industrial scale API integration guide. The HTTPS-gateway alternative is covered after the main walkthrough.
1. Connect the scale and the bridge computer
Start with the local connection between UpScale and the computer that will run the bridge. The computer must be able to reach the indicator’s IP address and configured HTTP API port. Establish this connection before adding NetSuite so that you can check each part of the integration separately.
The bridge can run on a PC, virtual machine or Raspberry Pi with access to the scale’s network. Give the indicator a consistent network address, then use that address and its configured API port in the weight URL. In the command below, replace <SCALE_IP> and <API_PORT> with those settings.
curl http://<SCALE_IP>:<API_PORT>/api/1.0/weight
This GET request asks UpScale for a weight reading. The response is JSON, a structured message containing named values such as weight, unit and tare. Receiving that response establishes the local read connection. It does not create a NetSuite record yet.
2. Choose when the bridge collects a reading
Choose the collection method around the weighing task. With GET, the bridge asks for a reading when the application needs it, or repeats that request on a timer. With JSON push, the scale initiates delivery to a receiver. Both methods supply JSON; the difference is who starts the exchange and when.
GET: your application requests a reading
Use GET when your software should decide the capture time. The bridge sends a request to UpScale’s weight endpoint, and the indicator returns the reading in its response. Repeating that request at a chosen interval is called polling.
Bridge → UpScale
GET /api/1.0/weight
UpScale → bridge
JSON response
Application example: shipping software requests the carton’s weight when the operator confirms that carton.
The local bridge example below uses this method.
JSON push: the scale delivers a reading
Use JSON push when the scale should deliver readings periodically or through PRINT. UpScale sends an HTTP POST containing the JSON to a receiver URL configured on the scale. That receiver runs on your bridge computer or server and must be reachable from UpScale.
UpScale → receiver
HTTP POST with JSON
Receiver URL
Your bridge’s address, port and path
Application example: an operator presses PRINT after weighing a container; the receiver processes that delivered reading.
Use the JSON-push setup instructions for the scale-side configuration.
After either collection method, the bridge performs the same next job: prepare the reading and send it to NetSuite. The bridge’s HTTPS POST to NetSuite is a separate connection from a JSON push sent by the scale. The polling example in this guide does not include a push-receiving handler. ScaleAPIMonitor demonstrates receiving scale pushes, but does not itself create NetSuite records.
3. Prepare the reading and the NetSuite record
Give each reading a consistent place in NetSuite before connecting the two programs. A custom Scale Reading record can hold the weight, unit and stability together with the scale’s identity and capture time. The bridge translates the indicator’s response into those application fields while keeping the original JSON for reference.
The scale response below is an example. Its field names are case-sensitive: Weight is different from weight, and Stable is different from stable. Read those source fields exactly before mapping them to the bridge’s application payload.
{
"Platform": 1,
"Unit": "lb",
"Weight": 128.4,
"Tare": 2.0,
"Gross": false,
"Stable": true
}
Weight is the numeric reading. Gross tells you which mode that reading represents; it is a true/false flag, not a second weight value. When Gross is true, gross weight is Weight and net weight is Weight − Tare. When it is false, net weight is Weight and gross weight is Weight + Tare.
For a stable-only workflow, accept the reading only when Stable is positively true. An omitted stability field means the status is unknown. The bridge adds the scale identifier and capture timestamp; those are application values rather than extra fields promised by the indicator response.
Create the custom record customrecord_scale_reading with the fields below. The code examples use their own field IDs, so the IDs in your deployed record and script must agree.
| NetSuite field | What the bridge stores |
|---|---|
| Scale identity | A text or list/record field containing the bridge-assigned device ID or friendly scale name. |
| Capture timestamp | A date/time field set by the bridge. Use a consistent time convention, such as UTC. |
| Gross weight | A decimal field calculated from Weight, Tare and the Gross mode flag. |
| Net weight | A decimal field calculated from the same reading and tare values. |
| Unit | A text field holding the reported unit, such as lb or kg. Convert units in the application if the NetSuite workflow requires a common unit. |
| Stable | A checkbox recording confirmed stability for the accepted reading. |
| Tare | A decimal field holding the tare amount in the reading’s unit. |
| Source JSON | A long-text field retaining the original response so that you can trace the stored values back to the scale data. |
If you manage several scales, an optional Scale Device record (customrecord_scale_device) can hold the name, device ID, location, capacity and last-seen time. The bridge identifies the source scale in each payload. These records can support saved searches, dashboards and links to transactions without changing the indicator’s response format.
4. Connect the bridge to NetSuite
With the scale connection and record fields established, create the NetSuite side of the exchange. The bridge needs a destination that accepts its mapped reading and saves it. In this example, that destination is a RESTlet: a NetSuite script reached through a web address, with NetSuite authentication applied to the request.
Deploy the receiving script in NetSuite, then configure the bridge with the RESTlet’s deployed URL and the authentication required by that deployment. The existing example refers to Token-Based Authentication (TBA); its authentication headers are intentionally left for the integration to supply. NetSuite’s SuiteScript code is shown first, followed by the local bridge that calls it.
NetSuite receiving script: save the mapped reading
This RESTlet checks that the bridge supplied a confirmed stable reading and numeric gross, net and tare values. It then creates the Scale Reading record and returns the saved record ID, or an error message. The lowercase payload names belong to the bridge-to-NetSuite contract; the bridge still reads UpScale’s source fields with their documented capitalization.
/**
* @NApiVersion 2.1
* @NScriptType Restlet
*/
define(['N/record','N/log'], (record, log) => {
const READING = 'customrecord_scale_reading';
return {
post: (data) => {
try {
if (data.stable !== true || !Number.isFinite(data.gross) ||
!Number.isFinite(data.net) || !Number.isFinite(data.tare)) {
throw new Error('Expected a normalized stable reading from the bridge');
}
const id = record.create({type: READING})
.setValue({fieldId:'custrecord_sr_scale', value: data.deviceId})
.setValue({fieldId:'custrecord_sr_timestamp', value: new Date(data.timestamp)})
.setValue({fieldId:'custrecord_sr_gross', value: data.gross})
.setValue({fieldId:'custrecord_sr_net', value: data.net ?? data.gross})
.setValue({fieldId:'custrecord_sr_unit', value: data.unit})
.setValue({fieldId:'custrecord_sr_stable', value: !!data.stable})
.setValue({fieldId:'custrecord_sr_tare', value: data.tare || 0})
.setValue({fieldId:'custrecord_sr_source_json', value: JSON.stringify(data.source ?? data)})
.save();
return { success: true, id };
} catch (e) {
log.error('Scale Reading POST failed', e);
return { success: false, message: e.message };
}
}
};
});
Local bridge example: collect with GET and send to NetSuite
The Node.js example below runs on the bridge computer. Every two seconds it requests a scale reading, applies the stability and gross/net mapping, and sends the resulting application payload to the RESTlet over HTTPS. It adds the device ID and timestamp and retains the raw scale response in source.
Install Node.js on that computer, then set the scale URL, device ID, NetSuite URL and authentication headers for your deployment. If you choose JSON push instead, the receiving handler takes the place of the GET polling function. It then applies the same mapping and NetSuite-delivery logic to the JSON it receives.
// Polls the scale and POSTs to a NetSuite RESTlet
const http = require('http');
const https = require('https');
const SCALE_URL = 'http://<SCALE_IP>:<API_PORT>/api/1.0/weight';
const DEVICE_ID = 'SCALE-01'; // Application-assigned identifier.
const NETSUITE_URL = 'https://<ACCOUNT>.restlets.api.netsuite.com/app/site/hosting/restlet.nl?script=<ID>&deploy=1';
const HEADERS = {
'Content-Type': 'application/json',
// Add TBA/OAuth1 auth headers here
};
function getScaleWeight() {
return new Promise((resolve, reject) => {
http.get(SCALE_URL, res => {
let data = '';
res.on('data', c => data += c);
res.on('end', () => {
try { resolve(JSON.parse(data)); } catch (e) { reject(e); }
});
}).on('error', reject);
});
}
function postToNetSuite(payload) {
return new Promise((resolve, reject) => {
const body = JSON.stringify(payload);
const req = https.request(NETSUITE_URL, { method: 'POST', headers: { ...HEADERS, 'Content-Length': Buffer.byteLength(body) }}, res => {
let data = '';
res.on('data', d => data += d);
res.on('end', () => resolve({statusCode: res.statusCode, body: data}));
});
req.on('error', reject);
req.write(body); req.end();
});
}
function normalizeScaleReading(reading, deviceId, timestamp = new Date().toISOString()) {
if (reading.Stable !== true) return null;
if (!Number.isFinite(reading.Weight) || !Number.isFinite(reading.Tare) ||
typeof reading.Gross !== 'boolean' || typeof reading.Unit !== 'string' || !reading.Unit.trim()) {
throw new Error('Expected Weight, Tare, Unit and Gross in the documented scale response');
}
return {
deviceId,
timestamp,
gross: reading.Gross ? reading.Weight : reading.Weight + reading.Tare,
net: reading.Gross ? reading.Weight - reading.Tare : reading.Weight,
unit: reading.Unit,
stable: true,
tare: reading.Tare,
source: reading
};
}
let pollInProgress = false;
setInterval(async () => {
if (pollInProgress) return;
pollInProgress = true;
try {
const reading = await getScaleWeight();
const payload = normalizeScaleReading(reading, DEVICE_ID);
if (!payload) return; // Stable must be positively true.
const resp = await postToNetSuite(payload);
if (resp.statusCode < 200 || resp.statusCode >= 300) {
throw new Error('NetSuite HTTP ' + resp.statusCode);
}
const result = JSON.parse(resp.body);
if (result.success !== true) throw new Error(result.message || 'NetSuite record was not saved');
} catch (e) {
console.error('Bridge error', e.message);
} finally {
pollInProgress = false;
}
}, 2000);
5. Verify the complete weighing workflow
Test the complete path with a known weighing task before relying on the stored records. Place a test weight on the scale, collect a reading using your chosen method, and inspect the resulting Scale Reading record in NetSuite. Check the values and capture timing as well as whether a record was created.
Compare the stored unit, tare, gross and net values with the scale’s display mode. Check that an unstable reading is not saved by the stable-only example. If your workflow uses PRINT-triggered JSON delivery, verify that the receiver processes that delivered reading before sending the mapped record to NetSuite.
The two-second interval in the polling example is an application choice, not a stated maximum rate for the indicator. Decide what should create a new business record. For example, you might add a rule that posts only after the weight changes by at least 0.05 lb. That threshold is an application example; the minimal polling code does not implement it.
Run the bridge under a service manager so that it can operate without an open terminal, and retain logs for diagnosis. Keep tokens in the operating system’s secret store rather than embedding production credentials in code. Keep the scale on the private network and use the bridge’s outbound HTTPS connection to NetSuite. Add the monitoring and retry/backoff handling needed for the service you deploy.
A heartbeat alert can notify you when no readings arrive for a chosen period. A debounce or change-threshold rule can also reduce repeated records. These are application responsibilities; they do not change the scale’s weight reading.
| What you observe | What to check |
|---|---|
| The bridge cannot reach the scale | Check the indicator’s IP address, configured API port and local network or firewall rules. Start with the GET test from step 1 to isolate the scale connection. |
| A reading has missing or unexpected values | Log the original response and check the exact field names before reviewing the mapped payload. Keep the original JSON with the record for comparison. |
| NetSuite rejects the request | Check the RESTlet URL, authentication credentials and role permissions. This is a separate connection from the scale’s local HTTP interface. |
| The workflow receives unstable readings | Keep the positive Stable === true requirement for stable-only records, and review when the application requests or accepts a reading. |
| The scale goes offline | Use the bridge’s error logs and no-reading alert to identify the interruption. Verify the local connection before diagnosing the NetSuite destination. |
Advanced alternative: let NetSuite request data through an HTTPS gateway
A separately configured HTTPS gateway provides another route when NetSuite needs to initiate the request. The gateway reaches the scale on its local network and supplies an HTTPS endpoint that NetSuite can call. This changes where the integration runs; it does not mean that the indicator itself hosts an HTTPS service.
In this route, a NetSuite Scheduled Script calls the gateway, reads the returned scale JSON and creates the Scale Reading record. The gateway must be reachable by NetSuite, have the required authentication and network access, and present a trusted certificate. It is separate from the local bridge example above.
The existing SuiteScript example uses NetSuite’s N/https module, which requires HTTPS, TLS 1.2 and a trusted certificate chain. The gateway URL in the code is an example endpoint configured separately from the indicator.
/**
* @NApiVersion 2.1
* @NScriptType ScheduledScript
*/
define(['N/https','N/record','N/log'], (https, record, log) => {
// Example HTTPS gateway, configured separately from the indicator.
// It returns the indicator's case-sensitive JSON response.
const GATEWAY_URL = 'https://gateway.example.com/scale/weight';
const DEVICE_ID = 'SCALE-01';
const READING = 'customrecord_scale_reading';
function normalizeScaleReading(reading, deviceId, timestamp = new Date().toISOString()) {
if (reading.Stable !== true) return null;
if (!Number.isFinite(reading.Weight) || !Number.isFinite(reading.Tare) ||
typeof reading.Gross !== 'boolean' || typeof reading.Unit !== 'string' || !reading.Unit.trim()) {
throw new Error('Expected Weight, Tare, Unit and Gross in the documented scale response');
}
return {
deviceId,
timestamp,
gross: reading.Gross ? reading.Weight : reading.Weight + reading.Tare,
net: reading.Gross ? reading.Weight - reading.Tare : reading.Weight,
unit: reading.Unit,
stable: true,
tare: reading.Tare,
source: reading
};
}
return {
execute: () => {
try {
const resp = https.get({url: GATEWAY_URL /* Add gateway authentication headers. */});
if (Number(resp.code) < 200 || Number(resp.code) >= 300) {
throw new Error('Gateway HTTP ' + resp.code);
}
const reading = JSON.parse(resp.body);
const data = normalizeScaleReading(reading, DEVICE_ID);
if (!data) return;
record.create({type: READING})
.setValue({fieldId:'custrecord_sr_scale', value:data.deviceId})
.setValue({fieldId:'custrecord_sr_timestamp', value:new Date(data.timestamp)})
.setValue({fieldId:'custrecord_sr_gross', value:data.gross})
.setValue({fieldId:'custrecord_sr_net', value:data.net})
.setValue({fieldId:'custrecord_sr_unit', value:data.unit})
.setValue({fieldId:'custrecord_sr_stable', value:data.stable})
.setValue({fieldId:'custrecord_sr_tare', value:data.tare})
.setValue({fieldId:'custrecord_sr_source_json', value:resp.body})
.save();
} catch (e) { log.error('Scale pull failed', e); }
}
};
});
Other ways to test a GET reading
The following commands provide alternatives for checking the scale’s read connection from a workstation. Each one requests the same weight endpoint and displays the returned JSON. They are connection tests rather than complete NetSuite integrations; the bridge and receiving script handle the mapping, authentication and record creation described in the walkthrough.
cURL
curl -s http://<SCALE_IP>:<API_PORT>/api/1.0/weight
PowerShell
Invoke-RestMethod -Method GET -Uri "http://<SCALE_IP>:<API_PORT>/api/1.0/weight"
Python
import requests
r = requests.get("http://<SCALE_IP>:<API_PORT>/api/1.0/weight", timeout=3)
print(r.json())
Frequently Asked Questions
Can the Arlyn UpScale touchscreen indicator send weight data directly to NetSuite?
Use a bridge or integration service to receive or request UpScale readings and write them into NetSuite with NetSuite authentication. The scale’s JSON push delivers data to a receiver; it does not by itself implement an authenticated NetSuite integration.
What types of NetSuite transactions can use scale data?
Scale readings can be linked to common NetSuite processes such as inventory receipts, work order completions, quality control checks, and shipping/packing transactions. By creating a custom “Scale Reading” record, you can map the captured values directly to the fields you need.
Do I need to expose my scale to the public internet?
No. The preferred method is to keep the scale on a private LAN and use a lightweight bridge service to securely push data to NetSuite. This avoids the risks and complexity of opening inbound access to plant-floor devices.
Can I integrate multiple scales at once?
Yes. The bridge service can poll a list of IP addresses and post readings from each scale, including the device ID in every payload. This lets you capture data from multiple locations or production lines into a single NetSuite account.
How often should the scale be polled?
The code example polls every 2 seconds. Choose an interval that suits your recordkeeping workflow and application load, and use stable-reading or change-threshold rules to control when records are created. This is an application setting, not a stated maximum rate for the indicator.
What units of measurement are supported?
The API returns the unit of measurement (such as pounds, kilograms, grams, or ounces) along with the weight. NetSuite can store the raw value, or you can normalize units before sending data if you need a standardized record.
Can I use a cloud iPaaS platform instead of a bridge?
Yes. If your organization already uses middleware such as Celigo, Boomi, MuleSoft, Make, or n8n, you can replicate the bridge pattern within those tools. This is useful if you prefer centralized management of all integrations.
What happens if the scale goes offline?
If the scale is unreachable, the bridge will fail to poll and log an error. You can configure monitoring or alerts to notify you if no readings are received in a given timeframe, ensuring quick troubleshooting.
Discuss Your NetSuite Scale Integration
Capture scale readings for inventory receipts, work orders, quality checks or shipping. Connect an UpScale-equipped scale to your NetSuite workflow through Ethernet or Wi-Fi with Web API. Contact our team for scale selection, communication options and pricing, or use the form below to discuss your integration.
Contact Arlyn Scales Compare Scale Communication Options Call 800-645-4301
