Leap JSON Response v1.0

Status

This page represents version 1.0 of the Leap JSON Response specification. New versions of Leap JSON will always be backward compatible; using a never remove, only add strategy.

To request changes to the specification or report an error please contact support.

Response Format

This section describes the structure of a Leap JSON Response document, which is identified by the media-type: application/vnd.leap+json. Leap JSON documents are defined in JavaScript Object Notation (JSON). Conventions related to this document and definitions of client/server responsibilities related to Leap JSON are discussed in the Leap JSON introduction document.

Unless otherwise noted, objects defined by this specification should not contain any additional members. Client and server implementations must ignore members not recognized by this specification.

Top-level Reserved Property Names

A document MAY include the following attributes:

NameTypeExtra
apiVersionStringRepresents the desired version of the service API in a request, and the version of the service API that’s served in the response. apiVersion SHOULD always be present.
contextStringEcho-back data, set by the client and returned by the server.  Used for asynchronous and batch situations. Optional, and only present if sent in the request.
idStringA server supplied identifier for the response, regardless of whether it is successful or unsuccessful.  id is used to correlate to events and server logs. Optional.
langStringA server supplied identifier for the response, echoing back the language code indicated in the request. If sent, only the I18N information, where defined, for the language code specified shall be returned. Optional, and only present if sent in  the request.
dataObjectContainer object for data returned by the service in the case of a successful operation which, in turn, returns data.  This object contains many elements, itself, which are indicated later in this specification. *See note regarding mutual exclusivity below.
errorObjectContainer object for the error returned by the service in the case of an unsuccessful operation.  This object contains many elements, itself, which are indicated later in this specification.  *See note regarding mutual exclusivity below.
methodStringSpecifies the operation to perform, or that has been performed, on the data.
selfLinkStringA reference to a link which can be used to get more information about the details of this request and response. Optional.
* Mutual Exclusivity: the data and error object MUST NOT both exist within a single Response

data Object Reserved Property Names

NameTypeParentExtra
kindStringdataServes as a guide to what type of information this particular object stores. Kind MAY exist at the data object level, items object (see below), or any level where understanding the type of data in an object is important.  kind SHOULD BE the first property in an object, when used.
totalItemsNumberdataIndicates the range of the items array (below).
updatedStringdataIndicates the date/time (RFC 3339) the data was requested. This may, then, be used by the client to determine if data refresh is necessary.
metadataObjectdataOptional object array which describes the data contained in the items array. See metadata elements (below).
itemsArraydataAn array of an unspecified object. SHOULD be the last element in the data object.

High-Level Example of Response

