Skip to main content

Searching For, and Exporting, Cargo Data

The Search Request API will return a cargoID, barcode, and scanDate based on an inputted search parameter. The search parameter can be a barcode, a date from, a date to, a machine name, or any combination of them.

Cargo Spectre date format

Dates must be specified in ISO 8601 format (yyyy-mm-ddT00:00:00) with at least a date (but optionally a time as well), e.g. February 1, 2022 at 2PM (1400) would be 2022-02-01T14:00:00.

Cargo sort

Results are returned from newest to oldest. Older cargo will have a CargoId of type int that is smaller than newer cargo. For example, for CargoId 100 vs 99, 100 will be the newer one and will be returned first.

HTTPS required

The cloud server is separate from Spectre Dimensioner API calls and uses a different endpoint. Please note that for security, the endpoint MUST be HTTPS and not HTTP.

<Api/Cargo/Search>

Request

The search API returns at most 60 items per response to keep server load manageable. For that reason, the API can accept a "last ID received" parameter LastCargoID to return unique results on the next request. This parameter should be the oldest (smallest) cargoID received from the last search response. One can keep querying the server for this information until the server returns a null in the search results (or, equivalently, an error of "End of results list").

Endpoint

POST https://spectre-licensing.com/api/cargo/search

Body

{
"email": "fake@company.com",
"password": "FakePassword123!",
"barcode": "12341234",
"dateFrom": "2022-03-01",
"dateTo": "2023-01-01T03:23:10"
"machineName": "TestMachine"
}

Response with Results Returned

{
"searchResults": [
{
"barcode": "12341234",
"cargoID": 11111,
"scanDate": "yyyy-mm-ddT12:00:00",
},
{
"barcode": "12345",
"cargoID": 11110,
"scanDate": "yyyy-mm-ddT00:00:00",
}
],
"error": null
}

Response with No Results

Compare the below response example to the above, with two returned results where the oldest (smallest) cargoID was 11110, to the response shown below. If 11110 is the last ID that meets the search constraints, and a subsequent search with "lastCargoID":"11110" is performed, a result of "null" and "End of results list" will be received. If there are older cargo items than 11110, they will be returned instead, again up to a count of 60. The process can then be repeated with the new lastCargoID received.

{
"searchResults": null,
"error": "End of results list"
}

<Api/Cargo/Export>

The Export Cargo API will return the entire set of data about a piece of cargo. A cargo can only be retrieved by knowing its cargoID (as returned in the search API).

Request

Endpoint

POST https://spectre-licensing.com/api/cargo/export

Body

{
"email": "fake@company.com",
"password": "FakePassword123!",
"cargoID": "11110"
}

Response

The response will have the same format as data returned by performing a Dimension+Snapshot command via the Spectre Dimensioner API. However, it will also have Custom Fields associated with the cargo's Cloud data.

Retrieving files

Pictures, PDFs, and other files associated with the cargo record can be retrieved by sending a GET to https://cargospectre.blob.core.windows.net/scans/ as in the response comments below.

{
"responses": {
"dimension": {
"code": 0, // Number - Anything besides 0 indicates an error has occurred
"info": {
"cargoID": 43286, // Number - Internal Cargo Spectre ID
"name": "", // String - Optional cargo name
"barcode": "FAKEBARCODE123", // String
"comments": "Comments are optional and can be left blank. This is what we will use for Estes PRO", // String
"scanDate": "2018-11-16T03:49:18", // String - UTC time in ISO format
"machineName": "Laptop", // String - Human readable name of the Spectre machine that authored the data
"scanGuid": "3a75b02a-9300-4ba4-a117-87869dc14e9a", // String - This may be used in future sharing scenarios
"dimensions": {
"length": 0.81, // Number
"width": 0.54, // Number
"height": 0.55, // Number
"volume": 0.247132, // Number
"weight": {
"net": 75.5, // Number
"gross": 76.5, // Number
"tare": 1.5 // Number
}
},
"units": {
"length": "meters", // String - Applies to Length, Width, and Height
"volume": "cubic meters", // String - Applies to Volume
"weight": "lb" // String - Applies to Net, Gross, and Tare
},
"customFields": { // Optional custom fields that your organization can configure will show up here
"Is Damaged": true,
"Piece Count": 3,
"Destination": "LAX",
}
}
},
"snapshot": {
"code": 0, // Number - Anything besides 0 indicates an error has occurred
"directory": { // All path values are relative to: https://cargospectre.blob.core.windows.net/scans/
"clouds": {
"path": [ // Array of strings - Point cloud 3D models of the scene
"fake@shipper.com\\f2222139-ca9a-4c4a-8f44-e144455f0721\\combined-raw.pcd",
"fake@shipper.com\\f2222139-ca9a-4c4a-8f44-e144455f0721\\box.pcd"
]
},
"images":{
"path": [ // Array of strings - Images of the cargo
"fake@shipper.com\\f2222139-ca9a-4c4a-8f44-e144455f0721\\cameraName-0.jpg",
"fake@shipper.com\\f2222139-ca9a-4c4a-8f44-e144455f0721\\cameraName-0-marked.jpg",
"fake@shipper.com\\f2222139-ca9a-4c4a-8f44-e144455f0721\\cameraName-1.jpg",
"fake@shipper.com\\f2222139-ca9a-4c4a-8f44-e144455f0721\\cameraName-1-marked.jpg"
]
},
"thumbnails": {
"path": [ // Array of strings - Same as the images above just smaller (for faster loading if needed)
"fake@shipper.com\\f2222139-ca9a-4c4a-8f44-e144455f0721\\thumbnail\\cameraName-0.jpg",
"fake@shipper.com\\f2222139-ca9a-4c4a-8f44-e144455f0721\\thumbnail\\cameraName-0-marked.jpg",
"fake@shipper.com\\f2222139-ca9a-4c4a-8f44-e144455f0721\\thumbnail\\cameraName-1.jpg",
"fake@shipper.com\\f2222139-ca9a-4c4a-8f44-e144455f0721\\thumbnail\\cameraName-1-marked.jpg"
]
},
"misc": {
"path": [ // Array of strings - Freight reports or other cargo documents
"fake@shipper.com\\f2222139-ca9a-4c4a-8f44-e144455f0721\\Freight-Report.pdf"
]
}
}
}
}
}

Receiving Exports

Cargo Spectre users can export cargo data from the cloud using the Cloud API or the Export feature on the website itself. There are three ways to export cargo data:

  • As cargo is scanned (from the remote control page)
  • From the cargo details page
  • From the cargo export API in the previous section

In order to export from the cloud website via the user interface, you will need to provide a URL endpoint that accepts HTTP POST requests. Cargo Spectre users have the ability to set a different URL for each Cargo Spectre device, so you may want to have a few different URL paths. For example:

EXPORTED FROMURL
Customer 1, Machine Ahttps://my-company-name.com/customer-1/machine-A
Customer 1, Machine Bhttps://my-company-name.com/customer-1/machine-B
Customer 2, Machine Ahttps://my-company-name.com/customer-2/machine-A

The exported data will take the JSON form by default, as shown here, although there are other export formats available to users as well.