You can use the Serialized Logistics V2 API to integrate the third-party systems with the Serialized Logistics application.


The Serialized Logistics V2 API uses the Representational State Transfer (REST) standard to interact with other systems.


The Serialized Logistics V2 API is an extension of the Serialized Logistics application of Movilitas.Cloud and enables you to send requests from external systems to the application.


This article describes how to get an Advanced Shipping Notification from Movilitas.Cloud by using the Serialized Logistics V2 API.


API Tool to Use


In this document, we provide examples by using the cURL command-line tool. To send the API request, you can find a lot of user-friendly REST API tools on the Internet, for example, Postman.


Before You Begin


Before you start sending any messages:


1. You must enable the Serialized Logistics application in the Admin UI.

2. You must create an API key and secret. 

3. You must create a shopfloor channel with Serialized Logistics V2 API source. You will need the channel key for your requests.

4. You must configure the Serialized Logistics application.

5. You must have the authentication token to send requests over API. Select one of the following ways:

  • Apply a dynamic token. Send an authentication request over the Authentication API. For more information about the Authentication API, open the Tenant Dashboard in Movilitas.Cloud, select API keys, and choose Authentication API Documentation. Also, see Authentication Request.
  • Apply a static token. Generate a static token for your previously created API key.


For more information, see Configuring the Movilitas.Cloud APIs.


Procedure


1. Use the GET method and the following URL:


https://api-acc.movilitas.cloud/v1/serialized_logistics/v2/api/suppliers/get_advanced_shipping_notification


2. Define the query params.


KeyRequired or Optional?TypeAction
supplier_tagOptionalStringProvide the supplier tag that identifies your supplier.


Note: Make sure that you have registered the supplier in the Serialized Logistics application --> Site management --> Suppliers tab and apply the value given in the Supplier tag field.

purchase_order_idOptional*StringProvide the purchase order ID.

The application can find the potential EPCIS file even if there is no exact match in terms of the given purchase order ID. The application picks up the number sequence inside the given ID and uses it as a real identifier (pattern) to find the potential EPCIS file. 
dispatch_advice_idOptional*StringProvide the despatch advice ID.

The application can find the potential EPCIS file even if there is no exact match in terms of the given despatch advice ID. The application picks up the number sequence inside the given ID and uses it as a real identifier (pattern) to find the potential EPCIS file.
include_aggregationsRequiredBooleanSpecify whether you want to include aggregations:
  • true - Include aggregations. The complete hierarchy is returned, excluding the containers (SSCCs).
  • false - Do not include aggregations.
only_non_received_epcisOptionalBooleanSpecify whether you want to get the Advanced Shipping Notification only for a non-received EPCIS file:
  • true - Return the Advanced Shipping Notification only for a non-received EPCIS file.
  • false (default) - Return the Advanced Shipping Notification for any EPCIS file.

*Either purchase_order_id or dispatch_advice_id is required. If one of them is provided, the other field is optional.


3. For the header, define the authentication token and the channel key. The token can be given in one of the following ways:

  • As x-access-token header.
  • As Authorization header by using the Bearer schema.


Header Option 1:


KeyAction
x-access-tokenProvide the authentication token.
x-channel-keyProvide the channel key of your Serialized Logistics V2 API channel.


Header Option 2:


KeyAction
AuthorizationProvide the authentication token as Bearer <token>.
x-channel-keyProvide the channel key of your Serialized Logistics V2 API channel.


4. Leave the body of the request empty.


5. Send the request. 


Sample cURL Request  


curl -X GET \
https://api-acc.movilitas.cloud/v1/serialized_logistics/v2/api/suppliers/get_advanced_shipping_notification?supplier_tag=supplier-for-distributor-usa&purchase_order_id=PO1&dispatch_advice_id=DA2&include_aggregations=true&only_non_received_epcis=true \
  -H 'x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJzX2FqazQyS2RLQWhHciE3TUZtY1Q2UzhTQ3NDQ2hzc2RoTXRFUlNBIUNwUDhlZDkzU2htQ0hoaHIyTmg3Y0dBIiwiX2lkIjoiNWQyNzA4ZDc3NDQ1OTcxYjI5MmY4ZDI3IiwiaWF0IjoxNTY0MDU5ODc2LCJleHAiOjE1NjQxNDYyNzZ9.TBMv71CaxCNtE1opQMk0f1ncfbnZ0Cwnu7MWkTzkQqA' \
  -H 'x-channel-key: Ky1SpfEXmjj05fW3USBFD3pgoEi9AQ29Atsnj4Zy'


The application sends back a response that contains the following fields in the body:


FieldTypeDescription
successBooleanIndicates whether the request was successful (true) or not (false).
messageStringMessage response.
dataObjectThe shipment data.
     epcis_object_idStringThe identifier of the EPCIS file upload. The identifier is necessary to mark the EPCIS file as received in Movilitas.Cloud at the end of the receiving process.
    productsObject[]The object array of the products. Each product object contains the details of a product:
  • Code
  • Batches


Note: The application returns the top-level trade items only. Containers (SSCCs) are not returned.

          codeStringThe product code (GTIN).
         batchesObject[]The object array of the batches. Each batch object contains the details of a batch:
  • Batch ID
  • Expiration date
  • Serial numbers
                 idStringThe batch ID.
                 expiration_dateStringProduct expiration date. GS1 format YYMMDD. For example, 2021 December 15 is "211215".
                 serialsString[]The array of serial numbers. The serial numbers follow the GS1 standard.
    hierarchyObject[]The object array of the hierarchy, excluding the containers (SSCCs). Only returned when the include_aggregations field in the request was "true".

