Examples
This page will provide the most common use cases and examples of how to achieve them via API. New examples are constantly being added.
Example 1 - Most Common Operation of Cargo Spectre Devices
The most common way to trigger a Cargo Spectre Dimensioner is by requesting the Dimension
and Snapshot
commands one after the other. Below is an example of how to achieve this and what the resulting response looks like.
Request Dimension & Snapshot
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/>
<Snapshot/>
</Requests>
{
"Requests":{
"Dimension":{},
"Snapshot":{}
}
}
Response from Dimension & Snapshot
- XML
- JSON
<Responses>
<Dimension code="0"/>
<Info>
<Dimensions>
<Length>59.5</Length>
<Width>45.0</Width>
<Height>25.5</Height>
<Volume>39.5117</Volume>
<Density>39.5117</Density>
<Weight>
<Net>0</Net>
<Gross/>
<Tare>0</Tare>
</Weight>
<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>
<Snapshot code="0">
<Directory>
<Misc>
<Path>Jul-6_21-25-32_2018/Freight-Report.pdf</Path>
</Misc>
<Clouds>
<Path>Jul-6_21-25-32_2018/005337361647-raw.pcd</Path>
<Path>Jul-6_21-25-32_2018/combined-raw.pcd</Path>
<Path>Jul-6_21-25-32_2018/005302461647-raw.pcd</Path>
<Path>Jul-6_21-25-32_2018/box.pcd</Path>
</Clouds>
<Images>
<Path>Jul-6_21-25-32_2018/color-image1.png</Path>
<Path>Jul-6_21-25-32_2018/color-image1-marked.png</Path>
<Path>Jul-6_21-25-32_2018/color-image0.png</Path>
<Path>Jul-6_21-25-32_2018/color-image0-marked.png</Path>
<Path>Jul-6_21-25-32_2018/Image-from-webcam.png</Path>
</Images>
<Xmls>
<Path>Jul-6_21-25-32_2018/info.xml</Path>
</Xmls>
</Directory>
</Snapshot>
</Responses>
{
"Responses": {
"Dimension": {
"code": "0",
"Info": {
"Dimensions": {
"Barcode": "",
"Height": 25.5,
"Length": 59.0,
"Volume": 38.7444,
"Weight": {
"Gross": null,
"Net": 0,
"Tare": 0
},
"Width": 44.5,
"Density": 0
},
"Scanner": {
"Mode": "CARGO",
"Certified": "16-040A1"
},
"Units": {
"Length": "inches",
"Volume": "cubic feet",
"Weight": "lb",
"Density": "lb/cubic feet"
}
}
},
"Snapshot": {
"code": "0",
"Directory": {
"Clouds": {
"Path": [
"Apr-27_07-41-33_2022/box.pcd",
"Apr-27_07-41-33_2022/combined-raw.pcd"
]
},
"Images": {
"Path": [
"Apr-27_07-41-33_2022/barcode.jpg",
"Apr-27_07-41-33_2022/Kinect4a-1-marked.jpg",
"Apr-27_07-41-33_2022/Kinect4a-0-marked.jpg",
"Apr-27_07-41-33_2022/Kinect4a-2-marked.jpg",
"Apr-27_07-41-33_2022/Kinect4a-2.jpg",
"Apr-27_07-41-33_2022/Kinect4a-0.jpg",
"Apr-27_07-41-33_2022/Kinect4a-1.jpg"
]
},
"Misc": {
"Path": "Apr-27_07-41-33_2022/Freight-Label.pdf"
},
"Xmls": {
"Path": "Apr-27_07-41-33_2022/info.xml"
}
}
}
}
}
Request Dimension with Barcode & Snapshot
Request a dimension from a machine with local IP address 10.1.1.2
set to port 7100
. Send it a known barcode number that is a unique identifier for the freight in question.
- 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>
<Barcode>12345</Barcode>
</Dimension>
<Snapshot/>
</Requests>
{
"Requests":{
"Dimension":{
"Barcode":"12345"
},
"Snapshot":{}
}
}
Response from Dimension with Barcode & Snapshot
- 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/>
<Tare>0</Tare>
</Weight>
<Barcode>12345</Barcode>
<Density>0</Density>
</Dimensions>
<Units>
<Length>inches</Length>
<Volume>cubic feet</Volume>
<Weight>lb</Weight>
<Density>lb/cubic feet</Density>
</Units>
<Scanner>
<Mode>CARGO</Mode>
<Certified>null</Certified>
</Scanner>
</Info>
</Dimension>
<Snapshot code="0">
<Directory>
<Misc>
<Path>Jul-6_21-25-32_2018/Freight-Report.pdf</Path>
</Misc>
<Clouds>
<Path>Jul-6_21-25-32_2018/005337361647-raw.pcd</Path>
<Path>Jul-6_21-25-32_2018/combined-raw.pcd</Path>
<Path>Jul-6_21-25-32_2018/005302461647-raw.pcd</Path>
<Path>Jul-6_21-25-32_2018/box.pcd</Path>
</Clouds>
<Images>
<Path>Jul-6_21-25-32_2018/color-image1.png</Path>
<Path>Jul-6_21-25-32_2018/color-image1-marked.png</Path>
<Path>Jul-6_21-25-32_2018/color-image0.png</Path>
<Path>Jul-6_21-25-32_2018/color-image0-marked.png</Path>
<Path>Jul-6_21-25-32_2018/Image-from-webcam.png</Path>
</Images>
<Xmls>
<Path>Jul-6_21-25-32_2018/info.xml</Path>
</Xmls>
</Directory>
</Snapshot>
</Responses>
{
"Responses": {
"Dimension": {
"code": "0",
"Info": {
"Dimensions": {
"Barcode": "12345",
"Height": 25.5,
"Length": 59.0,
"Volume": 38.7444,
"Weight": {
"Gross": null,
"Net": 0,
"Tare": 0
},
"Width": 44.5,
"Density": 0
},
"Scanner": {
"Mode": "CARGO",
"Certified": "null"
},
"Units": {
"Length": "inches",
"Volume": "cubic feet",
"Weight": "lb",
"Density": "lb/cubic feet"
}
}
},
"Snapshot": {
"code": "0",
"Directory": {
"Clouds": {
"Path": [
"Apr-27_07-41-33_2022/box.pcd",
"Apr-27_07-41-33_2022/combined-raw.pcd"
]
},
"Images": {
"Path": [
"Apr-27_07-41-33_2022/barcode.jpg",
"Apr-27_07-41-33_2022/Kinect4a-1-marked.jpg",
"Apr-27_07-41-33_2022/Kinect4a-0-marked.jpg",
"Apr-27_07-41-33_2022/Kinect4a-2-marked.jpg",
"Apr-27_07-41-33_2022/Kinect4a-2.jpg",
"Apr-27_07-41-33_2022/Kinect4a-0.jpg",
"Apr-27_07-41-33_2022/Kinect4a-1.jpg"
]
},
"Misc": {
"Path": "Apr-27_07-41-33_2022/Freight-Label.pdf"
},
"Xmls": {
"Path": "Apr-27_07-41-33_2022/info.xml"
}
}
}
}
}