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 an Undo Dispense Single Pack 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 PATCH method and the following URL:


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


2. For the header, define the following:


KeyAction
Content-TypeApply JSON format for the content. Use the value application/json.  
x-access-tokenProvide 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_keyRequiredStringThe channel key of your Wholesaler API channel.
warehouse_idRequiredStringThe 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_tagOptionalStringIdentifies 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.
product_code_schemeRequiredStringProduct 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.

product_code    RequiredStringProduct code
serial_number RequiredStringSerial number of the product.
batchRequiredStringProduct batch
expiry_date 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_operatorOptionalStringOperator identifier. For example, email address or user name.
api_operator_groupOptionalStringOperator 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.
languageOptional
StringLanguage code (ISO 639-1)


4. Send the request. 


In case of a successful request, the pack is reactivated and its status is ACTIVE.


Sample cURL Request 


curl --location --request PATCH 'https://api.movilitas.cloud/v1/wholesaler/v1/api/single_undo_dispense' \
--header 'Content-Type: application/json' \
--header 'x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJCdGRqQV9QdCo5cG5lUFQtSG5EYkFHRmY5OUhqOGo0ZDQ3TWJSNEI0QyFIUk1HKl9hQjU2czlULUs5LWRIbS1yIiwiX2lkIjoiNWUxZWQ1NWEwMzQxMjYwNDc1MjY4MjkwIiwiaWF0IjoxNTc5MDc5MDQ4LCJleHAiOjE1NzkxNjU0NDh9.zcVXa6Q18yzVsr0WdizZUOg8jyz9OuiGrPDflWt12Xg' \
--data-raw '{
    "channel_key": "hQzCdmM5PWl3fqJzngbmnn5VP20Gz25l3qxWjFne",
    "warehouse_id": "france-warehouse",
    "product_code_scheme": "gs1",
    "product_code": "40415117125115",
    "serial_number": "PK05011F46275C0B447",
    "batch": "TestB8119E41A9",
    "expiry_date": "260329"
}'


Sample Response (Success 200)


{
    "success": true,
    "message": "Successfully processed",
    "code": "1111-10000",
    "data": {
        "state": "ACTIVE",
        "nmvsOperationCode": "NMVS_SUCCESS"
    }
}



Error Types and Resolution


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


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