{
  "id": "uniquerequestID",
  "apiVersion": "1.0",
  "context": "contextString",
  "selfLink": "/linkToResultsEventStore/uniquerequestID",
  "data": {
    "kind": "delivery",
    "updated": "2018-02-04T19:29:54.001Z",
    "totalItems": 1,
    "metadata": [
      {
        //metadata object (below) here
      }
    ],
    "items": [
      {
        //item object (below) here
      }
    ]
}

metadata Array Object Property Names

NameTypeParentExtra
kindStringmetadataThe kind of data item being described. name SHOULD match an element in the associated item object.
typeStringmetadataThe data type associated with this element.
byteLengthIntegermetadataThe name of the data item being described. name SHOULD match an element in the associated item. 
i18nIDStringmetadataUnique, server-internal, internationalization identifier associated with name.
i18nLangTextArray<Object>metadataInternationalization text tag associated with name. 
langStringi18nLangTextISO 639 language code for internationalization.
textStringi18nLangTextInternationalized text.

metadata Array Example

"metadata": [
    {
      "kind": "WOrdNumber",
      "type": "string",
      "i18nID": "I18N_WORDER",
      "byteLenth": 20,
      "i18nLangText": [
        {
          "lang": "en",
          "text": "Work Order"
        },
        {
          "lang": "de",
          "text": "Arbeitsauftrag"
        }
      ]
    }
  ]

item Array Object Property Names

The item array, other than any properties listed below, is dependent on the application object definition and thus not part of this specification.  In other words, beyond any reserved properties indicated below, the definition of the items array is application-specific.  While the object described in the data.items array MAY contain any object or element consistent with the JSON standard, a flat structure is generally recommended.

Support for hierarchical objects, within JSON, is supported, but the use of the relationships array to define relationships, external to the items data has some advantages and potential performance benefits. 

"items": [
    {
      "deliveryId": "12312312",
      "carCod": "UPS",
      "shipmentDateTime": "2018-06-04T12:00:00.000Z",
      "clientId": "CLI1232",
      "customerNumber": "CST010322",
      "customerName": "My Mart",
      "addressLine1": "123 Main St",
      "addressLine2": "",
      "addressCity": "Winchester",
      "addressStProv": "TX",
      "addressPostalCode": "77345",
      "palletCount": 2
    }
  ]

Relationship Property Names within Items Objects

NameTypeParentExtra
relationshipsArray<Object>itemsIndication of relationships. Optional.
kindStringrelationshipsRelates the link to the item element with the same name.
typeStringrelationshipsSpecifies the type of link.  Enumeration of types, as of the time of this document’s create is:  [“self”, “collection”]
linkObjectrelationshipsContainer object for related reference
hrefStringlinkSpecifies the actual link url.  If related to the same base namespace, including feature group and feature, it may include the notation ~/ to indicate this.
descArray<Object>linkOptional array of language descriptions for tool tips or other use cases.
langStringdescISO 639 language code for internationalization. 
textStringdescInternationalized text.
"relationships": [
    {
      "kind": "delivery",
      "type": "self",
      "link": {
        "href": "~/delivery/12312312"
      }
    },
    {
      "kind": "carCod",
      "type": "self",
      "link": {
        "href": "~/carrierCodes/12312312"
      }
    },
    {
      "kind": "palletCount",
      "type": "collection",
      "link": {
        "href": "~/shippableInventory/12312312"
      }
    }
  ]

error Object Reserved Property Names

NameTypeParentExtra
errorCodeIntegererrorThe actual error code encountered.  While this property value MAY represent the HTTP response code, an actual application error SHOULD be returned here.
errorTextArray<Object>errorAn array of language-specific error text messages
langStringerrorTextISO 639 language code for internationalization. 
textStringerrorTextInternationalized text.
developerInformationObjecterrorAn object holding more detailed information regarding the error.
domainStringdeveloperInformationThe domain of the error.  Usually, Feature group/feature.
locationStringdeveloperInformationLocation of the error.  Usually, module, execution route or framework element.
developerMessageStringdeveloperInformationDetailed message aimed at aiding developers and support to identify the source of an issue.
vendorDetailsObjectdeveloperInformationObject holding any low-level, vendor specific information.
vendorIDStringvendorDetailsImplementation provider’s (vendor) Vendor ID.
vendorErrorCodeIntegervendorDetailsError code from the vendor implementation.
vendorErrorMessageStringvendorDetailsError message from the vendors implementation.

Success and Error Examples

{
  "id": "uniquerequestID",
  "apiVersion": "1.0",
  "context": "contextString",
  "selfLink": "/linkToResultsEventStore/uniquerequestID",
  "error": {
    "errorCode": 5443,
    "errorText": [
      {
        "lang": "en",
        "text": "Invalid Request - Invalid Shipment Identifier"
      }
    ]
  }
}
{
  "id": "uniquerequestID",
  "apiVersion": "1.0",
  "context": "contextString",
  "selfLink": "/linkToResultsEventStore/uniquerequestID",
  "error": {
    "errorCode": 400,
    "errorText": [
      {
        "lang": "en",
        "text": "Invalid Request - Shipping date incorrect for shipment"
      },
      {
        "lang": "de",
        "text": "Ungültige Lieferung - Das Versanddatum ist für den Versand nicht korrekt"
      }
    ],
    "developerInformation": {
      "domain": "facilityExecution/shipping",
      "location": "rateService",
      "developerMessage": "Shipdate should be greater than or equal to the facility's current date",
      "vendorDetails": {
          "vendorID": "wherewerks",
          "vendorErrorMessage": "Shipdate incorrect. ShipDate = 20180307 CurrentDate = 20180312",
          "vendorErrorCode": 1000027
      }
    }
  }
}
{
  "id": "uniquerequestID",
  "apiVersion": "1.0",
  "context": "contextString",
  "selfLink": "/linkToResultsEventStore/uniquerequestID",
  "data": {
    "kind": "delivery",
    "updated": "2018-02-04T19:29:54.001Z",
    "totalItems": 1,
    "metadata": [
      {
        "kind": "deliveryId",
        "type": "string",
        "i18nID": "I18N_DELIVERYID",
        "byteLenth": 20,
        "i18nLangText": [
          {
            "lang": "en",
            "text": "Delivery"
          }
        ]
      },
      {
        "kind": "carCod",
        "type": "string",
        "i18nID": "I18N_CARRIERCODE",
        "byteLenth": 10,
        "i18nLangText": [
          {
            "lang": "en",
            "text": "Carrier"
          }
        ]
      },
      {
        "kind": "shipmentDateTime",
        "type": "string",
        "i18nID": "I18N_SHIPDATE",
        "byteLenth": 30,
        "i18nLangText": [
          {
            "lang": "en",
            "text": "Carrier Pickup Date"
          }
        ]
      },
      {
        "kind": "palletCount",
        "type": "number",
        "i18nID": "I18N_SHIPPALLETCOUNT",
        "byteLenth": 10,
        "i18nLangText": [
          {
            "lang": "en",
            "text": "Number of Pallets"
          }
        ]
      }
    ],
    "items": [
      {
        "deliveryId": "12312312",
        "carCod": "UPS",
        "shipmentDateTime": "2018-06-04T12:00:00.000Z",
        "addressPostalCode": "77345",
        "palletCount": 2,
        "relationships": [
          {
            "kind": "delivery",
            "type": "self",
            "link": {
              "href": "~/delivery/12312312",
              "name": [
                {
                  "lang": "en"
                },
                {
                  "text": "Delivery"
                }
              ]
            }
          },
          {
            "kind": "carCod",
            "type": "self",
            "link": {
              "href": "~/carrierCodes/12312312",
              "name": [
                {
                  "lang": "en"
                },
                {
                  "text": "Carrier Selected"
                }
              ]
            }
          },
          {
            "kind": "palletCount",
            "type": "collection",
            "link": {
              "href": "~/shippableInventory/12312312",
              "name": [
                {
                  "lang": "en"
                },
                {
                  "text": "Shipment Inventory"
                }
              ]
            }
          }
        ]
      }
    ]
  }
}
Updated on December 29, 2020

Was this article helpful?

Related Articles