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 create an inbound order in 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 POST method and the following URL:


https://api.movilitas.cloud/v1/serialized_logistics/v2/api/inbound_orders


2. For the header, define the content type (JSON), 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
Content-TypeApply JSON format for the content. Use the value application/json.
x-access-tokenProvide the authentication token.
x-channel-keyProvide the channel key of your Serialized Logistics V2 API channel.


Header Option 2:


KeyAction
Content-TypeApply JSON format for the content. Use the value application/json.
AuthorizationProvide the authentication token as Bearer <token>.
x-channel-keyProvide the channel key of your Serialized Logistics V2 API channel.


3. In the body of the request, define the parameters and their values based on the table below.


FieldRequired or Optional?TypeDescription
order_idRequiredStringOrder ID
order_typeRequiredString

The type of the order. Enter one of the following values:

  • Internal
  • External
  • Returns
order_dateOptionalStringOrder date. GS1 format YYMMDD. For example, 2021 December 15 is "211215".
order_exp_delivery_dateOptionalStringExpected order delivery date. GS1 format YYMMDD. For example, 2021 December 15 is "211215". 
order_deadlineOptionalStringOrder deadline. GS1 format YYMMDD. For example, 2021 December 15 is "211215". 
delivery_idOptionalStringDelivery ID. If not specified, the deliver ID takes the order ID value.
warehouse_tagOptionalStringThe warehouse tag that identifies your warehouse.

Note: Make sure that you have registered the warehouse in the Serialized Logistics application --> Site management --> Warehouses tab and apply the value given in the Warehouse tag field.
supplier_tagOptionalStringThe 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.
allow_unlimited_over_under_receiptOptionalBoolean

Enables you to receive an unlimited amount for the order, ignoring the target quantity. The setting can be one of the following:

  • true - You can receive an unlimited amount. The tolerances are not used. Default setting.
  • false - You cannot receive an unlimited amount and you need to keep the target quantity. You need to set the over receipt tolerance and under receipt tolerance as described below.


If the field is not included in the request, the default value is "true", meaning that by default, an unlimited receipt is allowed.

over_receipt_toleranceOptionalNumber

Over receipt tolerance in percentage (%) for the order. Only applicable when "allow_unlimited_over_under_receipt" is set to "false".


The allowed value is 0 or a value that is greater than 0. The default value is 0.

under_receipt_toleranceOptionalNumber

Under receipt tolerance in percentage (%) for the order. Only applicable when "allow_unlimited_over_under_receipt" is set to "false".


The allowed value is 0 or a value that is greater than 0. The default value is 0.

item_listRequiredObject[]

The object array of the line items related to the order. Each line item object contains the details of the line item.


You can add multiple line items that have different or the same product data, there is no restriction. For example:

  • You have two line items with the same product code and batch but with different sales parameters.
  • You have line items with completely different product codes, batches, and other data.
        item_numberRequiredStringLine item number
        storage_location_tagOptionalStringThe storage location tag that identifies the storage location of your warehouse.

Note: Make sure that you have registered the storage location of the warehouse in the Serialized Logistics application --> Site management --> Warehouses --> Storage locations tab and apply the value given in the Storage location tag field.
        product_code_typeRequiredStringProduct code type. The application supports the following values:
  • GTIN - Global Trade Item Number
  • PPN - Pharmacy Product Number
  • CNK - Belgian code
  • NDC - National Drug Code in the USA (11-digit format)
        product_codeRequiredStringProduct code according to GTIN, PPN, CNK, or NDC product code type. For NDC, use the 11-digit format.

If the product code is not existing, it will be automatically created and connected to the tenant in Movilitas.Cloud, and then linked to the specified supplier.

After sending the API request, the product code specified as CNK or NDC is automatically converted into GTIN and both values are stored in Movilitas.Cloud. The main product code in Movilitas.Cloud will be GTIN.
        product_descriptionOptionalStringProduct description (product name). Free-form text field.
  • For a tenant having a connection to an NMVS from Movilitas.Cloud through an Arvato regulatory channel, the product master data are fetched from the NMVS after sending the API request. The master data taken from the NMVS includes the product name, the MAH (if available), and the wholesalers (if available).
  • For a product in the USA (NDC), the product master data are fetched from openFDA after sending the API request.
  • Otherwise, the product description (product name) specified in the API request is stored.
        batchOptionalStringProduct batch as per the GS1 standard.
        expiration_dateOptionalStringProduct expiration date. GS1 format YYMMDD. For example, 2021 December 15 is "211215".
        quantityRequiredNumberThe quantity of the line item. This is the number of items (units) to be received.
        unit_of_measurementRequiredStringThe unit of measurement for the quantity. For example, "Units" or "Packs".
        sales_quantityOptionalNumberThe sales quantity of the line item.
        sales_unit_of_measurementOptionalString

