You can use the Wholesaler API to integrate the third-party systems with the Wholesaler FMD application.


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


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


This article describes how to send a Bulk Undo Dispense request to Movilitas.Cloud using the Wholesaler API.


Movilitas.Cloud sends this request to the National Medicines Verification System (NMVS) assigned to the warehouse to complete the action on the packs included in the request.


To learn more about the available parameters of this request, log in to Movilitas.Cloud, open the tenant, select Channels, and select the Wholesaler API Documentation next to the shopfloor channel with the Wholesaler API source that you created.


API Tool to Use


In this document, we provide examples by using the cURL command-line tool. You can use any API tool to perform the API requests, for example, Postman or Katalon Studio. 


Before You Begin


1. You must enable the Wholesaler FMD application in the Admin UI.

2. You must create an API key and secret. 

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

4. You must configure the Wholesaler FMD application and the channel required to connect to NMVS.

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 POST method and the following URL:


https://api.movilitas.cloud/v1/wholesaler/v1/api/bulk_undo_dispense


2. For the header, define the following:


KeyAction
Content-TypeApply JSON format for the content. Use the value application/json.  
x-access-token
Provide the authentication token.


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


FieldRequired or Optional?TypeDescription
channel_keyRequired
String
The channel key of your Wholesaler API channel.
warehouse_id
Required
StringThe warehouse tag that identifies your warehouse.

Note: Make sure that you have registered the warehouse in the Wholesaler FMD application --> Warehouses tab and apply the value given in the Warehouse tag field.
mah_tag
Optional
String
Identifies the Marketing Authorization Holder (MAH). Only applicable in Wholesaler and 3PL mode or in 3PL mode.

Use it when you, as a 3PL, want to report the status to the MAH.

Note: Make sure that the MAH is registered in the Wholesaler FMD application --> MAHs tab and apply the value given in the Barcode tag field.
packs
RequiredObject[]The object array of packs for which you want to undo the "Dispense" action in bulk. Each object contains the details of a specific pack.
         productCodeSchemeRequiredStringProduct code scheme. Use one of the following values:
  • GTIN
  • GS1
  • PPN
  • NTIN
  • IFA


Note: Value is not case sensitive, so you can write, for example, "gs1". GTIN, GS1, and NTIN are handled as GTIN, while IFA and PPN as PPN.

         productCode    Required
StringProduct code
         serialNumber RequiredStringSerial number of the product.
         batchId RequiredStringProduct batch
         expiryDate RequiredStringExpiry date of the product. The date format is YYMMDD. For the last day of the month, '00' is accepted. For example 2024-December-31 can be written as 241200.
api_operator
Optional
StringOperator identifier. For example, email address or user name.
api_operator_group
Optional
StringOperator group
reference_idOptionalStringThe reference ID enables the user to link the request to a document.
reference_typeOptionalStringThe reference type relates to the type of the document, for example, PO or STO.


4. Send the request. 


In case of a successful request, the system returns with a response containing the transaction ID. You can track the status of the transaction in the Wholesaler FMD application --> Bulk actions tab.


Sample cURL Request 


curl -X POST \
  https://api.movilitas.cloud/v1/wholesaler/v1/api/bulk_undo_dispense \
  -H 'Content-Type: application/json' \
  -H 'x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJzX2FqazQyS2RLQWhHciE3TUZtY1Q2UzhTQ3NDQ2hzc2RoTXRFUlNBIUNwUDhlZDkzU2htQ0hoaHIyTmg3Y0dBIiwiX2lkIjoiNWQyNzA4ZDc3NDQ1OTcxYjI5MmY4ZDI3IiwiaWF0IjoxNTc0MzI3MTIxLCJleHAiOjE1NzQ0MTM1MjF9.BHPvs52UOua9hMX8wny3YYn2221SlncnFCSDwafpYSQ' \
  -d '{
    "channel_key": "cfz9ArDcYF33IKj0oMIJ0MJfPj0aqs7AuZeBxqCN",
    "warehouse_id": "france-warehouse",
    "packs": [
           {
               "productCodeScheme": "gs1",
               "productCode": "40415117125115",
               "serialNumber": "PK0430A25CCF577A44A",
               "batchId": "TestB8119E41A9",
               "expiryDate": "260329"
           },
           {
              "productCodeScheme": "gs1",
              "productCode": "40415117125115",
              "serialNumber": "PK044B498A5DFE77E46",
              "batchId": "TestB8119E41A9",
              "expiryDate": "260329"
           }
    ]
}'



Sample Response (Success 200) 


[
    {
        "state": "pending",
        "transactionId": "c47af74685ff4b6c871fe344937f592a",
        "success": true,
        "code": "2111-10000",
        "message": "successfully-processed",
        "data": {
            "nmvsOperationCode": "NMVS_SUCCESS"
        },
        "packs": [
            {
                "productCode": "40415117125115",
                "batchId": "TestB8119E41A9",
                "expiryDate": "260329"
            }
        ]
    }
]



Admin UI Example


The following screenshot is an example of the Wholesaler FMD application --> Bulk actions tab to illustrate how to track the status of the transaction.




Error Types and Resolution

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


Error TypeDescription
No token provided
No authentication token is provided. Ensure that you add the authentication token to the header of the request.
Invalid token
Failed 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.
Validation error
The data or its format is not valid. Make sure you give the data in JSON format as described above.