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 send a trace request to 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/trace-request


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
legal_name
Optional
StringThe name of the authorized person that represents the organization and sends the trace request.
organization
Optional
StringThe name of the organization.
address
Optional
StringThe address of the organization.
email
Optional
StringThe email address of the organization. For example, the address that belongs to the person sending the trace request.
phone_number
Optional
String

The phone number of the organization. For example, the phone number that belongs to the person sending the trace request.

reason
Optional
StringThe reason of the trace request.
description
Optional
String
The description related to the trace request.
statusOptionalStringThe status of the trace request.
response_requested
Optional
StringThe requested response.
product_GTINRequiredStringProduct code in GTIN format.
product_NDC_numberOptional
StringProduct code in NDC-10 format.
product_lot_numberOptionalStringProduct batch (LOT) as per the GS1 standard.
product_serial_number
RequiredStringProduct serial number as per the GS1 standard.
product_expiration_date
Optional
StringProduct expiration date in "Day of the Week, Month Day, Year" format. For example: "Sunday, December 31, 2028".


4. Send the request.


Sample cURL Request 


curl -X POST \
  https://api.movilitas.cloud/v1/serialized_logistics/v2/api/trace-request \
  -H 'Content-Type: application/json' \
  -H 'x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJzX2FqazQyS2RLQWhHciE3TUZtY1Q2UzhTQ3NDQ2hzc2RoTXRFUlNBIUNwUDhlZDkzU2htQ0hoaHIyTmg3Y0dBIiwiX2lkIjoiNWQyNzA4ZDc3NDQ1OTcxYjI5MmY4ZDI3IiwiaWF0IjoxNTY0MDU5ODc2LCJleHAiOjE1NjQxNDYyNzZ9.TBMv71CaxCNtE1opQMk0f1ncfbnZ0Cwnu7MWkTzkQqA' \
  -H 'x-channel-key: Ky1SpfEXmjj05fW3USBFD3pgoEi9AQ29Atsnj4Zy' \
  -d '{
  "legal_name": "John Doe",
  "organization": "New York State Board of Pharmacy",
  "address": "405 E 42nd St, New York, NY 10017, US",
  "email": "requestor@dscsa.dev",
  "phone_number": "555-555-5555",
  "reason": "Audit/Test Product",   
  "description": "N/A",
  "status": "Pending",
  "response_requested": "Transaction Information",
  "product_GTIN": "00360505257898",
  "product_NDC_number": "60505-2578-9",
  "product_lot_number": "TG1818",
  "product_serial_number": "0SWER072601",
  "product_expiration_date": "Thursday, February 1, 2029"
}'

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.
data
Object
The data about the transactions.
   transactionsObject[]The object array of the transactions related to the trace request. Each transaction object contains the details of the transaction.
      commentsStringComments.
      productDescriptionStringProduct name.
      productStrengthStringProduct strength.
      productDosageFormStringProduct dosage form.
      productNdcNumberStringProduct code in NDC-10 format.
      productSerialNumberStringProduct serial number as per the GS1 standard.
      productLotNumberStringProduct batch (LOT) as per the GS1 standard.
      productExpirationDateStringProduct expiration date (YYYY-MM-DD).
      productGtinStringProduct code in GTIN format.
      productContainerSizeStringThe size of the product container.
      productContainerQuantityNumberThe number of product containers.
      transactionIdStringThe transaction ID (purchase order ID).
      transactionDateStringThe date of the transaction (YYYY-MM-DD).
      ownerFromNameStringThe name of the sender company.
      ownerFromAddressStringThe address of the sender company.
      ownerToNameStringThe name of the receiver company.
      ownerToAddressStringThe address of the receiver company.


Sample Response (Success 200) 


{
    "success": true,
    "message": "Trace request successful",
    "data": {
        "transactions": [
            {
                "comments": "",
                "productDescription": "ATORVASTATIN CALCIUM",
                "productStrength": "10 mg/1",
                "productDosageForm": "TABLET, FILM COATED",
                "productNdcNumber": "60505-2578-9",
                "productSerialNumber": "0SWER072601",
                "productLotNumber": "TG1818",
                "productExpirationDate": "2029-02-01",
                "productGtin": "00360505257898",
                "productContainerSize": "90 TABLET, FILM COATED in 1 BOTTLE (60505-2578-9)",
                "productContainerQuantity": 1,
                "transactionId": "OUT-DEF-23072601",
                "transactionDate": "2023-07-26",
                "ownerFromName": "Mock Distributor 4",
                "ownerFromAddress": "704 Hauser St., New York, NY, 99999",
                "ownerToName": "DEF Pharmacy Co.",
                "ownerToAddress": "456 Another Street, Elsewhere, NY, 10001"
            },
            {
                "comments": "",
                "productDescription": "ATORVASTATIN CALCIUM",
                "productStrength": "10 mg/1",
                "productDosageForm": "TABLET, FILM COATED",
                "productNdcNumber": "60505-2578-9",
                "productSerialNumber": "0SWER072601",
                "productLotNumber": "TG1818",
                "productExpirationDate": "2029-02-01",
                "productGtin": "00360505257898",
                "productContainerSize": "90 TABLET, FILM COATED in 1 BOTTLE (60505-2578-9)",
                "productContainerQuantity": 1,
                "transactionId": "IN23072601",
                "transactionDate": "2023-07-26",
                "ownerFromName": "ABC Pharmaceuticals GmbH",
                "ownerFromAddress": "123 Any Street, Somewhere, NY, 10001",
                "ownerToName": "Mock Distributor 4",
                "ownerToAddress": "704 Hauser St., New York, NY, 99999"
            }
        ]
    }
}


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.