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 Get Transaction Results 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_get_results


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.
transaction_idRequiredStringNMVS transaction ID
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 system returns the results of the specified transaction from NMVS.


Sample cURL Request 


curl -X POST \
  https://api.movilitas.cloud/v1/wholesaler/v1/api/bulk_get_results \
  -H 'Content-Type: application/json' \
  -H 'x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJzX2FqazQyS2RLQWhHciE3TUZtY1Q2UzhTQ3NDQ2hzc2RoTXRFUlNBIUNwUDhlZDkzU2htQ0hoaHIyTmg3Y0dBIiwiX2lkIjoiNWQyNzA4ZDc3NDQ1OTcxYjI5MmY4ZDI3IiwiaWF0IjoxNTc0MzI3MTIxLCJleHAiOjE1NzQ0MTM1MjF9.BHPvs52UOua9hMX8wny3YYn2221SlncnFCSDwafpYSQ' \
  -d '{
    "channel_key": "cfz9ArDcYF33IKj0oMIJ0MJfPj0aqs7AuZeBxqCN",
    "warehouse_id": "france-warehouse",
    "transaction_id": "bcc54f049c514338a385d99b0cda0983"
}'



Sample Response (Success 200) 


{
    "state": "processed",
    "success": true,
    "code": "2201-10000",
    "message": "Successfully processed",
    "data": {
        "nmvsOperationCode": "NMVS_SUCCESS"
    },
    "packs": [
        {
            "code": "2031-19999",
            "serialNumber": "PK049851B7809E0684A",
            "productCode": "40415117125115",
            "batchId": "TestB8119E41A9",
            "expiryDate": "260329",
            "success": true,
            "state": "FREE SAMPLE",
            "message": "successfully-processed"
        },
        {
            "code": "2031-19999",
            "serialNumber": "PK05011F46275C0B447",
            "productCode": "40415117125115",
            "batchId": "TestB8119E41A9",
            "expiryDate": "260329",
            "success": true,
            "state": "FREE SAMPLE",
            "message": "successfully-processed"
        }
    ]
}



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.