The PagedItemInventoryResult JSON object defines a page of ItemInventory JSON Object results in the DSCO system.

- Make sure you're familiar with JSON before continuing.
- The JSON objects are defined using Orderly.  Optional attrs end with a "?" all others are required.

- isodate fields use one of these ISO 8601 format: 2014-01-01T10:30:00.000+01:00, 2014-01-01T10:30:00.000+0100, 2014-01-01T10:30:00.000Z
- Dsco reserves the right to add new attributes at any time so Partners should ensure their validators won't break should this happen


If the API specified that the results be compressed then the base64EncodedCompressedItemInventory attribute will have the results which is a base64 encoded string of the GZip compressed itemInventory results.  So, first decode this base64 string into a byte array and then decompress it using the gzip algorithm.  The result will be an array of ItemInventory objects (see examples below on how to decode).

If the API did not ask for the results to be compressed then the itemInventory attribute will be present with the array of results.

Deprecation Warning

The following attributes are deprecated and will be removed in early 2019 (use scrollId instead)...

  • lastId
  • pageNum
  • pageSize
  • pageCount
    string scrollId?; # Version 3 attribute
                      # Use this value on subsequent API calls
                      # to get the next page of results
    string base64EncodedCompressedItemInventory?; # Compressed, base 64 encoded itemInventory results
    int lastId?;    # DEPRECATED.  Version 2 attribute
                    # If fastMode is true, use this on the next API
                    # call to get the next page of results
    int pageNum;    # DEPRECATED.  Version 2 attribute
                    # Page number of this page of Order results
                    # (only applies if fastMode is false)
    int pageSize;   # DEPRECATED. Version 2 attribute
                    # The max number of Orders per page of results
    int pageCount;  # DEPRECATED. Version 2 attribute
                    # The number of total pages in the results
                    # (only applies if fastMode is false)
    array{ref ItemInventory} itemInventory?; # Inventory in current page


    "scrollId": "j23jl2k3j2lkj42l;k43j2lk4j2lk4j2kl4j24lk2j",

Java Decode/Decompress Example

// The Base64 object below comes
// from the org.apache.commons.codec.binary package.
// The GZIPInputStream comes from package.
// The ItemInventory class defines the attributes documented in the JSON.
// The jsonMapper var is an instance of the Jackson library's JsonMapper
// The TypeReference class comes from the Jackson library

// Assume the base64EncodedCompressedItemInventory has been
// placed in this variable.
String encodedStr = null;

if (encodedStr != null) {                    
    byte[] decodedBytes = Base64.decodeBase64(encodedStr);
    ByteArrayInputStream bis = new ByteArrayInputStream(decodedBytes);
    GZIPInputStream gis = new GZIPInputStream(bis);
    BufferedReader br = new BufferedReader(new InputStreamReader(gis, "UTF-8"));
    StringBuilder sb = new StringBuilder();
    String line;
    while((line = br.readLine()) != null) {
    List<ItemInventory> list = jsonMapper.readValue(sb.toString(), 
                               new TypeReference<List<ItemInventory>>(){});                    

Node JS Decode/Decompress Example

// Using the zlib library to decompress gzipped data
const zlib = require('zlib');

// Assume that obj is AllItemInventoryResult JSON object
const str = obj.base64EncodedCompressedItemInventory;

if (str) {
    let buffer = new Buffer(str, 'base64');
    let decompressedData = [];
    let decompressor = zlib.createGunzip();
    decompressor.on('data', function(d) {
    decompressor.on('error', function(e) {
    decompressor.on('end', function() {
        let itemInventoryStr = decompressedData.join('');
        let itemInventoryJson = JSON.parse(itemInventoryStr);

Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.