Command a Dim
The general usecase for commanding a dim involves sending a dimensioning command, usually with a barcode from a barcode reader or a WMS app as well. This can be done in multiple ways.
Note that the data in a barcode field does not need to be an actual barcode. It is simply treated as a unique identifier that can be used to associate dimension data (and pictures) to the freight in question. For instance, if using the Spectre Cloud, you can easily search by whatever data you sent in the barcode field.
These commands do not save data
Sending a Dimension
command does NOT save the dim data to the computer's storage, nor does it save pictures, generate freight reports, etc. This command ONLY returns the dimensions and weight.
Pair a Dimension
command with a Snapshot
command after it to dimension, save data, and get the resulting filepaths. See here for an example.
Divided responsibilities
These commands were split up to allow for error checking on behalf of operators if desired. An operator could trigger a dim, ensure that the freight was properly positioned, and then send a command to save data once they are comfortable with the results. However, in Getting Started you can find how to combine multiple commands into one request. This will allow you to streamline the operation of your Spectre into one button-press by the operator.
<Dimension>
Request
Request a dimension from a machine with local IP address 10.1.1.2
set to port 7100
.
- GET
- POST
Endpoint
Header
- XML
- JSON
Desired response format:
Accept: application/xml
(DEFAULT)Desired response format:
Accept: application/json
Endpoint
A Cargo Spectre POST request is sent to the machine without any API in the endpoint, as below:
Header
- XML
- JSON
Desired response format:
Accept: application/xml
(DEFAULT)Desired response format:
Accept: application/json
Body
- XML
- JSON
<Requests>
<Dimension/>
</Requests>
{
"Requests":{
"Dimension":{}
}
}
Response
The response will return a code of 0 to mean that the request completed without errors. The major nodes of Request/Dimension/Info are:
- Dimensions: The dimension data, with volume included, as well as net, gross, and tare weight (as well as optional barcode)
- Units: Distance, volume, and weight units for each dimension
- Scanner: Information on scanner configuration
Version 3.4.115 breaking changes
XML and JSON data from the dimensioner API will have empty or null values for weight data that was not supplied by the scale. The examples have been changed to reflect that.
- XML
- JSON
<Responses>
<Dimension code="0"/>
<Info>
<Dimensions>
<Length>59.5</Length>
<Width>45.0</Width>
<Height>25.5</Height>
<Volume>39.5117</Volume>
<Weight>
<Net>0</Net>
<Gross>0</Gross>
<Tare/>
</Weight>
<Density>0</Density>
<Barcode/>
</Dimensions>
<Units>
<Length>inches</Length>
<Volume>cubic feet</Volume>
<Weight>lb</Weight>
<Density>lb/cubic feet</Density>
</Units>
<Scanner>
<Mode>CARGO</Mode>
<Certified>16-040A1</Certified>
</Scanner>
</Info>
</Dimension>
</Responses>
{
"Responses": {
"Dimension": {
"code": "0",
"Info": {
"Dimensions": {
"Barcode": "",
"Length": 59.0,
"Width": 44.5,
"Height": 25.5,
"Volume": 38.7444,
"Weight": {
"Gross": 0, // note as of version 3.4.115, will be null if not supplied by scale
"Net": 0, // note as of version 3.4.115, will be null if not supplied by scale
"Tare": null // note as of version 3.4.115, will be null if not supplied by scale
},
"Density": 0
},
"Scanner": {
"Mode": "CARGO",
"Certified": "16-040A1" //can be "null" as well
},
"Units": {
"Length": "inches",
"Volume": "cubic feet",
"Weight": "lb",
"Density": "lb/cubic feet"
}
}
}
}
}
Request with Barcode Parameter
Endpoint
Request a dimension from a machine with local IP address 10.1.1.2
set to port 7100
. A barcode of "12345" is sent along with the request.
- GET
- POST
Header
- XML
- JSON
Desired response format:
Accept: application/xml
(DEFAULT)Desired response format:
Accept: application/json
A Cargo Spectre POST request is sent to the machine without any API in the endpoint, as below:
Header
- XML
- JSON
Desired response format:
Accept: application/xml
(DEFAULT)Desired response format:
Accept: application/json
Body
- XML
- JSON
<Requests>
<Dimension>
<Barcode>12345</Barcode>
</Dimension>
</Requests>
Barcode is a string
Barcode should always be set to a string literal, e.g. "12345"
and not 12345
to avoid unwanted behavior.
{
"Requests":{
"Dimension":{
"Barcode":"12345"
}
}
}
Response with Barcode Parameter
The response will return a code of 0 to mean that the request completed without errors. The major nodes of Request/Dimension/Info are:
- Dimensions: The dimension data, with volume included, as well as net, gross, and tare weight (as well as optional barcode)
- Units: Distance, volume, and weight units for each dimension
- Scanner: Information on scanner configuration
Version 3.4.115 breaking changes
XML and JSON data from the dimensioner API will have empty or null values for weight data that was not supplied by the scale. The examples have been changed to reflect that.
- XML
- JSON
<Responses>
<Dimension code="0">
<Info>
<Dimensions>
<Length>59.0</Length>
<Width>44.5</Width>
<Height>25.5</Height>
<Volume>38.7444</Volume>
<Weight>
<Net>0</Net>
<Gross>0</Gross>
<Tare/>
</Weight>
<Density>0</Density>
<Barcode>12345</Barcode>
</Dimensions>
<Units>
<Length>inches</Length>
<Volume>cubic feet</Volume>
<Weight>lb</Weight>
<Density>lb/cubic feet</Density>
</Units>
<Scanner>
<Mode>CARGO</Mode>
<Certified>16-040A1</Certified>
</Scanner>
</Info>
</Dimension>
</Responses>
{
"Responses": {
"Dimension": {
"code": "0",
"Info": {
"Dimensions": {
"Barcode": "12345",
"Length": 59.0,
"Width": 44.4,
"Height": 25.5,
"Volume": 38.7444,
"Weight": {
"Gross": 0,
"Net": 0,
"Tare": null
},
"Density": 0
},
"Scanner": {
"Mode": "CARGO",
"Certified": "16-040A1"
},
"Units": {
"Length": "inches",
"Volume": "cubic feet",
"Weight": "lb",
"Density": "lb/cubic feet"
}
}
}
}
}
<SetBarcode>
Occasionally, a user may desire to set the barcode independently of all other operations. For the sake of completeness then, we have provided a separate API command to set the barcode without automatically triggering a scan. This command can, of course, still be sent in the same request as a Dimension command to achieve the same effect.
Barcode is a string
Barcode should always be set to a string literal, e.g. "12345"
and not 12345
to avoid unwanted behavior.
Optional parameter name
SetBarcode
takes a parameter called Value
, not Barcode
. This is in contrast to Dimension
which takes optional parameter Barcode
Request
Endpoint
Request to set the barcode for the next scan to a machine with local IP address 10.1.1.2
set to port 7100
.
- GET
- POST
Header
- XML
- JSON
Desired response format:
Accept: application/xml
(DEFAULT)Desired response format:
Accept: application/json
A Cargo Spectre POST request is sent to the machine without any API in the endpoint, as below:
Header
- XML
- JSON
Desired response format:
Accept: application/xml
(DEFAULT)Desired response format:
Accept: application/json
Body
- XML
- JSON
<Requests>
<SetBarcode>
<Value>12345</Value>
</SetBarcode>
</Requests>
{
"Requests":{
"SetBarcode":{
"Value":"12345"
}
}
}
Response
The response will return a code of 0 to mean that the request completed without errors. No other data is returned.
- XML
- JSON
<Responses>
<SetBarcode code="0"/>
</Responses>
{
"Responses": {
"SetBarcode": {
"code": "0"
}
}
}