The structure follows the pattern below:
  • Trade item data
    • Trade item data
      • Trade item data
        • Trade item data
          • ...
      • Trade item data
      • ...
    • Trade item data
    • ...
  • Trade item data
  • ...

Children are organized in the underlying bullet points.

          product_codeStringThe product code (GTIN).
          batchStringThe batch ID.
          expiration_dateStringThe expiration date of the batch.
          serial_numberStringThe serial number.
          childrenObject[]The object array of the child trade items. The following fields are returned for a child trade item:
  • product_code
  • batch
  • expiration_date 
  • serial_number
  • children - If the child trade item contains further trade items.


Child trade items are described down to the lowest level.


For the data type and description of the fields, see the relevant rows of this table.


Sample Response (Success 200)


The following example illustrates the case when the aggregations (child trade items) are also included in the response. See the "hierarchy" part of the response.


{
    "success": true,
    "message": "Advanced Shipping Notification",
    "data": {
        "epcis_object_id": "681a1b01e5a688e40fcddffc",
        "products": [
            {
                "code": "30300040244510",
                "batches": [
                    {
                        "id": "0319AA",
                        "expiration_date": "260319",
                        "serials": [
                            "3TDSU025050700",
                            "3TDSU025050701",
                            "3TDSU025050702"
                        ]
                    }
                ]
            },
            {
                "code": "00300040244519",
                "batches": [
                    {
                        "id": "0319AA",
                        "expiration_date": "260319",
                        "serials": [
                            "0TDSU025050706",
                            "0TDSU025050707",
                            "0TDSU025050708"
                        ]
                    }
                ]
            }
        ],
        "hierarchy": [
            {
                "product_code": "00300040244519",
                "batch": "0319AA",
                "expiration_date": "260319",
                "serial_number": "0TDSU025050707"
            },
            {
                "product_code": "30300040244510",
                "batch": "0319AA",
                "expiration_date": "260319",
                "serial_number": "3TDSU025050701",
                "children": [
                    {
                        "product_code": "00300040244519",
                        "batch": "0319AA",
                        "expiration_date": "260319",
                        "serial_number": "0TDSU025050703"
                    },
                    {
                        "product_code": "00300040244519",
                        "batch": "0319AA",
                        "expiration_date": "260319",
                        "serial_number": "0TDSU025050702"
                    }
                ]
            },
            {
                "product_code": "00300040244519",
                "batch": "0319AA",
                "expiration_date": "260319",
                "serial_number": "0TDSU025050706"
            },
            {
                "product_code": "30300040244510",
                "batch": "0319AA",
                "expiration_date": "260319",
                "serial_number": "3TDSU025050700",
                "children": [
                    {
                        "product_code": "00300040244519",
                        "batch": "0319AA",
                        "expiration_date": "260319",
                        "serial_number": "0TDSU025050701"
                    },
                    {
                        "product_code": "00300040244519",
                        "batch": "0319AA",
                        "expiration_date": "260319",
                        "serial_number": "0TDSU025050700"
                    }
                ]
            },
            {
                "product_code": "30300040244510",
                "batch": "0319AA",
                "expiration_date": "260319",
                "serial_number": "3TDSU025050702",
                "children": [
                    {
                        "product_code": "00300040244519",
                        "batch": "0319AA",
                        "expiration_date": "260319",
                        "serial_number": "0TDSU025050705"
                    },
                    {
                        "product_code": "00300040244519",
                        "batch": "0319AA",
                        "expiration_date": "260319",
                        "serial_number": "0TDSU025050704"
                    }
                ]
            },
            {
                "product_code": "00300040244519",
                "batch": "0319AA",
                "expiration_date": "260319",
                "serial_number": "0TDSU025050708"
            }
        ]
    }
}


Errors and Resolution


This section lists some of the most general error messages or error types when sending the request.


Error Message or Error TypeError CodeDescription
No token providedERR0001No authentication token is provided. Ensure that you add the authentication token to the header of the request.
Failed to authenticate tokenERR0000Failed to authenticate the provided token. Double-check if your token has expired or has been revoked. Obtain a valid token by generating a static one or by getting a dynamic one through Authentication API.
Channel ID is missing or it needs to be in correct format-The channel key of your Serialized Logistics V2 API channel is not specified in the request. To get the channel key, go to Tenant Dashboard --> Channels in the Admin UI, open your Serialized Logistics V2 API channel, and find the channel key on the top of the Edit shopfloor channel panel.
Validation error-The given data is invalid. It does not follow the required data type or pattern. The response includes details about the specific issue. Follow the explanation in the response and correct your data.
No upload found with provided id-There is no Advanced Shipping Notification in Movilitas.Cloud based on the provided ID.

Make sure that you specify the ID as much as you can and the related Advanced Shipping Notification exists in Movilitas.Cloud. You can add an Advanced Shipping Notification to Movilitas.Cloud by receiving an EPCIS file from the supplier in the Serialized Logistics application.
Multiple uploads found with the provided id-There are multiple Advanced Shipping Notifications based on the provided ID. The application cannot determine which EPCIS file to choose.

Possible causes:
  • The given ID is not specific enough.
  • The given ID is a specific one but only one of the IDs, typically the purchase order ID, is given in the request and the other ID would also be needed.
Make sure that you specify the ID as much as you can. If possible, specify both the purchase order ID and the despatch advice ID.