The sales unit of measurement for the sales quantity.


4. Send the request. The order is created and is in Open status that you can check under the Serialized Logistics application --> Orders --> Inbound orders tab.



Sample cURL Request 


curl -X POST \
  https://api.movilitas.cloud/v1/serialized_logistics/v2/api/inbound_orders \
  -H 'Content-Type: application/json' \
  -H 'x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJzX2FqazQyS2RLQWhHciE3TUZtY1Q2UzhTQ3NDQ2hzc2RoTXRFUlNBIUNwUDhlZDkzU2htQ0hoaHIyTmg3Y0dBIiwiX2lkIjoiNWQyNzA4ZDc3NDQ1OTcxYjI5MmY4ZDI3IiwiaWF0IjoxNTY0MDU5ODc2LCJleHAiOjE1NjQxNDYyNzZ9.TBMv71CaxCNtE1opQMk0f1ncfbnZ0Cwnu7MWkTzkQqA' \
  -H 'x-channel-key: Ky1SpfEXmjj05fW3USBFD3pgoEi9AQ29Atsnj4Zy' \
  -d '{
    "order_id": "Order231018",
    "order_type": "External",
    "order_date": "231018",
    "order_exp_delivery_date": "231023",
    "order_deadline": "231023",
    "delivery_id": "MOV/DEL/231018/1",
    "warehouse_tag": "distributor-in-the-usa",
    "supplier_tag": "supplier-for-distributor-usa",
    "item_list": [
        {
            "item_number": 1,
            "storage_location_tag": "USADSL-1",
            "product_code_type": "GTIN",
            "product_code": "00320230824017",
            "batch": "0901A",
            "expiration_date": "280901",
            "quantity": 100,
            "unit_of_measurement": "Units",
            "sales_quantity": 100,
            "sales_unit_of_measurement": "Units"
        },
        {
            "item_number": 2,
            "storage_location_tag": "USADSL-2",       
            "product_code_type": "GTIN",
            "product_code": "00320230824024",
            "quantity": 100,
            "unit_of_measurement": "Units",
            "sales_quantity": 100,
            "sales_unit_of_measurement": "Units"
        }
    ]
}'



Sample Response (Success 200) 


{
    "success": true,
    "message": "Inbound order created"
}



Admin UI Example



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.
Request body could not be parsed-The syntax of the request body is not correct, for example, a comma is missing at the end of a field. Make sure that the request body is defined in the correct way and that you use JSON format.
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.
Inbound order already exists-The order cannot be created because the order is already existing in the database.
Converting CNK to GTIN failed with code: <product_code>-The product code type of a line item in the order is CNK but the CNK product code is not existing in APB (Belgian database) and the conversion to GTIN failed. Make sure that the provided CNK value is valid. If you find that it is valid, contact Movilitas.Cloud Support.
Cannot find product code on OpenFDA for NDC-The product code type of a line item in the order is NDC but the NDC product code is not existing in openFDA (USA) and the conversion to GTIN failed. Make sure that the provided NDC value is valid.
Can not specify a supplier if the order type is internal-A supplier was provided in the request while the order type is internal. Suppliers can only be specified for external orders. Remove the supplier from your request.
Warehouse doesn't exist-The system cannot identify the warehouse based on the given warehouse tag. Either the warehouse is not registered or the warehouse is registered but lacks the warehouse tag. Go to the Serialized Logistics application --> Site management --> Warehouses tab in the Admin UI and complete the warehouse registration before sending the request over API. Make sure that you specify a warehouse tag and that you use this tag in your request over API.
Supplier doesn't exist
-The system cannot identify the supplier based on the given supplier tag. Either the supplier is not registered or the supplier is registered but lacks the supplier tag. Go to the Serialized Logistics application --> Site management --> Suppliers tab in the Admin UI and complete the supplier registration before sending the request over API. Make sure that you specify a supplier tag and that you use this tag in your request over API.

Note: Only applicable to inbound external orders.
Storage location doesn't exist
-The system cannot identify the storage location based on the given storage location tag. Either the storage location is not registered or the storage location is registered but lacks the storage location tag. Go to the Serialized Logistics application --> Site management --> Warehouses --> Storage locations tab in the Admin UI and complete the storage location registration before sending the request over API. Make sure that you specify a storage location tag and that you use this tag in your request over API.