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 Free Sample 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_free_sample
2. For the header, define the following:
Key | Action |
---|---|
Content-Type | Apply 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.
Field | Required or Optional? | Type | Description |
---|---|---|---|
channel_key | Required | String | The channel key of your Wholesaler API channel. |
warehouse_id | Required | String | The 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. |
product_code_scheme | Required | String | Product code scheme. Use one of the following values:
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 | Required | String | Product code |
serial_number | Required | String | Serial number of the product. |
batch | Required | String | Product batch |
expiry_date | Required | String | Expiry 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 | String | Operator identifier. For example, email address or user name. |
api_operator_group | Optional | String | Operator group |
reference_id | Optional | String | The reference ID enables the user to link the request to a document. |
reference_type | Optional | String | The reference type relates to the type of the document, for example, PO or STO. |
language | Optional | String | Language code (ISO 639-1) |
4. Send the request.
In case of a successful request, the system returns with a response containing the new status of the pack.
Sample cURL Request
curl -X PATCH \ https://api.movilitas.cloud/v1/wholesaler/v1/api/single_free_sample \ -H 'Content-Type: application/json' \ -H 'x-access-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJzX2FqazQyS2RLQWhHciE3TUZtY1Q2UzhTQ3NDQ2hzc2RoTXRFUlNBIUNwUDhlZDkzU2htQ0hoaHIyTmg3Y0dBIiwiX2lkIjoiNWQyNzA4ZDc3NDQ1OTcxYjI5MmY4ZDI3IiwiaWF0IjoxNTc0MzI3MTIxLCJleHAiOjE1NzQ0MTM1MjF9.BHPvs52UOua9hMX8wny3YYn2221SlncnFCSDwafpYSQ' \ -d '{ "channel_key": "cfz9ArDcYF33IKj0oMIJ0MJfPj0aqs7AuZeBxqCN", "warehouse_id": "france-warehouse", "product_code_scheme": "gs1", "product_code": "40415117125115", "serial_number": "PK05261054090860941", "batch": "TestB8119E41A9", "expiry_date": "260329" }'
Sample Response (Success 200)
{ "success": true, "message": "Successfully processed", "code": "1031-10000", "data": { "state": "FREESAMPLE", "nmvsOperationCode": "NMVS_SUCCESS" } }
Error Types and Resolution
This section lists some of the most general error types when sending the request.
Error Type | Description |
---|---|
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. |